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

Side by Side Diff: meson.build

Issue 29537638: Issue 6226 - Use mesonbuild as a build system (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Handle arch properly. Created March 27, 2018, 2:02 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') | wrap_make » ('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('libadblockplus', 'cpp', default_options : ['cpp_std=c++14'], meson_vers ion: '>0.40.0')
2
3 V8_DIR=join_paths('third_party', 'v8')
4 V8_GYP=join_paths(meson.source_root(), 'third_party', 'gyp', 'gyp')
5
6 have_curl = dependency('curl', required: false)
7 incdir = include_directories('include', join_paths(V8_DIR, 'include'))
8
9 ensure_dependencies = run_target('ensure_dependencies',
10 command: ['python', 'ensure_dependencies.py'])
11
12 sources = files(
13 'include/AdblockPlus/ITimer.h',
14 'include/AdblockPlus/IWebRequest.h',
15 'include/AdblockPlus/IFileSystem.h',
16 'include/AdblockPlus/Scheduler.h',
17 'include/AdblockPlus/Platform.h',
18 'src/ActiveObject.cpp',
19 'src/AsyncExecutor.cpp',
20 'src/AppInfoJsObject.cpp',
21 'src/ConsoleJsObject.cpp',
22 'src/DefaultLogSystem.cpp',
23 'src/DefaultFileSystem.h',
24 'src/DefaultFileSystem.cpp',
25 'src/DefaultTimer.cpp',
26 'src/DefaultTimer.h',
27 'src/DefaultWebRequest.h',
28 'src/DefaultWebRequest.cpp',
29 'src/FileSystemJsObject.cpp',
30 'src/FilterEngine.cpp',
31 'src/GlobalJsObject.cpp',
32 'src/JsContext.cpp',
33 'src/JsEngine.cpp',
34 'src/JsError.cpp',
35 'src/JsValue.cpp',
36 'src/Notification.cpp',
37 'src/Platform.cpp',
38 'src/ReferrerMapping.cpp',
39 'src/Thread.cpp',
40 'src/Utils.cpp',
41 'src/WebRequestJsObject.cpp',
42 )
43
44 os = target_machine.system()
45 if os == 'windows'
46 sources += files('src/DefaultWebRequestWinInet.cpp')
47 elif have_curl.found()
48 sources += files('src/DefaultWebRequestCurl.cpp')
49 else
50 sources += files('src/DefaultWebRequestDummy.cpp')
51 endif
52 if os == 'darwin'
53 os = 'mac'
54 endif
55
56 target_arch = target_machine.cpu_family()
57 if target_arch == 'x86'
58 target_arch = 'ia32'
59 elif target_arch == 'x86_64'
60 target_arch = 'x64'
61 endif
62 # TODO figure out the arm64 case. It is not really documented.
63 # https://github.com/mesonbuild/meson/issues/1578
64
65 GYP_PARAMETERS=[ '-D', 'host_arch=' + target_arch,
66 '-D', 'OS=' + os,
67 '-D', 'target_arch=' + target_arch ]
68
69 build_v8 = custom_target('build_v8', input: files('build-v8.gypi',
70 join_paths(V8_DIR, 'src', 'v8.gyp')),
71 output: 'Makefile',
72 command: [ V8_GYP, GYP_PARAMETERS, '--depth=.', '-f',
73 'make', '-I', '@INPUT0@',
74 '--generator-output=v8', '@INPUT1@' ])
75
76 OUT_DIR=join_paths(meson.build_root(), 'v8', 'out', 'Debug')
77
78 WRAP_MAKE=join_paths(meson.source_root(), 'wrap_make')
79
80 v8_libplatform = custom_target('v8_libplatform',
81 input: [ build_v8 ],
82 output: [ 'libv8_libplatform.a', 'libv8_libbase.a', 'libv8_base.a' ],
83 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_libplatform' ])
84 v8_libsampler = custom_target('v8_libsampler',
85 input: [ build_v8 ], output: 'libv8_libsampler.a',
86 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_libsampler' ])
87 v8_snapshot = custom_target('v8_snapshot',
88 input: [ build_v8 ], output: 'libv8_snapshot.a',
89 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_snapshot' ])
90
91
92 library_files = files(
93 'lib/info.js',
94 'lib/io.js',
95 'lib/prefs.js',
96 'lib/utils.js',
97 'lib/elemHideHitRegistration.js',
98 'adblockpluscore/lib/events.js',
99 'adblockpluscore/lib/coreUtils.js',
100 'adblockpluscore/lib/filterNotifier.js',
101 'lib/init.js',
102 'adblockpluscore/lib/common.js',
103 'adblockpluscore/lib/filterClasses.js',
104 'adblockpluscore/lib/subscriptionClasses.js',
105 'adblockpluscore/lib/filterStorage.js',
106 'adblockpluscore/lib/elemHide.js',
107 'adblockpluscore/lib/elemHideEmulation.js',
108 'adblockpluscore/lib/matcher.js',
109 'adblockpluscore/lib/filterListener.js',
110 'adblockpluscore/lib/downloader.js',
111 'adblockpluscore/lib/notification.js',
112 'lib/notificationShowRegistration.js',
113 'adblockpluscore/lib/synchronizer.js',
114 'lib/filterUpdateRegistration.js',
115 'adblockpluscore/chrome/content/ui/subscriptions.xml',
116 'lib/updater.js'
117 )
118 load_before_files = files('lib/compat.js')
119 load_after_files = files(
120 'lib/api.js',
121 'lib/publicSuffixList.js',
122 'lib/punycode.js',
123 'lib/basedomain.js'
124 )
125
126 js_sources = custom_target('js_sources',
127 input: load_before_files + load_after_files + library_files,
128 output: 'adblockplus.js.cpp',
129 command: [ 'python', join_paths(meson.source_root(), 'convert_js.py'),
130 '@OUTPUT@',
131 '--before', load_before_files,
132 '--convert', library_files,
133 '--after', load_after_files ])
134
135 LIBRARIES = []
136 if os == 'windows'
137 LIBRARIES = [ 'shlwapi.lib', 'winhttp.lib', 'winmm.lib' ]
138 endif
139 adblockplus = shared_library('adblockplus', sources, js_sources,
140 v8_snapshot, v8_libsampler, v8_libplatform,
141 include_directories: incdir,
142 link_with: LIBRARIES,
143 dependencies: [ have_curl ])
144
145 test_sources = files(
146 'test/AsyncExecutor.cpp',
147 'test/BaseJsTest.h',
148 'test/BaseJsTest.cpp',
149 'test/AppInfoJsObject.cpp',
150 'test/ConsoleJsObject.cpp',
151 'test/DefaultFileSystem.cpp',
152 'test/FileSystemJsObject.cpp',
153 'test/FilterEngine.cpp',
154 'test/GlobalJsObject.cpp',
155 'test/JsEngine.cpp',
156 'test/JsValue.cpp',
157 'test/Notification.cpp',
158 'test/Prefs.cpp',
159 'test/ReferrerMapping.cpp',
160 'test/UpdateCheck.cpp',
161 'test/WebRequest.cpp',
162 'third_party/googletest/googletest/src/gtest_main.cc'
163 )
164
165 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest')
166 GTEST_PARAMS = []
167 LINK_PARAMS = []
168 compiler = meson.get_compiler('cpp')
169 if compiler.has_argument('-pthread')
170 GTEST_PARAMS += '-pthread'
171 LINK_PARAMS += '-lpthread'
172 endif
173
174 gtest = static_library('gtest',
175 files(join_paths(GTEST_DIR, 'src', 'gtest-all.cc')),
176 include_directories: [
177 include_directories(join_paths(GTEST_DIR, 'include'), is_system: true),
178 include_directories(GTEST_DIR)
179 ],
180 cpp_args: GTEST_PARAMS)
181
182 tests = executable('tests', test_sources,
183 link_with: [adblockplus, gtest],
184 link_args: LINK_PARAMS,
185 include_directories: [
186 incdir,
187 include_directories(join_paths(GTEST_DIR, 'include'))
188 ])
189
190 test('tests', tests)
OLDNEW
« no previous file with comments | « README.md ('k') | wrap_make » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld