| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 project('adblockpluscore', 'cpp', license: ['GPL3']) | 1 project('adblockpluscore', license: ['GPL3'], meson_version: '>0.40.0') | 
| 
 
sergei
2017/10/16 15:27:13
I wonder how we plan to use it in the derived proj
 
 | |
| 2 | 2 | 
| 3 # locate emscripten-config | 3 # locate emscripten-config | 
| 4 python = import('python3').find_python() | 4 python = import('python3').find_python() | 
| 5 emscripten_config = get_option('emscripten-config') | 5 emscripten_config = get_option('emscripten-config') | 
| 6 command = run_command(python, '-c', 'import os.path, sys;print(os.path.expanduse r(sys.argv[1]))', emscripten_config) | 6 command = run_command(python, '-c', 'import os.path, sys;print(os.path.expanduse r(sys.argv[1]))', emscripten_config) | 
| 7 if command.returncode() != 0 | 7 if command.returncode() != 0 | 
| 8 error(command.stderr().strip()) | 8 error(command.stderr().strip()) | 
| 9 endif | 9 endif | 
| 10 emscripten_config = command.stdout().strip() | 10 emscripten_config = command.stdout().strip() | 
| 11 message('Emscripten config file: ' + emscripten_config) | 11 message('Emscripten config file: ' + emscripten_config) | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 core_sources = [ | 77 core_sources = [ | 
| 78 'compiled/traceInit.cpp', | 78 'compiled/traceInit.cpp', | 
| 79 ] | 79 ] | 
| 80 # sources for the bindings generator | 80 # sources for the bindings generator | 
| 81 bindings_sources = [ | 81 bindings_sources = [ | 
| 82 'compiled/bindings/generator.cpp', | 82 'compiled/bindings/generator.cpp', | 
| 83 'compiled/bindings/main.cpp', | 83 'compiled/bindings/main.cpp', | 
| 84 ] | 84 ] | 
| 85 | 85 | 
| 86 defines_args = [] | 86 defines_args = [] | 
| 87 foreach define : DEFINES | 87 foreach define : DEFINES | 
| 
 
sergei
2017/10/16 15:27:12
DEFINES is empty, it seems a good idea to keep it,
 
 | |
| 88 defines_args += '-D' + define | 88 defines_args += '-D' + define | 
| 89 endforeach | 89 endforeach | 
| 90 | 90 | 
| 91 generation_args = [] | 91 generation_args = [] | 
| 92 foreach param : GENERATION_PARAMS | 92 foreach param : GENERATION_PARAMS | 
| 93 generation_args += '-s' | 93 generation_args += '-s' | 
| 94 generation_args += param[0] + '=' + '@0@'.format(param[1]) | 94 generation_args += param[0] + '=' + '@0@'.format(param[1]) | 
| 95 endforeach | 95 endforeach | 
| 96 | 96 | 
| 97 optional_args = [] | 97 optional_args = [] | 
| 98 buildtype = get_option('buildtype') | 98 buildtype = get_option('buildtype') | 
| 99 if buildtype.startswith('debug') | 99 if buildtype.startswith('debug') | 
| 100 optional_args += '-DDEBUG' | |
| 100 optional_args += '-g3' | 101 optional_args += '-g3' | 
| 
 
sergei
2017/10/16 15:27:13
We need to check why -g3 is added twice.
 
 | |
| 101 endif | 102 endif | 
| 102 tracing = get_option('tracing') | 103 tracing = get_option('tracing') | 
| 103 if tracing | 104 if tracing | 
| 104 optional_args += '--tracing' | 105 optional_args += '--tracing' | 
| 105 endif | 106 endif | 
| 106 | 107 | 
| 107 compiler_args = defines_args + generation_args + optional_args + ADDITIONAL_PARA MS | 108 compiler_args = defines_args + generation_args + ADDITIONAL_PARAMS | 
| 
 
sergei
2017/10/16 15:27:12
optional_args are included two times, the second t
 
hub
2017/10/26 16:15:27
good catch.
 
 | |
| 108 | 109 | 
| 109 # build objects. | 110 # build objects. | 
| 110 core_objects = [] | 111 core_objects = [] | 
| 111 bindings_objects = [] | 112 bindings_objects = [] | 
| 112 shared_objects = [] | 113 shared_objects = [] | 
| 113 foreach group : ['core', 'bindings', 'shared'] | 114 foreach group : ['core', 'bindings', 'shared'] | 
| 114 objects = [] | 115 objects = [] | 
| 115 foreach source_file : get_variable(group + '_sources') | 116 foreach source_file : get_variable(group + '_sources') | 
| 116 output_file = source_file.underscorify() + '.o' | 117 output_file = source_file.underscorify() + '.o' | 
| 117 command = [ emcc, '-MD', '-MF', '@DEPFILE@', '-c', '-o', '@OUTPUT@', | 118 command = [ emcc, '-MD', '-MF', '@DEPFILE@', '-c', '-o', '@OUTPUT@', | 
| (...skipping 27 matching lines...) Expand all Loading... | |
| 145 '@INPUT@' | 146 '@INPUT@' | 
| 146 ]) | 147 ]) | 
| 147 # run the binding generator | 148 # run the binding generator | 
| 148 bindings_output = custom_target(BINDINGS_OUTPUT, | 149 bindings_output = custom_target(BINDINGS_OUTPUT, | 
| 149 input: bindings_generator, | 150 input: bindings_generator, | 
| 150 output: BINDINGS_OUTPUT, | 151 output: BINDINGS_OUTPUT, | 
| 151 capture: true, | 152 capture: true, | 
| 152 command: [nodejs, '@INPUT@']) | 153 command: [nodejs, '@INPUT@']) | 
| 153 | 154 | 
| 154 # link the core | 155 # link the core | 
| 155 output_file = join_paths(meson.source_root(), 'lib', COMPILER_OUTPUT) | 156 output_file = join_paths(meson.source_root(), 'lib', COMPILER_OUTPUT) | 
| 
 
sergei
2017/10/16 15:27:12
On 2017/10/11 10:00:47, Wladimir Palant wrote:
htt
 
 | |
| 156 compiler_output = custom_target(COMPILER_OUTPUT, | 157 compiler_output = custom_target(COMPILER_OUTPUT, | 
| 157 build_by_default: true, | 158 build_by_default: true, | 
| 158 input: core_objects + shared_objects, | 159 input: core_objects + shared_objects, | 
| 159 output: COMPILER_OUTPUT, | 160 output: COMPILER_OUTPUT, | 
| 160 depend_files: [ JS_LIBRARY ], | 161 depend_files: [ JS_LIBRARY ], | 
| 161 command: [ | 162 command: [ | 
| 162 emcc, '-o', output_file, | 163 emcc, '-o', output_file, | 
| 163 '--post-js', bindings_output, | 164 '--post-js', bindings_output, | 
| 164 '--js-library', JS_LIBRARY, | 165 '--js-library', JS_LIBRARY, | 
| 165 '@INPUT@' | 166 '@INPUT@' | 
| 166 ] + compiler_args + optional_args) | 167 ] + compiler_args + optional_args) | 
| LEFT | RIGHT |