| Index: meson.build |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/meson.build |
| @@ -0,0 +1,190 @@ |
| +project('libadblockplus', 'cpp', default_options : ['cpp_std=c++14'], meson_version: '>0.40.0') |
| + |
| +V8_DIR=join_paths('third_party', 'v8') |
| +V8_GYP=join_paths(meson.source_root(), 'third_party', 'gyp', 'gyp') |
| + |
| +have_curl = dependency('curl', required: false) |
| +incdir = include_directories('include', join_paths(V8_DIR, 'include')) |
| + |
| +ensure_dependencies = run_target('ensure_dependencies', |
| + command: ['python', 'ensure_dependencies.py']) |
| + |
| +sources = files( |
| + 'include/AdblockPlus/ITimer.h', |
| + 'include/AdblockPlus/IWebRequest.h', |
| + 'include/AdblockPlus/IFileSystem.h', |
| + 'include/AdblockPlus/Scheduler.h', |
| + 'include/AdblockPlus/Platform.h', |
| + 'src/ActiveObject.cpp', |
| + 'src/AsyncExecutor.cpp', |
| + 'src/AppInfoJsObject.cpp', |
| + 'src/ConsoleJsObject.cpp', |
| + 'src/DefaultLogSystem.cpp', |
| + 'src/DefaultFileSystem.h', |
| + 'src/DefaultFileSystem.cpp', |
| + 'src/DefaultTimer.cpp', |
| + 'src/DefaultTimer.h', |
| + 'src/DefaultWebRequest.h', |
| + 'src/DefaultWebRequest.cpp', |
| + 'src/FileSystemJsObject.cpp', |
| + 'src/FilterEngine.cpp', |
| + 'src/GlobalJsObject.cpp', |
| + 'src/JsContext.cpp', |
| + 'src/JsEngine.cpp', |
| + 'src/JsError.cpp', |
| + 'src/JsValue.cpp', |
| + 'src/Notification.cpp', |
| + 'src/Platform.cpp', |
| + 'src/ReferrerMapping.cpp', |
| + 'src/Thread.cpp', |
| + 'src/Utils.cpp', |
| + 'src/WebRequestJsObject.cpp', |
| +) |
| + |
| +os = target_machine.system() |
| +if os == 'windows' |
| + sources += files('src/DefaultWebRequestWinInet.cpp') |
| +elif have_curl.found() |
| + sources += files('src/DefaultWebRequestCurl.cpp') |
| +else |
| + sources += files('src/DefaultWebRequestDummy.cpp') |
| +endif |
| +if os == 'darwin' |
| + os = 'mac' |
| +endif |
| + |
| +target_arch = target_machine.cpu_family() |
| +if target_arch == 'x86' |
| + target_arch = 'ia32' |
| +elif target_arch == 'x86_64' |
| + target_arch = 'x64' |
| +endif |
| +# TODO figure out the arm64 case. It is not really documented. |
| +# https://github.com/mesonbuild/meson/issues/1578 |
| + |
| +GYP_PARAMETERS=[ '-D', 'host_arch=' + target_arch, |
| + '-D', 'OS=' + os, |
| + '-D', 'target_arch=' + target_arch ] |
| + |
| +build_v8 = custom_target('build_v8', input: files('build-v8.gypi', |
| + join_paths(V8_DIR, 'src', 'v8.gyp')), |
| + output: 'Makefile', |
| + command: [ V8_GYP, GYP_PARAMETERS, '--depth=.', '-f', |
| + 'make', '-I', '@INPUT0@', |
| + '--generator-output=v8', '@INPUT1@' ]) |
| + |
| +OUT_DIR=join_paths(meson.build_root(), 'v8', 'out', 'Debug') |
| + |
| +WRAP_MAKE=join_paths(meson.source_root(), 'wrap_make') |
| + |
| +v8_libplatform = custom_target('v8_libplatform', |
| + input: [ build_v8 ], |
| + output: [ 'libv8_libplatform.a', 'libv8_libbase.a', 'libv8_base.a' ], |
| + command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_libplatform' ]) |
| +v8_libsampler = custom_target('v8_libsampler', |
| + input: [ build_v8 ], output: 'libv8_libsampler.a', |
| + command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_libsampler' ]) |
| +v8_snapshot = custom_target('v8_snapshot', |
| + input: [ build_v8 ], output: 'libv8_snapshot.a', |
| + command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_snapshot' ]) |
| + |
| + |
| +library_files = files( |
| + 'lib/info.js', |
| + 'lib/io.js', |
| + 'lib/prefs.js', |
| + 'lib/utils.js', |
| + 'lib/elemHideHitRegistration.js', |
| + 'adblockpluscore/lib/events.js', |
| + 'adblockpluscore/lib/coreUtils.js', |
| + 'adblockpluscore/lib/filterNotifier.js', |
| + 'lib/init.js', |
| + 'adblockpluscore/lib/common.js', |
| + 'adblockpluscore/lib/filterClasses.js', |
| + 'adblockpluscore/lib/subscriptionClasses.js', |
| + 'adblockpluscore/lib/filterStorage.js', |
| + 'adblockpluscore/lib/elemHide.js', |
| + 'adblockpluscore/lib/elemHideEmulation.js', |
| + 'adblockpluscore/lib/matcher.js', |
| + 'adblockpluscore/lib/filterListener.js', |
| + 'adblockpluscore/lib/downloader.js', |
| + 'adblockpluscore/lib/notification.js', |
| + 'lib/notificationShowRegistration.js', |
| + 'adblockpluscore/lib/synchronizer.js', |
| + 'lib/filterUpdateRegistration.js', |
| + 'adblockpluscore/chrome/content/ui/subscriptions.xml', |
| + 'lib/updater.js' |
| +) |
| +load_before_files = files('lib/compat.js') |
| +load_after_files = files( |
| + 'lib/api.js', |
| + 'lib/publicSuffixList.js', |
| + 'lib/punycode.js', |
| + 'lib/basedomain.js' |
| +) |
| + |
| +js_sources = custom_target('js_sources', |
| + input: load_before_files + load_after_files + library_files, |
| + output: 'adblockplus.js.cpp', |
| + command: [ 'python', join_paths(meson.source_root(), 'convert_js.py'), |
| + '@OUTPUT@', |
| + '--before', load_before_files, |
| + '--convert', library_files, |
| + '--after', load_after_files ]) |
| + |
| +LIBRARIES = [] |
| +if os == 'windows' |
| + LIBRARIES = [ 'shlwapi.lib', 'winhttp.lib', 'winmm.lib' ] |
| +endif |
| +adblockplus = shared_library('adblockplus', sources, js_sources, |
| + v8_snapshot, v8_libsampler, v8_libplatform, |
| + include_directories: incdir, |
| + link_with: LIBRARIES, |
| + dependencies: [ have_curl ]) |
| + |
| +test_sources = files( |
| + 'test/AsyncExecutor.cpp', |
| + 'test/BaseJsTest.h', |
| + 'test/BaseJsTest.cpp', |
| + 'test/AppInfoJsObject.cpp', |
| + 'test/ConsoleJsObject.cpp', |
| + 'test/DefaultFileSystem.cpp', |
| + 'test/FileSystemJsObject.cpp', |
| + 'test/FilterEngine.cpp', |
| + 'test/GlobalJsObject.cpp', |
| + 'test/JsEngine.cpp', |
| + 'test/JsValue.cpp', |
| + 'test/Notification.cpp', |
| + 'test/Prefs.cpp', |
| + 'test/ReferrerMapping.cpp', |
| + 'test/UpdateCheck.cpp', |
| + 'test/WebRequest.cpp', |
| + 'third_party/googletest/googletest/src/gtest_main.cc' |
| +) |
| + |
| +GTEST_DIR = join_paths('third_party', 'googletest', 'googletest') |
| +GTEST_PARAMS = [] |
| +LINK_PARAMS = [] |
| +compiler = meson.get_compiler('cpp') |
| +if compiler.has_argument('-pthread') |
| + GTEST_PARAMS += '-pthread' |
| + LINK_PARAMS += '-lpthread' |
| +endif |
| + |
| +gtest = static_library('gtest', |
| + files(join_paths(GTEST_DIR, 'src', 'gtest-all.cc')), |
| + include_directories: [ |
| + include_directories(join_paths(GTEST_DIR, 'include'), is_system: true), |
| + include_directories(GTEST_DIR) |
| + ], |
| + cpp_args: GTEST_PARAMS) |
| + |
| +tests = executable('tests', test_sources, |
| + link_with: [adblockplus, gtest], |
| + link_args: LINK_PARAMS, |
| + include_directories: [ |
| + incdir, |
| + include_directories(join_paths(GTEST_DIR, 'include')) |
| + ]) |
| + |
| +test('tests', tests) |