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: Rebased. Now compile output to the source directory Created Aug. 31, 2017, 2:28 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 | « README.md ('k') | meson_options.txt » ('j') | meson_options.txt » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 project('adblockpluscore', license: ['GPL3'])
Wladimir Palant 2017/10/11 10:00:47 Meson 0.39.1 (what you currently get on Ubuntu) co
hub 2017/10/11 18:23:16 Done.
2
3 emcc = find_program('emcc')
4 nodejs = find_program('node')
Wladimir Palant 2017/10/11 10:00:47 I tried reading Emscripten configuration and the f
hub 2017/10/11 18:23:17 Done.
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/storage/FilterStorage.cpp',
47 'compiled/subscription/DownloadableSubscription.cpp',
48 'compiled/subscription/Subscription.cpp',
49 'compiled/subscription/UserDefinedSubscription.cpp',
50 'compiled/traceInit.cpp'
51 )
52
53 bindings_generator = custom_target('bindings-generator',
54 input: bindings_sources + sources,
55 output: BINDINGS_GENERATOR,
56 command: [emcc, '-o', '@OUTPUT@',
57 '-std=c++1z', '--js-library', JS_LIBRARY,
58 '--js-library',
59 files('compiled/bindings/library.js'),
60 '@INPUT@'])
61 bindings_output = custom_target('bindings-output',
62 input: bindings_generator,
63 output: BINDINGS_OUTPUT,
64 capture: true,
65 command: [nodejs, '@INPUT@'])
66
67
68 defines_args = []
69 foreach define : DEFINES
70 defines_args += '-D' + define
71 endforeach
72
73 generation_args = []
74 foreach param : GENERATION_PARAMS
75 generation_args += '-s'
76 generation_args += param[0] + '=' + '@0@'.format(param[1])
Wladimir Palant 2017/10/11 10:00:47 Nit: You should really unify leading whitespace in
hub 2017/10/11 18:23:16 Done.
77 endforeach
78
79 optional_args = []
80 debug = get_option('buildtype')
81 if debug.startswith('debug')
82 optional_args += '-g3'
83 endif
84 tracing = get_option('tracing')
85 if tracing
86 optional_args += '--tracing'
87 endif
88
89 output_file = meson.source_root() + '/lib/' + COMPILER_OUTPUT
90 compiler_output = custom_target('compiled.js',
91 build_by_default: true,
92 input: sources,
93 output: COMPILER_OUTPUT,
Wladimir Palant 2017/10/11 10:00:47 I'd consider that a temporary hack. It's probably
hub 2017/10/11 18:23:17 Acknowledged.
94 command: [emcc, '-o', output_file, '-std=c++1z',
Wladimir Palant 2017/10/11 10:00:47 -std=c++1z parameter is unnecessary here, it is al
hub 2017/10/11 18:23:16 Done.
95 '--post-js', bindings_output, '@INPUT@'] +
96 defines_args + generation_args + optional_args +
97 ADDITIONAL_PARAMS)
Wladimir Palant 2017/10/11 10:00:47 Object files should really be generated as separat
hub 2017/10/11 18:23:16 I wanted to use the c++ targets, but meson doesn't
Wladimir Palant 2017/10/11 21:01:23 That's too bad. It would have been much nicer if w
OLDNEW
« no previous file with comments | « README.md ('k') | meson_options.txt » ('j') | meson_options.txt » ('J')

Powered by Google App Engine
This is Rietveld