File: CMakeLists.txt

package info (click to toggle)
vcmi 1.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm
  • size: 14,672 kB
  • sloc: cpp: 181,738; sh: 220; python: 178; ansic: 69; objc: 66; xml: 59; makefile: 34
file content (143 lines) | stat: -rw-r--r-- 4,135 bytes parent folder | download
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
set(editor_SRCS
		StdInc.cpp
		main.cpp
		launcherdirs.cpp
		jsonutils.cpp
		mainwindow.cpp
		BitmapHandler.cpp
		maphandler.cpp
		Animation.cpp
		graphics.cpp
		windownewmap.cpp
		generatorprogress.cpp
		mapview.cpp
		objectbrowser.cpp
		mapsettings.cpp
		playersettings.cpp
		playerparams.cpp
		scenelayer.cpp
		mapcontroller.cpp
		validator.cpp
		inspector/inspector.cpp
		inspector/townbulidingswidget.cpp
		inspector/armywidget.cpp
		inspector/messagewidget.cpp
		inspector/rewardswidget.cpp
		inspector/questwidget.cpp
		resourceExtractor/ResourceConverter.cpp
)

set(editor_HEADERS
		StdInc.h
		launcherdirs.h
		jsonutils.h
		mainwindow.h
		BitmapHandler.h
		maphandler.h
		Animation.h
		graphics.h
		windownewmap.h
		generatorprogress.h
		mapview.h
		objectbrowser.h
		mapsettings.h
		playersettings.h
		playerparams.h
		scenelayer.h
		mapcontroller.h
		validator.h
		inspector/inspector.h
		inspector/townbulidingswidget.h
		inspector/armywidget.h
		inspector/messagewidget.h
		inspector/rewardswidget.h
		inspector/questwidget.h
		resourceExtractor/ResourceConverter.h
)

set(editor_FORMS
		mainwindow.ui
		windownewmap.ui
		generatorprogress.ui
		mapsettings.ui
		playersettings.ui
		playerparams.ui
		validator.ui
		inspector/townbulidingswidget.ui
		inspector/armywidget.ui
		inspector/messagewidget.ui
		inspector/rewardswidget.ui
		inspector/questwidget.ui
)

assign_source_group(${editor_SRCS} ${editor_HEADERS} mapeditor.rc)

# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)

if(POLICY CMP0071)
	cmake_policy(SET CMP0071 NEW)
endif()

# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)

if(TARGET Qt6::Core)
	qt_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
else()
	qt5_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
endif()

if(WIN32)
	set(editor_ICON mapeditor.rc)
endif()

add_executable(vcmieditor WIN32 ${editor_SRCS} ${editor_HEADERS} ${editor_UI_HEADERS} ${editor_ICON})

if(WIN32)
	set_target_properties(vcmieditor
		PROPERTIES
			OUTPUT_NAME "VCMI_mapeditor"
			PROJECT_LABEL "VCMI_mapeditor"
	)

	# FIXME: Can't to get CMP0020 working with Vcpkg and CMake 3.8.2
	# So far I tried:
	# - cmake_minimum_required set to 2.8.11 globally and in this file
	# - cmake_policy in all possible places
	# - used NO_POLICY_SCOPE to make sure no other parts reset policies
	# Still nothing worked, warning kept appearing and WinMain didn't link automatically
	target_link_libraries(vcmieditor Qt${QT_VERSION_MAJOR}::WinMain)
endif()

if(APPLE)
	# This makes Xcode project prettier by moving mapeditor_autogen directory into vcmiclient subfolder
	set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmieditor)
endif()

target_link_libraries(vcmieditor vcmi Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network)
target_include_directories(vcmieditor
	PUBLIC	${CMAKE_CURRENT_SOURCE_DIR}
)
vcmi_set_output_dir(vcmieditor "")
enable_pch(vcmieditor)

# Copy to build directory for easier debugging
add_custom_command(TARGET vcmieditor POST_BUILD
	COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
	COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/mapeditor/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
)

install(TARGETS vcmieditor DESTINATION ${BIN_DIR})
# copy whole directory
install(DIRECTORY icons DESTINATION ${DATA_DIR}/mapeditor)
# Install icons and desktop file on Linux
if(NOT WIN32 AND NOT APPLE)
	install(FILES "vcmieditor.desktop" DESTINATION share/applications)
	install(FILES "icons/mapeditor.32x32.png"   DESTINATION share/icons/hicolor/32x32/apps RENAME vcmieditor.png)
	install(FILES "icons/mapeditor.48x48.png"   DESTINATION share/icons/hicolor/48x48/apps RENAME vcmieditor.png)
	install(FILES "icons/mapeditor.64x64.png"   DESTINATION share/icons/hicolor/64x64/apps RENAME vcmieditor.png)
	install(FILES "icons/mapeditor.128x128.png" DESTINATION share/icons/hicolor/128x128/apps RENAME vcmieditor.png)
	install(FILES "icons/mapeditor.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmieditor.png)
endif()