Changes in wscript [65b5381:342eb13e]
Legend:
- Unmodified
- Added
- Removed
-
wscript
r65b5381 r342eb13e 108 108 ctx.load('gnu_dirs') 109 109 110 target_platform = sys.platform 111 if ctx.options.target_platform: 112 target_platform = ctx.options.target_platform 113 114 115 if target_platform=='emscripten': 116 # need to force spaces between flag -o and path 117 # inspired from : 118 # https://github.com/waf-project/waf/blob/master/waflib/extras/c_emscripten.py (#1885) 119 # (OSX /emscripten 1.37.9) 120 ctx.env.CC_TGT_F = ['-c', '-o', ''] 121 ctx.env.CCLNK_TGT_F = ['-o', ''] 110 122 # check for common headers 111 123 ctx.check(header_name='stdlib.h') … … 118 130 ctx.check(header_name='unistd.h', mandatory = False) 119 131 120 target_platform = sys.platform121 if ctx.options.target_platform:122 target_platform = ctx.options.target_platform123 132 ctx.env['DEST_OS'] = target_platform 124 133 … … 133 142 ctx.env.prepend_value('CFLAGS', ['-O0']) 134 143 else: 135 # default to -O2 in release mode 136 ctx.env.prepend_value('CFLAGS', ['-O2']) 144 if target_platform == 'emscripten': 145 # -Oz for small js file generation 146 ctx.env.prepend_value('CFLAGS', ['-Oz']) 147 else: 148 # default to -O2 in release mode 149 ctx.env.prepend_value('CFLAGS', ['-O2']) 137 150 # enable debug symbols and configure warnings 138 151 ctx.env.prepend_value('CFLAGS', ['-g', '-Wall', '-Wextra']) … … 216 229 import os.path 217 230 ctx.env.CFLAGS += [ '-I' + os.path.join(os.environ['EMSCRIPTEN'], 'system', 'include') ] 218 ctx.env.CFLAGS += ['-Oz'] 231 232 if ctx.options.build_type == "debug": 233 ctx.env.cshlib_PATTERN = '%s.js' 234 ctx.env.LINKFLAGS += ['-s','ASSERTIONS=2'] 235 ctx.env.LINKFLAGS += ['-s','SAFE_HEAP=1'] 236 ctx.env.LINKFLAGS += ['-s','ALIASING_FUNCTION_POINTERS=0'] 237 ctx.env.LINKFLAGS += ['-O0'] 238 else: 239 ctx.env.LINKFLAGS += ['-Oz'] 240 ctx.env.cshlib_PATTERN = '%s.min.js' 241 242 # doesnt ship file system support in lib 243 ctx.env.LINKFLAGS_cshlib += ['-s', 'NO_FILESYSTEM=1'] 244 # put memory file inside generated js files for easier portability 245 ctx.env.LINKFLAGS += ['--memory-init-file', '0'] 219 246 ctx.env.cprogram_PATTERN = "%s.js" 220 if (ctx.options.enable_atlas != True): 221 ctx.options.enable_atlas = False 247 ctx.env.cstlib_PATTERN = '%s.a' 248 249 # tell emscripten functions we want to expose 250 from python.lib.gen_external import get_c_declarations, get_cpp_objects_from_c_declarations, get_all_func_names_from_lib, generate_lib_from_c_declarations 251 c_decls = get_c_declarations(usedouble=False) # emscripten can't use double 252 objects = get_cpp_objects_from_c_declarations(c_decls) 253 # ensure that aubio structs are exported 254 objects += ['fvec_t', 'cvec_t', 'fmat_t'] 255 lib = generate_lib_from_c_declarations(objects, c_decls) 256 exported_funcnames = get_all_func_names_from_lib(lib) 257 c_mangled_names = ['_' + s for s in exported_funcnames] 258 ctx.env.LINKFLAGS_cshlib += ['-s', 'EXPORTED_FUNCTIONS=%s' % c_mangled_names] 259 260 if (ctx.options.enable_atlas != True): 261 ctx.options.enable_atlas = False 222 262 223 263 # check support for C99 __VA_ARGS__ macros
Note: See TracChangeset
for help on using the changeset viewer.