OLD | NEW |
(Empty) | |
| 1 project('libadblockplus', 'cpp', default_options : ['cpp_std=c++14'], meson_vers
ion: '>0.40.0') |
| 2 |
| 3 V8_DIR='third_party/v8' |
| 4 V8_GYP=meson.source_root() + '/third_party/gyp/gyp' |
| 5 |
| 6 have_curl = dependency('curl', required: false) |
| 7 incdir = include_directories('include', 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 if have_curl.found() == 1 |
| 45 sources += files('src/DefaultWebRequestCurl.cpp') |
| 46 else |
| 47 sources += files('src/DefaultWebRequestDummy.cpp') |
| 48 endif |
| 49 |
| 50 os=target_machine.system() |
| 51 if os == 'darwin' |
| 52 os = 'mac' |
| 53 endif |
| 54 GYP_PARAMETERS=[ '-D', 'host_arch=x86_64', '-D', 'OS=' + os, |
| 55 '-D', 'target_arch=x86_64' ] |
| 56 |
| 57 build_v8 = custom_target('build_v8', input: files('build-v8.gypi', V8_DIR + '/sr
c/v8.gyp'), output: 'Makefile', |
| 58 command: [ V8_GYP, GYP_PARAMETERS, '--depth=.', '-f', 'make', '-I', '@INPUT0
@', '--generator-output=v8', '@INPUT1@' ]) |
| 59 |
| 60 OUT_DIR=join_paths(meson.build_root(), 'v8', 'out', 'Debug') |
| 61 |
| 62 WRAP_MAKE=join_paths(meson.source_root(), 'wrap_make') |
| 63 |
| 64 v8 = custom_target('v8', input: build_v8, |
| 65 output: [ 'libv8_base.a', 'libv8_libbase.a' ], |
| 66 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_base' ]) |
| 67 v8_libplatform = custom_target('v8_libplatform', |
| 68 input: [ build_v8, v8 ], output: 'libv8_libplatform.a', |
| 69 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_libplatform' ]) |
| 70 v8_libsampler = custom_target('v8_libsampler', |
| 71 input: [ build_v8, v8_libplatform ], output: 'libv8_libsampler.a', |
| 72 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_libsampler' ]) |
| 73 v8_snapshot = custom_target('v8_snapshot', |
| 74 input: [ build_v8, v8_libsampler ], output: 'libv8_snapshot.a', |
| 75 command: [ WRAP_MAKE, '@OUTPUT@', '-C', 'v8', 'v8_snapshot' ]) |
| 76 |
| 77 |
| 78 library_files = files( |
| 79 'lib/info.js', |
| 80 'lib/io.js', |
| 81 'lib/prefs.js', |
| 82 'lib/utils.js', |
| 83 'lib/elemHideHitRegistration.js', |
| 84 'adblockpluscore/lib/events.js', |
| 85 'adblockpluscore/lib/coreUtils.js', |
| 86 'adblockpluscore/lib/filterNotifier.js', |
| 87 'lib/init.js', |
| 88 'adblockpluscore/lib/common.js', |
| 89 'adblockpluscore/lib/filterClasses.js', |
| 90 'adblockpluscore/lib/subscriptionClasses.js', |
| 91 'adblockpluscore/lib/filterStorage.js', |
| 92 'adblockpluscore/lib/elemHide.js', |
| 93 'adblockpluscore/lib/elemHideEmulation.js', |
| 94 'adblockpluscore/lib/matcher.js', |
| 95 'adblockpluscore/lib/filterListener.js', |
| 96 'adblockpluscore/lib/downloader.js', |
| 97 'adblockpluscore/lib/notification.js', |
| 98 'lib/notificationShowRegistration.js', |
| 99 'adblockpluscore/lib/synchronizer.js', |
| 100 'lib/filterUpdateRegistration.js', |
| 101 'adblockpluscore/chrome/content/ui/subscriptions.xml', |
| 102 'lib/updater.js' |
| 103 ) |
| 104 load_before_files = files('lib/compat.js') |
| 105 load_after_files = files( |
| 106 'lib/api.js', |
| 107 'lib/publicSuffixList.js', |
| 108 'lib/punycode.js', |
| 109 'lib/basedomain.js' |
| 110 ) |
| 111 |
| 112 js_sources = custom_target('js_sources', |
| 113 input: load_before_files + load_after_files + library_files, |
| 114 output: 'adblockplus.js.cpp', |
| 115 command: [ 'python', join_paths(meson.source_root(), 'convert_js.py'), |
| 116 '@OUTPUT@', |
| 117 '--before', load_before_files, |
| 118 '--convert', library_files, |
| 119 '--after', load_after_files ]) |
| 120 |
| 121 adblockplus = shared_library('adblockplus', sources, js_sources, |
| 122 v8, v8_libplatform, |
| 123 v8_libsampler, v8_snapshot, |
| 124 include_directories: incdir, |
| 125 dependencies: [ have_curl ]) |
| 126 |
| 127 test_sources = files( |
| 128 'test/AsyncExecutor.cpp', |
| 129 'test/BaseJsTest.h', |
| 130 'test/BaseJsTest.cpp', |
| 131 'test/AppInfoJsObject.cpp', |
| 132 'test/ConsoleJsObject.cpp', |
| 133 'test/DefaultFileSystem.cpp', |
| 134 'test/FileSystemJsObject.cpp', |
| 135 'test/FilterEngine.cpp', |
| 136 'test/GlobalJsObject.cpp', |
| 137 'test/JsEngine.cpp', |
| 138 'test/JsValue.cpp', |
| 139 'test/Notification.cpp', |
| 140 'test/Prefs.cpp', |
| 141 'test/ReferrerMapping.cpp', |
| 142 'test/UpdateCheck.cpp', |
| 143 'test/WebRequest.cpp', |
| 144 'third_party/googletest/googletest/src/gtest_main.cc' |
| 145 ) |
| 146 |
| 147 GTEST_DIR = join_paths('third_party', 'googletest', 'googletest') |
| 148 GTEST_PARAMS = [] |
| 149 LINK_PARAMS = [] |
| 150 compiler = meson.get_compiler('cpp') |
| 151 if compiler.has_argument('-pthread') |
| 152 GTEST_PARAMS += '-pthread' |
| 153 LINK_PARAMS += '-lpthread' |
| 154 endif |
| 155 |
| 156 gtest = static_library('gtest', |
| 157 files(join_paths(GTEST_DIR, 'src', 'gtest-all.cc')), |
| 158 include_directories: [ |
| 159 include_directories(join_paths(GTEST_DIR, 'include'),
is_system: true), |
| 160 include_directories(GTEST_DIR) |
| 161 ], |
| 162 cpp_args: GTEST_PARAMS) |
| 163 |
| 164 tests = executable('tests', test_sources, |
| 165 link_with: [adblockplus, gtest], |
| 166 link_args: LINK_PARAMS, |
| 167 include_directories: [ |
| 168 incdir, |
| 169 include_directories(join_paths(GTEST_DIR, 'include')) |
| 170 ]) |
| 171 |
| 172 test('tests', tests) |
OLD | NEW |