-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
89 lines (72 loc) · 2.78 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
cmake_minimum_required(VERSION 3.9)
set(DisplayCompass_MAJOR_VER 1)
set(DisplayCompass_MINOR_VER 1)
set(DisplayCompass_PATCH_VER 0)
set(DisplayCompass_VER "${DisplayCompass_MAJOR_VER}.${DisplayCompass_MINOR_VER}.${DisplayCompass_PATCH_VER}")
project(DisplayCompass VERSION ${DisplayCompass_VER})
init_qt()
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
elseif(WIN32)
endif(UNIX)
find_package(Qt5 COMPONENTS Widgets Qml Quick REQUIRED)
set(DisplayCompass_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${DisplayCompass_INCLUDE_DIRS})
set(HEADERS
include/display_global.h
include/Animation.h
include/LibDisplayQml.h
include/AnimationDataObject.h
include/DisplayQmlInterface.h
)
set(SOURCES
src/Animation.cpp
src/LibDisplayQml.cpp
)
set(RESOURCES dc_qml.qrc dc_res.qrc)
set(Res3DFile "dc3d_res.rcc")
set(ResQml3DFile "dc3d_qml.rcc")
configure_file("./config.h.in" "./include/config.h" )
add_library(DisplayCompass SHARED
${SOURCES} ${HEADERS}
# ${RESOURCES}
)
set(DisplayCompass_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
SET_TARGET_PROPERTIES(DisplayCompass
PROPERTIES
VERSION ${DisplayCompass_VER} SOVERSION 0
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
target_compile_definitions(DisplayCompass PRIVATE DISPLAY_LIBRARY BUILD_WITH_CMAKE)
target_include_directories(DisplayCompass
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/DisplayCompass>
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include
)
target_link_libraries(DisplayCompass
PUBLIC
Qt5::Widgets Qt5::Qml Qt5::Quick
)
configure_file("res/libdisplayqml.json" "libdisplayqml.json" @ONLY)
install(FILES ${HEADERS} DESTINATION include/DisplayCompass)
install(FILES feature/libdisplayqml.prf DESTINATION include/feature)
set(packages "find_package(Qt5 COMPONENTS Widgets Qml Quick REQUIRED)")
export_targets(DisplayCompass ${DisplayCompass_VER})
OPTION(BUILD_EXAMPLE_DisplayCompass "BUILD EXAMPLES WITH DisplayCompass" ON)
if(BUILD_EXAMPLE_DisplayCompass)
add_subdirectory(examples/QMLDataTransfer)
add_dependencies(QMLDataTransfer DisplayCompass)
endif(BUILD_EXAMPLE_DisplayCompass)
qt5_add_binary_resources(DCRes3D "dc_res.qrc"
OPTIONS --compress 9
DESTINATION "${CMAKE_BINARY_DIR}/bin/${Res3DFile}")
qt5_add_binary_resources(DCRes3DQml "dc_qml.qrc"
OPTIONS --compress 9
DESTINATION "${CMAKE_BINARY_DIR}/bin/${ResQml3DFile}")
install(FILES "${CMAKE_BINARY_DIR}/bin/${Res3DFile}" DESTINATION bin)
install(FILES "${CMAKE_BINARY_DIR}/bin/${ResQml3DFile}" DESTINATION bin)