aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-09-03 16:34:17 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-09-04 10:42:06 +0300
commite07788b030cc6d3621a450c12944b7ffa78acd41 (patch)
tree2390c8316c50ea1ad181a06a4c125bab9cd0bc10 /tools
parentc51c5308b9d3243fec791fb39ca7691706b037e7 (diff)
Remove the old mechanism of generating a CMake toolchain file on the fly when 'emconfigure cmake' is called. Instead, the Emscripten toolchain file in Emscripten\cmake\Platform\Emscripten.cmake is always used. This unifies the CMake toolchain handling to use the same toolchain independent of how CMake gets invoked.
Diffstat (limited to 'tools')
-rw-r--r--tools/shared.py33
1 files changed, 6 insertions, 27 deletions
diff --git a/tools/shared.py b/tools/shared.py
index b0b3985e..1426e792 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -801,33 +801,12 @@ class Building:
@staticmethod
def handle_CMake_toolchain(args, env):
- CMakeToolchain = ('''# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Linux)
-
-# which C and C++ compiler to use
-SET(CMAKE_C_COMPILER %(winfix)s$EMSCRIPTEN_ROOT/emcc)
-SET(CMAKE_CXX_COMPILER %(winfix)s$EMSCRIPTEN_ROOT/em++)
-SET(CMAKE_AR %(winfix)s$EMSCRIPTEN_ROOT/emar)
-SET(CMAKE_RANLIB %(winfix)s$EMSCRIPTEN_ROOT/emranlib)
-SET(CMAKE_C_FLAGS $CFLAGS)
-SET(CMAKE_CXX_FLAGS $CXXFLAGS)
-
-# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH $EMSCRIPTEN_ROOT/system/include )
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS else 'python ' }) \
- .replace('$EMSCRIPTEN_ROOT', path_from_root('').replace('\\', '/')) \
- .replace('$CFLAGS', env['CFLAGS']) \
- .replace('$CXXFLAGS', env['CFLAGS'])
- toolchainFile = mkstemp(suffix='.cmaketoolchain.txt', dir=configuration.TEMP_DIR)[1]
- open(toolchainFile, 'w').write(CMakeToolchain)
- args.append('-DCMAKE_TOOLCHAIN_FILE=%s' % os.path.abspath(toolchainFile))
+ # Don't append a toolchain file if the user specified one already.
+ for arg in args:
+ if '-DCMAKE_TOOLCHAIN_FILE' in arg:
+ return args
+
+ args.append('-DCMAKE_TOOLCHAIN_FILE=' + path_from_root('cmake', 'Platform', 'Emscripten.cmake'))
return args
@staticmethod