diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-09-01 19:20:14 -0400 |
|---|---|---|
| committer | cah <cah@ableton.com> | 2019-12-03 11:35:32 +0100 |
| commit | e085e1ede8f14ccfc9a32168b8692d3ece84a66f (patch) | |
| tree | 45520e971420eeafaea508c1556213d02b53a1e8 | |
| parent | b428b8c7e7227cf96c83229df4d7bf009b6d2172 (diff) | |
Add cscript
| -rw-r--r-- | cscript | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cscript b/cscript new file mode 100644 index 00000000..98959a4a --- /dev/null +++ b/cscript @@ -0,0 +1,29 @@ +import os + +def build(target, options): + cmd = 'cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%s -DBUILD_PKGCONFIG_FILES=ON' % target.directory + if target.platform == 'windows': + # Hack: the build fails if PATH includes /opt/windows/64/bin; I don't know why: + # remove it + target.set('PATH', '%s:%s' % (target.mingw_path, os.environ['PATH'])) + f = open('mingw.cmake', 'w') + print("SET(CMAKE_SYSTEM_NAME Windows)", file=f) + print("SET(CMAKE_C_COMPILER %s/%s)" % (target.mingw_path, target.get('CC')), file=f) + print("SET(CMAKE_RC_COMPILER %s/%s)" % (target.mingw_path, target.get('WINRC')), file=f) + all = "" + for p in target.mingw_prefixes: + all += "%s " % p + print("SET(CMAKE_ROOT_FIND_PATH %s %s)" % (all, target.mingw_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) + cmd += ' -DCMAKE_TOOLCHAIN_FILE=mingw.cmake' + 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 VERBOSE=1' % target.parallel) + target.command('make install') |
