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

Side by Side Diff: meson.build

Issue 29527808: Noissue - Use meson to build the C++ code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: npm test now works Created Aug. 25, 2017, 7:47 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
« no previous file with comments | « lib/subscriptionClasses.js ('k') | meson_options.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 project('adblockpluscore', license: ['GPL3'])
2
3 emcc = find_program('emcc')
4 nodejs = find_program('node')
5
6 JS_LIBRARY = files('compiled/library.js')
7 BINDINGS_GENERATOR = 'bindings.cpp.js'
8 BINDINGS_OUTPUT = 'bindings.js'
9 COMPILER_OUTPUT = 'compiled.js'
10 # params for emcc compilation
11 ADDITIONAL_PARAMS = ['-O3', '-m32', '-std=c++1z', '--memory-init-file', '0',
12 '--emit-symbol-map', '-Wall', '-Werror', '-fno-exceptions',
13 '-fno-rtti', '--js-library', JS_LIBRARY]
14 DEFINES = []
15 GENERATION_PARAMS = [
16 ['SHELL_FILE', '"' + meson.source_root() + '/compiled/shell.js"'],
17 ['ASM_JS', '2'], # "almost asm"
18 ['TOTAL_MEMORY', 16*1024*1024],
19 ['TOTAL_STACK', 1*1024*1024],
20 ['ALLOW_MEMORY_GROWTH', 1],
21 ['NO_EXIT_RUNTIME', 1],
22 ['NO_DYNAMIC_EXECUTION', 1],
23 ['NO_FILESYSTEM', 1],
24 ['INVOKE_RUN', 0],
25 ['TEXTDECODER', 0],
26 ['EXPORTED_RUNTIME_METHODS', '["cwrap", "ccall", "stringToAscii"]']
27 ]
28
29 bindings_sources = files(
30 'compiled/bindings/generator.cpp',
31 'compiled/bindings/main.cpp',
32 )
33 sources = files(
34 'compiled/bindings/runtime_utils.cpp',
35 'compiled/filter/ActiveFilter.cpp',
36 'compiled/filter/BlockingFilter.cpp',
37 'compiled/filter/CommentFilter.cpp',
38 'compiled/filter/ElemHideBase.cpp',
39 'compiled/filter/ElemHideEmulationFilter.cpp',
40 'compiled/filter/ElemHideException.cpp',
41 'compiled/filter/ElemHideFilter.cpp',
42 'compiled/filter/Filter.cpp',
43 'compiled/filter/InvalidFilter.cpp',
44 'compiled/filter/RegExpFilter.cpp',
45 'compiled/filter/WhitelistFilter.cpp',
46 'compiled/subscription/DownloadableSubscription.cpp',
47 'compiled/subscription/Subscription.cpp',
48 'compiled/subscription/UserDefinedSubscription.cpp',
49 'compiled/traceInit.cpp'
50 )
51
52 bindings_generator = custom_target('bindings-generator',
53 input: bindings_sources + sources,
54 output: BINDINGS_GENERATOR,
55 command: [emcc, '-o', '@OUTPUT@',
56 '-std=c++1z', '--js-library', JS_LIBRARY,
57 '--js-library',
58 files('compiled/bindings/library.js'),
59 '@INPUT@'])
60 bindings_output = custom_target('bindings-output',
61 input: bindings_generator,
62 output: BINDINGS_OUTPUT,
63 capture: true,
64 command: [nodejs, '@INPUT@'])
65
66
67 defines_args = []
68 foreach define : DEFINES
69 defines_args += '-D' + define
70 endforeach
71
72 generation_args = []
73 foreach param : GENERATION_PARAMS
74 generation_args += '-s'
75 generation_args += param[0] + '=' + '@0@'.format(param[1])
76 endforeach
77
78 optional_args = []
79 debug = get_option('buildtype')
80 if debug.startswith('debug')
81 optional_args += '-g3'
82 endif
83 tracing = get_option('tracing')
84 if tracing
85 optional_args += '--tracing'
86 endif
87
88 compiler_output = custom_target('compiled.js',
89 build_by_default: true,
90 input: sources,
91 output: COMPILER_OUTPUT,
92 command: [emcc, '-o', '@OUTPUT@', '-std=c++1z',
93 '--post-js', bindings_output, '@INPUT@'] +
94 defines_args + generation_args + optional_args +
95 ADDITIONAL_PARAMS)
OLDNEW
« no previous file with comments | « lib/subscriptionClasses.js ('k') | meson_options.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld