-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
62 lines (51 loc) · 1.84 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(Tatami)
option(BUILD_TESTS "builds tests" ON)
find_package(PkgConfig)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Qml QuickControls2 Network WebSockets)
if (NOT DEFINED QI18N_LIBRARIES)
pkg_check_modules(QI18N REQUIRED Qt${QT_VERSION_MAJOR}I18n>=1.0.0)
endif()
if (NOT DEFINED METARECORDQT_LIBRARIES)
pkg_check_modules(METARECORDQT REQUIRED meta-record-qt${QT_VERSION_MAJOR}>=1.0.0)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
cmake_policy(SET CMP0071 NEW)
include_directories(tatami)
file(GLOB qml_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
imports/com/planed/tatami/*.qml
imports/com/planed/tatami/*.js
imports/com/planed/tatami/*.mjs
)
file(GLOB resource_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} fonts/*.ttf)
file(GLOB_RECURSE cpp_headers tatami/*.h)
file(GLOB_RECURSE cpp_sources tatami/*.cpp tatami_plugin.cpp)
file(GLOB tst_headers tatami/tests/*.h)
file(GLOB tst_sources tatami/tests/*.cpp)
list(FILTER cpp_headers EXCLUDE REGEX "tatami/tests/.*")
list(FILTER cpp_sources EXCLUDE REGEX "tatami/tests/.*")
link_libraries(
Qt${QT_MAJOR_VERSION}::Gui
Qt${QT_MAJOR_VERSION}::WebSockets
${QI18N_LIBRARIES}
${METARECORDQT_LIBRARIES}
)
qt_add_qml_module(Tatami
OUTPUT_DIRECTORY imports/com/planed/tatami
URI com.planed.tatami
VERSION 1.0
QML_FILES ${qml_files}
SOURCES tatami_plugin.h ${cpp_sources}
RESOURCES ${resource_files}
)
target_compile_definitions(Tatami PRIVATE TATAMI_LIBRARY)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
install(FILES tatami_plugin.h DESTINATION include)
install(FILES ${cpp_headers} DESTINATION include/tatami)
install(TARGETS Tatami LIBRARY DESTINATION lib)
install(TARGETS Tatamiplugin LIBRARY DESTINATION lib/tatami/plugins)