Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: meson.build

Issue 29595633: Issue 5870 - Implement the new ElemHideEmulation filter type (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Reworked the logic and added tests Created Jan. 31, 2018, 9:07 p.m.
Right Patch Set: Deal with ill formed filters. Created Feb. 14, 2018, 5:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 project('adblockpluscore', 'cpp', license: ['GPL3'], meson_version: '>0.40.0') 1 project('adblockpluscore', 'cpp', license: ['GPL3'], meson_version: '>0.40.0')
2 2
3 native = get_option('native') 3 native = get_option('native')
4 if native 4 if native
5 target_type='native' 5 target_type='native'
6 else 6 else
7 target_type='js' 7 target_type='js'
8 endif 8 endif
9 asan = get_option('asan')
9 10
10 if target_type == 'js' 11 if target_type == 'js'
11 # locate emscripten-config 12 # locate emscripten-config
12 python = import('python3').find_python() 13 python = import('python3').find_python()
13 emscripten_config = get_option('emscripten-config') 14 emscripten_config = get_option('emscripten-config')
14 command = run_command(python, '-c', 'import os.path, sys;print(os.path.expandu ser(sys.argv[1]))', emscripten_config) 15 command = run_command(python, '-c', 'import os.path, sys;print(os.path.expandu ser(sys.argv[1]))', emscripten_config)
15 if command.returncode() != 0 16 if command.returncode() != 0
16 error(command.stderr().strip()) 17 error(command.stderr().strip())
17 endif 18 endif
18 emscripten_config = command.stdout().strip() 19 emscripten_config = command.stdout().strip()
(...skipping 14 matching lines...) Expand all
33 endif 34 endif
34 nodejs = find_program(command.stdout().strip(), 'node', 'nodejs') 35 nodejs = find_program(command.stdout().strip(), 'node', 'nodejs')
35 endif 36 endif
36 37
37 JS_LIBRARY = files(join_paths('compiled', 'library.js')) 38 JS_LIBRARY = files(join_paths('compiled', 'library.js'))
38 BINDINGS_JS_LIBRARY = files(join_paths('compiled', 'bindings', 'library.js')) 39 BINDINGS_JS_LIBRARY = files(join_paths('compiled', 'bindings', 'library.js'))
39 BINDINGS_GENERATOR = 'bindings.cpp.js' 40 BINDINGS_GENERATOR = 'bindings.cpp.js'
40 BINDINGS_OUTPUT = 'bindings.js' 41 BINDINGS_OUTPUT = 'bindings.js'
41 COMPILER_OUTPUT = 'compiled.js' 42 COMPILER_OUTPUT = 'compiled.js'
42 # params for emcc compilation 43 # params for emcc compilation
43 ADDITIONAL_PARAMS = [ '-O3', '-std=c++1z', '-Wall', '-Werror', 44 ADDITIONAL_PARAMS = []
44 '-fno-rtti' ] 45
46 cpp_compiler = meson.get_compiler('cpp')
47 cpp_compiler_id = cpp_compiler.get_id()
48 LINK_PARAMS = []
49
50 if cpp_compiler_id != 'msvc'
51 ADDITIONAL_PARAMS += [ '-O3', '-std=c++14', '-Wall', '-fno-rtti' ]
52 endif
53
45 if target_type == 'js' 54 if target_type == 'js'
46 # CXXFLAGS specific to emcc 55 # CXXFLAGS specific to emcc
47 ADDITIONAL_PARAMS += [ '-m32', '--memory-init-file', '0', 56 ADDITIONAL_PARAMS += [ '-m32', '--memory-init-file', '0',
48 '--emit-symbol-map' ] 57 '--emit-symbol-map' ]
49 else 58 else
50 ADDITIONAL_PARAMS += [ '-fsanitize=address' ] 59 if cpp_compiler_id != 'msvc'
60 if asan
61 ADDITIONAL_PARAMS += [ '-fsanitize=address' ]
62 endif
63 endif
51 endif 64 endif
52 # additional params just for core 65 # additional params just for core
53 CORE_PARAMS = [ '-fno-exceptions' ] 66 CORE_PARAMS = []
67 if cpp_compiler_id != 'msvc'
68 CORE_PARAMS += [ '-fno-exceptions' ]
69 endif
54 70
55 DEFINES = [] 71 DEFINES = []
56 GENERATION_PARAMS = [ 72 GENERATION_PARAMS = [
57 ['SHELL_FILE', '"' + 73 ['SHELL_FILE', '"' +
58 join_paths(meson.source_root(), 'compiled', 'shell.js') + 74 join_paths(meson.source_root(), 'compiled', 'shell.js') +
59 '"'], 75 '"'],
60 ['ASM_JS', '2'], # "almost asm" 76 ['ASM_JS', '2'], # "almost asm"
61 ['TOTAL_MEMORY', 16*1024*1024], 77 ['TOTAL_MEMORY', 16*1024*1024],
62 ['TOTAL_STACK', 1*1024*1024], 78 ['TOTAL_STACK', 1*1024*1024],
63 ['ALLOW_MEMORY_GROWTH', 1], 79 ['ALLOW_MEMORY_GROWTH', 1],
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 128
113 generation_args = [] 129 generation_args = []
114 foreach param : GENERATION_PARAMS 130 foreach param : GENERATION_PARAMS
115 generation_args += '-s' 131 generation_args += '-s'
116 generation_args += param[0] + '=' + '@0@'.format(param[1]) 132 generation_args += param[0] + '=' + '@0@'.format(param[1])
117 endforeach 133 endforeach
118 134
119 optional_args = [] 135 optional_args = []
120 buildtype = get_option('buildtype') 136 buildtype = get_option('buildtype')
121 if buildtype.startswith('debug') 137 if buildtype.startswith('debug')
122 optional_args += '-DDEBUG' 138 if cpp_compiler_id != 'msvc'
123 optional_args += '-g3' 139 optional_args += '-DDEBUG'
124 if target_type == 'native' 140 optional_args += '-g3'
125 ADDITIONAL_PARAMS += [ '-fsanitize=address' ] 141 if target_type == 'native'
126 LINK_PARAMS = [ '-fsanitize=address' ] 142 if asan
143 ADDITIONAL_PARAMS += [ '-fsanitize=address' ]
144 LINK_PARAMS += [ '-fsanitize=address' ]
145 endif
146 endif
127 endif 147 endif
128 endif 148 endif
129 tracing = get_option('tracing') 149 tracing = get_option('tracing')
130 if tracing 150 if tracing
131 optional_args += '--tracing' 151 optional_args += '--tracing'
132 endif 152 endif
133 153
134 compiler_args = defines_args + generation_args + ADDITIONAL_PARAMS
135 154
136 if target_type == 'js' 155 if target_type == 'js'
156 compiler_args = defines_args + generation_args + ADDITIONAL_PARAMS
157
137 # build objects. 158 # build objects.
138 core_objects = [] 159 core_objects = []
139 bindings_objects = [] 160 bindings_objects = []
140 shared_objects = [] 161 shared_objects = []
141 foreach group : ['core', 'bindings', 'shared'] 162 foreach group : ['core', 'bindings', 'shared']
142 objects = [] 163 objects = []
143 foreach source_file : get_variable(group + '_sources') 164 foreach source_file : get_variable(group + '_sources')
144 output_file = source_file.underscorify() + '.o' 165 output_file = source_file.underscorify() + '.o'
145 command = [ emcc, '-MD', '-MF', '@DEPFILE@', '-c', '-o', '@OUTPUT@', 166 command = [ emcc, '-MD', '-MF', '@DEPFILE@', '-c', '-o', '@OUTPUT@',
146 '@INPUT@' ] + compiler_args 167 '@INPUT@' ] + compiler_args
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 input: core_objects + shared_objects, 207 input: core_objects + shared_objects,
187 output: COMPILER_OUTPUT, 208 output: COMPILER_OUTPUT,
188 depend_files: [ JS_LIBRARY ], 209 depend_files: [ JS_LIBRARY ],
189 command: [ 210 command: [
190 emcc, '-o', output_file, 211 emcc, '-o', output_file,
191 '--post-js', bindings_output, 212 '--post-js', bindings_output,
192 '--js-library', JS_LIBRARY, 213 '--js-library', JS_LIBRARY,
193 '@INPUT@' 214 '@INPUT@'
194 ] + compiler_args + optional_args) 215 ] + compiler_args + optional_args)
195 else 216 else
217 compiler_args = ADDITIONAL_PARAMS + CORE_PARAMS
196 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest') 218 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest')
197 GTEST_PARAMS = [] 219 GTEST_PARAMS = []
198 compiler = meson.get_compiler('cpp') 220 compiler = meson.get_compiler('cpp')
199 if compiler.has_argument('-pthread') 221 if compiler.has_argument('-pthread')
200 GTEST_PARAMS += '-pthread' 222 GTEST_PARAMS += '-pthread'
201 LINK_PARAMS += '-lpthread' 223 LINK_PARAMS += '-lpthread'
202 endif 224 endif
203 225
204 test_sources = [ 226 test_sources = [
205 'test/compiled/abptest.cpp', 227 'test/compiled/abptest.cpp',
206 'test/compiled/String.cpp', 228 'test/compiled/String.cpp',
207 'test/compiled/StringMap.cpp', 229 'test/compiled/StringMap.cpp',
208 'test/compiled/RegExp.cpp', 230 'test/compiled/RegExp.cpp',
209 'test/compiled/Filter.cpp', 231 'test/compiled/Filter.cpp',
210 ] 232 ]
211 233
212 adblockpluscore = library('adblockpluscore', shared_sources, 234 adblockpluscore = static_library('adblockpluscore', shared_sources,
213 native_sources, 235 native_sources,
214 cpp_args: ADDITIONAL_PARAMS + CORE_PARAMS, 236 cpp_args: compiler_args,
215 link_args: LINK_PARAMS) 237 link_args: LINK_PARAMS,
238 pic: true)
216 gtest = static_library('gtest', files(join_paths(GTEST_DIR, 'src', 'gtest-all. cc')), 239 gtest = static_library('gtest', files(join_paths(GTEST_DIR, 'src', 'gtest-all. cc')),
217 include_directories: [ 240 include_directories: [
218 include_directories(join_paths(GTEST_DIR, 'include' ), is_system: true), 241 include_directories(join_paths(GTEST_DIR, 'include' ), is_system: true),
219 include_directories(GTEST_DIR) 242 include_directories(GTEST_DIR)
220 ], 243 ],
221 cpp_args: GTEST_PARAMS) 244 cpp_args: GTEST_PARAMS)
222 abptest = executable('abptest', test_sources, 245 abptest = executable('abptest', test_sources,
223 cpp_args: ADDITIONAL_PARAMS + CORE_PARAMS + ['-DINSIDE_TE STS'], 246 cpp_args: compiler_args + ['-DINSIDE_TESTS'],
224 include_directories: include_directories(join_paths(GTEST _DIR, 'include')), 247 include_directories: include_directories(join_paths(GTEST _DIR, 'include')),
225 link_args: LINK_PARAMS, 248 link_args: LINK_PARAMS,
226 link_with: [ adblockpluscore, gtest ]) 249 link_with: [ adblockpluscore, gtest ])
227 test('abptest', abptest) 250 test('abptest', abptest)
228 endif 251 endif
229 252
LEFTRIGHT

Powered by Google App Engine
This is Rietveld