-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
128 lines (100 loc) · 3.1 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
cmake_minimum_required( VERSION 3.18.0 )
project(homm3-wallpaper
VERSION 0.1.0
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(QML_PLUGIN_NAME "homm3map")
find_package(Boost REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Qt5 COMPONENTS Core Gui Quick REQUIRED)
find_package(ECM 1.0.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(KF5 COMPONENTS Plasma REQUIRED)
option(VIEWER "Build HOMM3 map viewer application" true)
set(LIBRARY_SOURCES
data_maps.cpp
def_file.cpp
homm3_image_provider.cpp
homm3map.cpp
homm3singleton.cpp
lod_archive.cpp
random.cpp
texture_atlas.cpp
vcmi/CBinaryReader.cpp
vcmi/CCompressedStream.cpp
vcmi/CFileInputStream.cpp
vcmi/CMap.cpp
vcmi/MapFormatH3M.cpp
vcmi/ObjectTemplate.cpp
)
set(LIBRARY_HEADERS
data_maps.h
def_file.h
globals.h
homm3_image_provider.h
homm3map.h
homm3singleton.h
lod_archive.h
random.h
texture_atlas.h
vcmi/CBinaryReader.h
vcmi/CCompressedStream.h
vcmi/CFileInputStream.h
vcmi/CInputStream.h
vcmi/CGTownInstance.h
vcmi/CMap.h
vcmi/CMapDefines.h
vcmi/CObjectHandler.h
vcmi/CQuest.h
vcmi/CStream.h
vcmi/GameConstants.h
vcmi/MapFormatH3M.h
vcmi/ObjectTemplate.h
vcmi/int3.h
)
set(APP_SOURCES
main.cpp
)
set(APP_RESOURCES
qml.qrc
)
set(PLUGIN_SOURCES
plugin.cpp
)
set(PLUGIN_HEADERS
plugin.h
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIR})
qt_wrap_cpp(MOC_LIBRARY_HEADERS ${LIBRARY_HEADERS})
qt_wrap_cpp(MOC_PLUGIN_HEADERS ${PLUGIN_HEADERS})
add_library(homm3map STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} ${MOC_LIBRARY_HEADERS})
target_link_libraries(homm3map ZLIB::ZLIB Qt5::Core Qt5::Gui Qt5::Quick)
if (VIEWER)
qt_add_resources(COMPILED_APP_RESOURCES ${APP_RESOURCES})
add_executable(homm3map-viewer ${APP_SOURCES} ${COMPILED_APP_RESOURCES})
target_link_libraries(homm3map-viewer homm3map Qt5::Gui Qt5::Quick)
endif (VIEWER)
add_library(homm3mapplugin MODULE ${PLUGIN_SOURCES} ${PLUGIN_HEADERS} ${MOC_PLUGIN_HEADERS})
target_link_libraries(homm3mapplugin homm3map Qt5::Quick)
set_target_properties(homm3mapplugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/import/${QML_PLUGIN_NAME})
add_custom_target(copy_qmldir
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/import/${QML_PLUGIN_NAME}/qmldir
SOURCES qmldir
DEPENDS qmldir)
add_dependencies(homm3mapplugin copy_qmldir)
add_custom_target(wallpaper
SOURCES
wallpaper/contents/config/main.xml
wallpaper/contents/ui/config.qml
wallpaper/contents/ui/main.qml
wallpaper/metadata.desktop
)
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_QML OUTPUT_VARIABLE QT_INSTALL_QML OUTPUT_STRIP_TRAILING_WHITESPACE)
include(GNUInstallDirs)
if (VIEWER)
install(TARGETS homm3map-viewer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif (VIEWER)
install(TARGETS homm3mapplugin LIBRARY DESTINATION ${QT_INSTALL_QML}/${QML_PLUGIN_NAME})
install(FILES qmldir DESTINATION ${QT_INSTALL_QML}/${QML_PLUGIN_NAME})
plasma_install_package(wallpaper homm3mapwallpaper wallpapers wallpaper)