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

Side by Side Diff: meson.build

Issue 29690863: Issue 6360 - Add support of MSVS (Closed) Base URL: github.com:adblockplus/adblockpluscore
Patch Set: Created Feb. 6, 2018, 12:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
10 if target_type == 'js' 10 if target_type == 'js'
(...skipping 22 matching lines...) Expand all
33 endif 33 endif
34 nodejs = find_program(command.stdout().strip(), 'node', 'nodejs') 34 nodejs = find_program(command.stdout().strip(), 'node', 'nodejs')
35 endif 35 endif
36 36
37 JS_LIBRARY = files(join_paths('compiled', 'library.js')) 37 JS_LIBRARY = files(join_paths('compiled', 'library.js'))
38 BINDINGS_JS_LIBRARY = files(join_paths('compiled', 'bindings', 'library.js')) 38 BINDINGS_JS_LIBRARY = files(join_paths('compiled', 'bindings', 'library.js'))
39 BINDINGS_GENERATOR = 'bindings.cpp.js' 39 BINDINGS_GENERATOR = 'bindings.cpp.js'
40 BINDINGS_OUTPUT = 'bindings.js' 40 BINDINGS_OUTPUT = 'bindings.js'
41 COMPILER_OUTPUT = 'compiled.js' 41 COMPILER_OUTPUT = 'compiled.js'
42 # params for emcc compilation 42 # params for emcc compilation
43 ADDITIONAL_PARAMS = [ '-O3', '-std=c++14', '-Wall', '-Werror', 43 ADDITIONAL_PARAMS = []
44 '-fno-rtti' ] 44
45 cpp_compiler = meson.get_compiler('cpp')
46 cpp_compiler_id = cpp_compiler.get_id()
47 LINK_PARAMS = []
48
49 if cpp_compiler_id != 'msvc'
50 ADDITIONAL_PARAMS += [ '-O3', '-std=c++14', '-Wall', '-fno-rtti' ]
51 endif
52
45 if target_type == 'js' 53 if target_type == 'js'
46 # CXXFLAGS specific to emcc 54 # CXXFLAGS specific to emcc
47 ADDITIONAL_PARAMS += [ '-m32', '--memory-init-file', '0', 55 ADDITIONAL_PARAMS += [ '-m32', '--memory-init-file', '0',
48 '--emit-symbol-map' ] 56 '--emit-symbol-map' ]
49 else 57 else
50 ADDITIONAL_PARAMS += [ '-fsanitize=address' ] 58 if cpp_compiler_id != 'msvc'
59 ADDITIONAL_PARAMS += [ '-fsanitize=address' ]
60 endif
51 endif 61 endif
52 # additional params just for core 62 # additional params just for core
53 CORE_PARAMS = [ '-fno-exceptions' ] 63 CORE_PARAMS = []
64 if cpp_compiler_id != 'msvc'
65 CORE_PARAMS += [ '-fno-exceptions' ]
66 endif
54 67
55 DEFINES = [] 68 DEFINES = []
56 GENERATION_PARAMS = [ 69 GENERATION_PARAMS = [
57 ['SHELL_FILE', '"' + 70 ['SHELL_FILE', '"' +
58 join_paths(meson.source_root(), 'compiled', 'shell.js') + 71 join_paths(meson.source_root(), 'compiled', 'shell.js') +
59 '"'], 72 '"'],
60 ['ASM_JS', '2'], # "almost asm" 73 ['ASM_JS', '2'], # "almost asm"
61 ['TOTAL_MEMORY', 16*1024*1024], 74 ['TOTAL_MEMORY', 16*1024*1024],
62 ['TOTAL_STACK', 1*1024*1024], 75 ['TOTAL_STACK', 1*1024*1024],
63 ['ALLOW_MEMORY_GROWTH', 1], 76 ['ALLOW_MEMORY_GROWTH', 1],
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 125
113 generation_args = [] 126 generation_args = []
114 foreach param : GENERATION_PARAMS 127 foreach param : GENERATION_PARAMS
115 generation_args += '-s' 128 generation_args += '-s'
116 generation_args += param[0] + '=' + '@0@'.format(param[1]) 129 generation_args += param[0] + '=' + '@0@'.format(param[1])
117 endforeach 130 endforeach
118 131
119 optional_args = [] 132 optional_args = []
120 buildtype = get_option('buildtype') 133 buildtype = get_option('buildtype')
121 if buildtype.startswith('debug') 134 if buildtype.startswith('debug')
122 optional_args += '-DDEBUG' 135 if cpp_compiler_id != 'msvc'
123 optional_args += '-g3' 136 optional_args += '-DDEBUG'
124 if target_type == 'native' 137 optional_args += '-g3'
125 ADDITIONAL_PARAMS += [ '-fsanitize=address' ] 138 if target_type == 'native'
126 LINK_PARAMS = [ '-fsanitize=address' ] 139 ADDITIONAL_PARAMS += [ '-fsanitize=address' ]
140 LINK_PARAMS += [ '-fsanitize=address' ]
141 endif
127 endif 142 endif
128 endif 143 endif
129 tracing = get_option('tracing') 144 tracing = get_option('tracing')
130 if tracing 145 if tracing
131 optional_args += '--tracing' 146 optional_args += '--tracing'
132 endif 147 endif
133 148
134 compiler_args = defines_args + generation_args + ADDITIONAL_PARAMS
135 149
136 if target_type == 'js' 150 if target_type == 'js'
151 compiler_args = defines_args + generation_args + ADDITIONAL_PARAMS
152
137 # build objects. 153 # build objects.
138 core_objects = [] 154 core_objects = []
139 bindings_objects = [] 155 bindings_objects = []
140 shared_objects = [] 156 shared_objects = []
141 foreach group : ['core', 'bindings', 'shared'] 157 foreach group : ['core', 'bindings', 'shared']
142 objects = [] 158 objects = []
143 foreach source_file : get_variable(group + '_sources') 159 foreach source_file : get_variable(group + '_sources')
144 output_file = source_file.underscorify() + '.o' 160 output_file = source_file.underscorify() + '.o'
145 command = [ emcc, '-MD', '-MF', '@DEPFILE@', '-c', '-o', '@OUTPUT@', 161 command = [ emcc, '-MD', '-MF', '@DEPFILE@', '-c', '-o', '@OUTPUT@',
146 '@INPUT@' ] + compiler_args 162 '@INPUT@' ] + compiler_args
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 input: core_objects + shared_objects, 202 input: core_objects + shared_objects,
187 output: COMPILER_OUTPUT, 203 output: COMPILER_OUTPUT,
188 depend_files: [ JS_LIBRARY ], 204 depend_files: [ JS_LIBRARY ],
189 command: [ 205 command: [
190 emcc, '-o', output_file, 206 emcc, '-o', output_file,
191 '--post-js', bindings_output, 207 '--post-js', bindings_output,
192 '--js-library', JS_LIBRARY, 208 '--js-library', JS_LIBRARY,
193 '@INPUT@' 209 '@INPUT@'
194 ] + compiler_args + optional_args) 210 ] + compiler_args + optional_args)
195 else 211 else
212 compiler_args = ADDITIONAL_PARAMS + CORE_PARAMS
196 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest') 213 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest')
197 GTEST_PARAMS = [] 214 GTEST_PARAMS = []
198 compiler = meson.get_compiler('cpp') 215 compiler = meson.get_compiler('cpp')
199 if compiler.has_argument('-pthread') 216 if compiler.has_argument('-pthread')
200 GTEST_PARAMS += '-pthread' 217 GTEST_PARAMS += '-pthread'
201 LINK_PARAMS += '-lpthread' 218 LINK_PARAMS += '-lpthread'
202 endif 219 endif
203 220
204 test_sources = [ 221 test_sources = [
205 'test/compiled/abptest.cpp', 222 'test/compiled/abptest.cpp',
206 'test/compiled/String.cpp', 223 'test/compiled/String.cpp',
207 'test/compiled/StringMap.cpp', 224 'test/compiled/StringMap.cpp',
208 'test/compiled/RegExp.cpp', 225 'test/compiled/RegExp.cpp',
209 ] 226 ]
210 227
211 adblockpluscore = library('adblockpluscore', shared_sources, 228 adblockpluscore = static_library('adblockpluscore', shared_sources,
212 native_sources, 229 native_sources,
213 cpp_args: ADDITIONAL_PARAMS + CORE_PARAMS, 230 cpp_args: compiler_args,
214 link_args: LINK_PARAMS) 231 link_args: LINK_PARAMS,
232 pic: true)
215 gtest = static_library('gtest', files(join_paths(GTEST_DIR, 'src', 'gtest-all. cc')), 233 gtest = static_library('gtest', files(join_paths(GTEST_DIR, 'src', 'gtest-all. cc')),
216 include_directories: [ 234 include_directories: [
217 include_directories(join_paths(GTEST_DIR, 'include' ), is_system: true), 235 include_directories(join_paths(GTEST_DIR, 'include' ), is_system: true),
218 include_directories(GTEST_DIR) 236 include_directories(GTEST_DIR)
219 ], 237 ],
220 cpp_args: GTEST_PARAMS) 238 cpp_args: GTEST_PARAMS)
221 abptest = executable('abptest', test_sources, 239 abptest = executable('abptest', test_sources,
222 cpp_args: ADDITIONAL_PARAMS + CORE_PARAMS + ['-DINSIDE_TE STS'], 240 cpp_args: compiler_args + ['-DINSIDE_TESTS'],
223 include_directories: include_directories(join_paths(GTEST _DIR, 'include')), 241 include_directories: include_directories(join_paths(GTEST _DIR, 'include')),
224 link_args: LINK_PARAMS, 242 link_args: LINK_PARAMS,
225 link_with: [ adblockpluscore, gtest ]) 243 link_with: [ adblockpluscore, gtest ])
226 test('abptest', abptest) 244 test('abptest', abptest)
227 endif 245 endif
228 246
OLDNEW
« compiled/subscription/Subscription.cpp ('K') | « compiled/subscription/Subscription.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld