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: Fix more build issues, cross compile. Created March 27, 2018, 8:55 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 HOST_ARCH=run_command('python',
6 join_paths('third_party',
7 'detect_v8_host_arch.py')).stdout().strip()
8
9 have_curl = dependency('curl', required: false)
10 incdir = include_directories('include', join_paths(V8_DIR, 'include'))
11
12 ensure_dependencies = run_target('ensure_dependencies',
13 command: ['python', 'ensure_dependencies.py'])
14
15 sources = files(
16 'include/AdblockPlus/ITimer.h',
17 'include/AdblockPlus/IWebRequest.h',
18 'include/AdblockPlus/IFileSystem.h',
19 'include/AdblockPlus/Scheduler.h',
20 'include/AdblockPlus/Platform.h',
21 'src/ActiveObject.cpp',
22 'src/AsyncExecutor.cpp',
23 'src/AppInfoJsObject.cpp',
24 'src/ConsoleJsObject.cpp',
25 'src/DefaultLogSystem.cpp',
26 'src/DefaultFileSystem.h',
27 'src/DefaultFileSystem.cpp',
28 'src/DefaultTimer.cpp',
29 'src/DefaultTimer.h',
30 'src/DefaultWebRequest.h',
31 'src/DefaultWebRequest.cpp',
32 'src/FileSystemJsObject.cpp',
33 'src/FilterEngine.cpp',
34 'src/GlobalJsObject.cpp',
35 'src/JsContext.cpp',
36 'src/JsEngine.cpp',
37 'src/JsError.cpp',
38 'src/JsValue.cpp',
39 'src/Notification.cpp',
40 'src/Platform.cpp',
41 'src/ReferrerMapping.cpp',
42 'src/Thread.cpp',
43 'src/Utils.cpp',
44 'src/WebRequestJsObject.cpp',
45 )
46
47 target_os = target_machine.system()
48 if target_os == 'windows'
49 sources += files('src/DefaultWebRequestWinInet.cpp')
50 elif have_curl.found()
51 sources += files('src/DefaultWebRequestCurl.cpp')
52 else
53 sources += files('src/DefaultWebRequestDummy.cpp')
54 endif
55 if target_os == 'darwin'
56 target_os = 'mac'
57 endif
58
59 target_arch = target_machine.cpu_family()
60 if target_arch == 'x86'
61 target_arch = 'ia32'
62 elif target_arch == 'x86_64'
63 target_arch = 'x64'
64 elif target_arch == 'aarch64'
65 target_arch = 'arm64'
66 endif
67
68 GYP_PARAMETERS=[ '-D', 'host_arch=' + HOST_ARCH,
69 '-D', 'OS=' + target_os,
70 '-D', 'target_arch=' + target_arch ]
71
72 build_v8 = custom_target('build_v8', input: files('build-v8.gypi',
73 join_paths(V8_DIR, 'src', 'v8.gyp')),
74 output: 'Makefile',
75 command: [ V8_GYP, GYP_PARAMETERS, '--depth=.', '-f',
76 'make', '-I', '@INPUT0@',
77 '--generator-output=v8', '@INPUT1@' ])
78
79 buildtype = get_option('buildtype')
80 if buildtype.startswith('debug')
81 BUILD_CONFIG_DIR='Debug'
82 BUILD_FLAVOUR='BUILDTYPE=Debug'
83 else
84 BUILD_CONFIG_DIR='Release'
85 BUILD_FLAVOUR='BUILDTYPE=Release'
86 endif
87 OUT_DIR=join_paths(meson.build_root(), 'v8', 'out', BUILD_CONFIG_DIR)
88
89 WRAP_MAKE=join_paths(meson.source_root(), 'wrap_make')
90
91 if target_os == 'windows'
92 PLATFORM_LIBRARIES = [ 'v8_libplatform.lib', 'v8_libbase.lib',
93 'v8_base_0.lib', 'v8_base_1.lib',
94 'v8_base_2.lib', 'v8_base_3.lib' ]
95 SAMPLER_LIBRARIES = 'v8_libsampler.lib'
96 SNAPSHOT_LIBRARIES = 'v8_snapshot.lib'
97 else
98 PLATFORM_LIBRARIES = [ 'libv8_libplatform.a' ]
99 SAMPLER_LIBRARIES = [ 'libv8_libsampler.a' ]
100 SNAPSHOT_LIBRARIES = [ 'libv8_snapshot.a', 'libv8_libbase.a',
101 'libv8_base.a' ]
102 endif
103 v8_libplatform = custom_target('v8_libplatform',
104 input: [ build_v8 ],
105 output: PLATFORM_LIBRARIES,
106 command: [ WRAP_MAKE, '@OUTPUT@', '-D', OUT_DIR,
107 '-C', 'v8', 'v8_libplatform', BUILD_FLAVOUR ])
108 v8_libsampler = custom_target('v8_libsampler',
109 input: [ build_v8 ], output: SAMPLER_LIBRARIES,
110 command: [ WRAP_MAKE, '@OUTPUT@', '-D', OUT_DIR,
111 '-C', 'v8', 'v8_libsampler', BUILD_FLAVOUR ])
112 v8_snapshot = custom_target('v8_snapshot',
113 input: [ build_v8 ], output: SNAPSHOT_LIBRARIES,
114 command: [ WRAP_MAKE, '@OUTPUT@', '-D', OUT_DIR,
115 '-C', 'v8', 'v8_snapshot', BUILD_FLAVOUR ])
116
117
118 library_files = files(
119 'lib/info.js',
120 'lib/io.js',
121 'lib/prefs.js',
122 'lib/utils.js',
123 'lib/elemHideHitRegistration.js',
124 'adblockpluscore/lib/events.js',
125 'adblockpluscore/lib/coreUtils.js',
126 'adblockpluscore/lib/filterNotifier.js',
127 'lib/init.js',
128 'adblockpluscore/lib/common.js',
129 'adblockpluscore/lib/filterClasses.js',
130 'adblockpluscore/lib/subscriptionClasses.js',
131 'adblockpluscore/lib/filterStorage.js',
132 'adblockpluscore/lib/elemHide.js',
133 'adblockpluscore/lib/elemHideEmulation.js',
134 'adblockpluscore/lib/matcher.js',
135 'adblockpluscore/lib/filterListener.js',
136 'adblockpluscore/lib/downloader.js',
137 'adblockpluscore/lib/notification.js',
138 'lib/notificationShowRegistration.js',
139 'adblockpluscore/lib/synchronizer.js',
140 'lib/filterUpdateRegistration.js',
141 'adblockpluscore/chrome/content/ui/subscriptions.xml',
142 'lib/updater.js'
143 )
144 load_before_files = files('lib/compat.js')
145 load_after_files = files(
146 'lib/api.js',
147 'lib/publicSuffixList.js',
148 'lib/punycode.js',
149 'lib/basedomain.js'
150 )
151
152 js_sources = custom_target('js_sources',
153 input: load_before_files + load_after_files + library_files,
154 output: 'adblockplus.js.cpp',
155 command: [ 'python', join_paths(meson.source_root(), 'convert_js.py'),
156 '@OUTPUT@',
157 '--before', load_before_files,
158 '--convert', library_files,
159 '--after', load_after_files ])
160
161 LIBRARIES = []
162 if target_os == 'windows'
163 LIBRARIES = [ 'shlwapi.lib', 'winhttp.lib', 'winmm.lib' ]
164 endif
165 adblockplus = shared_library('adblockplus', sources, js_sources,
166 v8_snapshot, v8_libsampler, v8_libplatform,
167 include_directories: incdir,
168 link_with: LIBRARIES,
169 dependencies: [ have_curl ])
170
171 test_sources = files(
172 'test/AsyncExecutor.cpp',
173 'test/BaseJsTest.h',
174 'test/BaseJsTest.cpp',
175 'test/AppInfoJsObject.cpp',
176 'test/ConsoleJsObject.cpp',
177 'test/DefaultFileSystem.cpp',
178 'test/FileSystemJsObject.cpp',
179 'test/FilterEngine.cpp',
180 'test/GlobalJsObject.cpp',
181 'test/JsEngine.cpp',
182 'test/JsValue.cpp',
183 'test/Notification.cpp',
184 'test/Prefs.cpp',
185 'test/ReferrerMapping.cpp',
186 'test/UpdateCheck.cpp',
187 'test/WebRequest.cpp',
188 'third_party/googletest/googletest/src/gtest_main.cc'
189 )
190
191 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest')
192 GTEST_PARAMS = []
193 LINK_PARAMS = []
194 compiler = meson.get_compiler('cpp')
195 if compiler.has_argument('-pthread')
196 GTEST_PARAMS += '-pthread'
197 LINK_PARAMS += '-lpthread'
198 endif
199
200 gtest = static_library('gtest',
201 files(join_paths(GTEST_DIR, 'src', 'gtest-all.cc')),
202 include_directories: [
203 include_directories(join_paths(GTEST_DIR, 'include'), is_system: true),
204 include_directories(GTEST_DIR)
205 ],
206 cpp_args: GTEST_PARAMS)
207
208 tests = executable('tests', test_sources,
209 link_with: [adblockplus, gtest],
210 link_args: LINK_PARAMS,
211 include_directories: [
212 incdir,
213 include_directories(join_paths(GTEST_DIR, 'include'))
214 ])
215
216 # Adjust the timeout to run the test. Default value is 30sec.
217 #
218 test('tests', tests, timeout: 60)
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