aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-12-07 12:22:15 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-12-07 12:22:15 +0200
commit92b3c2dcff3e85ad3d455f6ab845d9a97d3b525b (patch)
treea850643f7b86e6cebfddbeec98d7c372478d379c /plugins
parentHostlist filter plugin can rewrite hostnames (diff)
downloadsmolbote-92b3c2dcff3e85ad3d455f6ab845d9a97d3b525b.tar.xz
Rewrite meson build scripts into cmakelists
Diffstat (limited to 'plugins')
-rw-r--r--plugins/HostlistFilter/CMakeLists.txt33
-rw-r--r--plugins/HostlistFilter/meson.build43
-rw-r--r--plugins/HostlistFilter/smolblokHostlistPlugin.json (renamed from plugins/HostlistFilter/plugin/smolblokHostlistPlugin.json)0
3 files changed, 33 insertions, 43 deletions
diff --git a/plugins/HostlistFilter/CMakeLists.txt b/plugins/HostlistFilter/CMakeLists.txt
new file mode 100644
index 0000000..b477967
--- /dev/null
+++ b/plugins/HostlistFilter/CMakeLists.txt
@@ -0,0 +1,33 @@
+# interface
+add_library(hostlist INTERFACE)
+target_sources(hostlist INTERFACE filterlist.h filterlist.cpp)
+target_link_libraries(hostlist INTERFACE Qt5::WebEngine)
+target_include_directories(hostlist INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include)
+
+# plugin
+add_library(hostlistPlugin MODULE plugin/plugin.cpp)
+target_link_libraries(hostlistPlugin PRIVATE hostlist)
+
+# tests
+
+add_executable(hostlistRule_test test/rule.cpp)
+target_link_libraries(hostlistRule_test PRIVATE hostlist)
+target_sanitize(hostlistRule_test)
+add_test(NAME hostlist_rule COMMAND hostlistRule_test)
+
+add_executable(hostlistFilter_test test/filterlist.cpp)
+target_link_libraries(hostlistFilter_test PRIVATE hostlist)
+target_sanitize(hostlistFilter_test)
+add_test(NAME hostlist_filter COMMAND hostlistFilter_test)
+set_tests_properties(hostlist_filter PROPERTIES ENVIRONMENT "HOSTLIST_TXT=${CMAKE_CURRENT_SOURCE_DIR}/test/hostlist.txt")
+
+# plugin load test
+add_test(NAME hostlist_load COMMAND pluginloader_load $<TARGET_FILE:hostlistPlugin>)
+
+# fuzzer
+if(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
+ add_executable(hostlistFilter_fuzzer filterlist.cpp)
+ target_link_libraries(hostlistFilter_fuzzer PRIVATE hostlist)
+ target_compile_definitions(hostlistFilter_fuzzer PRIVATE FUZZER)
+ target_sanitize_fuzzer(hostlistFilter_fuzzer)
+endif()
diff --git a/plugins/HostlistFilter/meson.build b/plugins/HostlistFilter/meson.build
deleted file mode 100644
index 1562524..0000000
--- a/plugins/HostlistFilter/meson.build
+++ /dev/null
@@ -1,43 +0,0 @@
-dep_hostlistfilter = declare_dependency(
- include_directories: [ '.', smolbote_interfaces ],
- link_with: static_library('hostlistfilter', [ 'filterlist.cpp' ], include_directories: smolbote_interfaces, dependencies: [dep_qt5])
-)
-
-# plugin
-plugin = shared_library('smolblokHostlistPlugin',
- [ 'plugin/plugin.cpp', mod_qt5.preprocess(include_directories: smolbote_interfaces, moc_headers: 'plugin/plugin.h', dependencies: dep_qt5) ],
- include_directories: smolbote_interfaces,
- dependencies: [ dep_hostlistfilter, dep_qt5 ],
- install: true,
- install_dir: get_option('libdir')/'smolbote/plugins'
-)
-
-# tests
-test('rule', executable('rule', sources: 'test/rule.cpp', dependencies: [dep_qt5, dep_catch, dep_hostlistfilter]), suite: 'hostlist')
-
-test('filterlist', executable('filterlist',
- sources: 'test/filterlist.cpp',
- dependencies: [dep_qt5, dep_catch, dep_hostlistfilter]),
- env: 'HOSTLIST_TXT='+meson.current_source_dir()/'test/hostlist.txt',
- suite: 'hostlist'
-)
-test('plugin', executable('filterlist-plugin',
- sources: [ 'test/plugin.cpp', 'plugin/plugin.cpp',
- mod_qt5.preprocess(include_directories: smolbote_interfaces, moc_headers: 'plugin/plugin.h', dependencies: dep_qt5) ],
- dependencies: [dep_qt5, dep_catch, dep_hostlistfilter]),
- env: 'HOSTLIST_TXT='+meson.current_source_dir()/'test/hostlist.txt',
- suite: 'hostlist'
-)
-
-test('smolblok-load', smolblok_load, workdir: meson.build_root(), args: plugin.full_path(), suite: 'hostlist')
-
-# fuzzer
-if meson.get_compiler('cpp').has_multi_arguments('-g', '-fsanitize=fuzzer')
-executable('hostlist-fuzzer',
- sources: 'filterlist.cpp',
- include_directories: smolbote_interfaces,
- dependencies: dep_qt5,
- cpp_args: [ '-g', '-fsanitize=fuzzer', '-DFUZZER' ],
- link_args: [ '-fsanitize=fuzzer' ]
-)
-endif
diff --git a/plugins/HostlistFilter/plugin/smolblokHostlistPlugin.json b/plugins/HostlistFilter/smolblokHostlistPlugin.json
index aa53cdd..aa53cdd 100644
--- a/plugins/HostlistFilter/plugin/smolblokHostlistPlugin.json
+++ b/plugins/HostlistFilter/smolblokHostlistPlugin.json