aboutsummaryrefslogtreecommitdiff
path: root/tools/emmaken.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-04-27 16:58:13 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-04-27 16:58:13 -0700
commit85cba40ddc63e34f7f5ebc06a53e1f00137662c7 (patch)
tree0a812aaa5b200b6abc5292210780d341d685c567 /tools/emmaken.py
parent6345f59ce83d57b08866083dde88f1157dfb8921 (diff)
emmakenxx.py to handle .c files in projects that are really c++
Diffstat (limited to 'tools/emmaken.py')
-rwxr-xr-xtools/emmaken.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/emmaken.py b/tools/emmaken.py
index 1b3b6643..62a367c7 100755
--- a/tools/emmaken.py
+++ b/tools/emmaken.py
@@ -24,7 +24,7 @@ Example uses:
* With CMake, do something like
SET(CMAKE_C_COMPILER "PATH/emmaken.py")
- SET(CMAKE_CXX_COMPILER "PATH/emmaken.py")
+ SET(CMAKE_CXX_COMPILER "PATH/emmakenxx.py")
SET(CMAKE_LINKER "PATH/emmaken.py")
SET(CMAKE_CXX_LINKER "PATH/emmaken.py")
SET(CMAKE_C_LINK_EXECUTABLE "PATH/emmaken.py")
@@ -37,6 +37,15 @@ LLVM instead of the normal output, and end up with .ll files that you can
give to Emscripten. Note that this tool doesn't run Emscripten itself. Note
also that you may need to do some manual fiddling later, for example to
link files that weren't linked, and them llvm-dis them.
+
+Note the appearance of emmakenxx.py instead of emmaken.py
+for the C++ compiler. This is needed for cases where we get
+a C++ file with a C extension, in which case CMake can be told
+to run g++ on it despite the .c extension, see
+
+ https://github.com/kripken/emscripten/issues/6
+
+(If a similar situation occurs with ./configure, you can do the same there too.)
'''
import sys
@@ -65,6 +74,11 @@ try:
CXX = os.environ.get('EMMAKEN_COMPILER') or LLVM_GCC
CC = to_cc(CXX)
+ # If we got here from a redirection through emmakenxx.py, then force a C++ compiler here
+ if sys.argv[-1] == '-EMMAKEN_CXX':
+ CC = CXX
+ sys.argv = sys.argv[:-1]
+
CC_ARG_SKIP = ['-O1', '-O2', '-O3']
CC_ADDITIONAL_ARGS = ['-m32', '-U__i386__', '-U__x86_64__', '-U__SSE__', '-UX87_DOUBLE_ROUNDING', '-UHAVE_GCC_ASM_FOR_X87']
ALLOWED_LINK_ARGS = ['-f', '-help', '-o', '-print-after', '-print-after-all', '-print-before',