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