|
24 | 24 | * With CMake, do something like
|
25 | 25 |
|
26 | 26 | SET(CMAKE_C_COMPILER "PATH/emmaken.py")
|
27 |
| - SET(CMAKE_CXX_COMPILER "PATH/emmaken.py") |
| 27 | + SET(CMAKE_CXX_COMPILER "PATH/emmakenxx.py") |
28 | 28 | SET(CMAKE_LINKER "PATH/emmaken.py")
|
29 | 29 | SET(CMAKE_CXX_LINKER "PATH/emmaken.py")
|
30 | 30 | SET(CMAKE_C_LINK_EXECUTABLE "PATH/emmaken.py")
|
|
37 | 37 | give to Emscripten. Note that this tool doesn't run Emscripten itself. Note
|
38 | 38 | also that you may need to do some manual fiddling later, for example to
|
39 | 39 | link files that weren't linked, and them llvm-dis them.
|
| 40 | +
|
| 41 | +Note the appearance of emmakenxx.py instead of emmaken.py |
| 42 | +for the C++ compiler. This is needed for cases where we get |
| 43 | +a C++ file with a C extension, in which case CMake can be told |
| 44 | +to run g++ on it despite the .c extension, see |
| 45 | +
|
| 46 | + https://github.com/kripken/emscripten/issues/6 |
| 47 | +
|
| 48 | +(If a similar situation occurs with ./configure, you can do the same there too.) |
40 | 49 | '''
|
41 | 50 |
|
42 | 51 | import sys
|
@@ -65,6 +74,11 @@ def path_from_root(*pathelems):
|
65 | 74 | CXX = os.environ.get('EMMAKEN_COMPILER') or LLVM_GCC
|
66 | 75 | CC = to_cc(CXX)
|
67 | 76 |
|
| 77 | + # If we got here from a redirection through emmakenxx.py, then force a C++ compiler here |
| 78 | + if sys.argv[-1] == '-EMMAKEN_CXX': |
| 79 | + CC = CXX |
| 80 | + sys.argv = sys.argv[:-1] |
| 81 | + |
68 | 82 | CC_ARG_SKIP = ['-O1', '-O2', '-O3']
|
69 | 83 | CC_ADDITIONAL_ARGS = ['-m32', '-U__i386__', '-U__x86_64__', '-U__SSE__', '-UX87_DOUBLE_ROUNDING', '-UHAVE_GCC_ASM_FOR_X87']
|
70 | 84 | ALLOWED_LINK_ARGS = ['-f', '-help', '-o', '-print-after', '-print-after-all', '-print-before',
|
|
0 commit comments