diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-01-28 09:35:39 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-12-27 02:30:45 +0100 |
| commit | 33b4fe5de9c44acb81dd88f369d2615384204a00 (patch) | |
| tree | 1e2ca998344d6165c95e70c5d7173a7cd7d6c2ba /cscript | |
| parent | 4a25a0e7a701960717fc836226b98b558aeb3781 (diff) | |
Add cscript file.
Diffstat (limited to 'cscript')
| -rw-r--r-- | cscript | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -0,0 +1,39 @@ +import os + +def build(target, options): + cmd = 'cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%s' % target.directory + if target.platform == 'windows': + # Hack: the build fails if PATH includes /opt/windows/64/bin; I don't know why: + # remove it + print(os.environ['PATH']) + print(target.tool_path) + target.set('PATH', '%s:%s' % (target.tool_path, os.environ['PATH'])) + f = open('mingw.cmake', 'w') + print("SET(CMAKE_SYSTEM_NAME Windows)", file=f) + cc = target.get('CC') + cc = cc.replace("ccache ", "") + cc = cc.replace("\"", "") + if target.ccache: + print("set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)", file=f) + print("SET(CMAKE_C_COMPILER %s/%s)" % (target.tool_path, cc), file=f) + print("SET(CMAKE_RC_COMPILER %s/%s)" % (target.tool_path, target.get('WINRC')), file=f) + all = "%s " % target.environment_prefix + print("SET(CMAKE_ROOT_FIND_PATH %s %s)" % (all, target.tool_path), file=f) + print("SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)", file=f) + print("SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)", file=f) + print("SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)", file=f) + arch = 'x86_64-w64-mingw32.shared' if target.bits == 64 else 'i686-w64-mingw32.shared' + print("SET(XercescppLib_PATH libxerces-c.a)", file=f) + print("SET(XercescppLib_Debug_PATH libxerces-c.a)", file=f) + print("SET(XercescppLib_include_DIR %s/include)" % arch, file=f) + print("SET(OpenSSLLib_PATH libcrypto.dll.a)", file=f) + print("SET(OpenSSLLib_include_DIR %s/include)" % arch, file=f) + cmd += ' -DCMAKE_TOOLCHAIN_FILE=mingw.cmake -DKM_WIN32_UTF8=1' + f.close() + if target.platform == 'linux': + cmd += ' -DBUILD_SHARED_LIBS=OFF' + if target.platform == 'osx': + cmd += ' -DCMAKE_OSX_SYSROOT=%s/MacOSX%s.sdk' % (target.sdk_prefix, target.sdk) + + target.command(cmd) + target.command('make -j%d install VERBOSE=1' % target.parallel) |
