-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
197 lines (169 loc) · 5.2 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
cmake_minimum_required (VERSION 2.6)
if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
# Ignore warnings about rpath behavior on OS X
cmake_policy(SET CMP0042 NEW)
endif()
project (nin10kit)
include(FindPkgConfig)
option(ENABLE_MAGICK7_SUPPORT "Support ImageMagick7 API instead of ImageMagick6" OFF)
option(ENABLE_NIN10EDIT "Enable nin10kit bitmap editor" OFF)
# Require C++17 build
if(NOT CMAKE_CXX_FLAGS MATCHES "-std=(c|gnu)\\+\\+17")
message(STATUS "This project requires C++17. Adding -std=c++17 to CXXFLAGS.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17" CACHE STRING "Flags used by the compiler during all build types." FORCE)
endif()
# Additional debug flags
set(CMAKE_CXX_FLAGS_DEBUG "-g -pg -fprofile-arcs -ftest-coverage --coverage")
# Install directories
set(CMAKE_INSTALL_LIBDIR lib CACHE STRING "where to install libraries/plugins")
set(CMAKE_INSTALL_BINDIR bin CACHE STRING "where to install programs")
# Set default warning flags
set(PROJECT_WARNING_FLAGS "-Wall -Wno-deprecated -Wno-deprecated-declarations" CACHE STRING "Compiler warning flags to include")
mark_as_advanced(PROJECT_WARNING_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROJECT_WARNING_FLAGS}")
# Default to release build if not specified
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif(NOT CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage")
endif(CMAKE_BUILD_TYPE MATCHES "Debug")
if(CMAKE_BUILD_TYPE MATCHES "Release")
set(CMAKE_EXE_LINKER_FLAGS "-s")
endif(CMAKE_BUILD_TYPE MATCHES "Release")
IF(ENABLE_MAGICK7_SUPPORT)
add_definitions(-DMAGICK7_SUPPORT)
add_definitions(-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16)
ELSE()
add_definitions(-DMAGICK6_SUPPORT)
add_definitions(-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16)
ENDIF(ENABLE_MAGICK7_SUPPORT)
find_package(wxWidgets REQUIRED core base)
include(${wxWidgets_USE_FILE})
if(APPLE)
message(STATUS "The platform appears to be macOS or windows, so using pkg-config to find ImageMagick.")
pkg_check_modules(ImageMagick Magick++ MagickWand MagickCore)
else()
find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore REQUIRED)
endif(APPLE)
include_directories(${nin10kit_SOURCE_DIR}/shared)
include_directories(${nin10kit_SOURCE_DIR}/gui/logging)
include_directories(${nin10kit_SOURCE_DIR}/gui/shared)
include_directories(${ImageMagick_INCLUDE_DIRS})
link_directories(${nin10kit_SOURCE_DIR}/shared)
set(CMAKE_SKIP_RPATH TRUE)
# Source files definition
set(SRC_SHARED
shared/3ds-exporter.cpp
shared/ds-exporter.cpp
shared/gba-exporter.cpp
shared/cmd-line-parser-helper.cpp
shared/color.cpp
shared/cpercep.cpp
shared/dither.cpp
shared/exportfile.cpp
shared/fileutils.cpp
shared/headerfile.cpp
shared/image.cpp
shared/image16.cpp
shared/image32.cpp
shared/image8.cpp
shared/implementationfile.cpp
shared/logger.cpp
shared/lut-exporter.cpp
shared/lutgen.cpp
shared/map.cpp
shared/magick_interface.cpp
shared/mediancut.cpp
shared/palette.cpp
shared/scanner.cpp
shared/scene.cpp
shared/shared.cpp
shared/sprite.cpp
shared/tile.cpp
shared/tileset.cpp
)
set(SRC_NIN10KIT
cli/main.cpp
)
set(SRC_NIN10KITGUI
gui/nin10kit.cpp
gui/nin10kitapp.cpp
gui/nin10kitgui.cpp
gui/nin10kitviewergui.cpp
gui/nin10kitviewer.cpp
#gui/tilemap/nin10kitmap.cpp
#gui/tilemap/nin10kitmapgui.cpp
#gui/tilemap/mapcanvas.cpp
#gui/tilemap/tilechooser.cpp
gui/exporter.cpp
gui/shared/colorutil.cpp
gui/shared/imageutil.cpp
gui/shared/nin10app.cpp
gui/logging/wxlogger.cpp
)
if (ENABLE_NIN10EDIT)
set(SRC_NIN10EDIT
gui/bitmap/nin10edit.cpp
gui/bitmap/nin10editgui.cpp
gui/bitmap/nin10editapp.cpp
gui/bitmap/color_chooser_gui.cpp
gui/bitmap/color_chooser_dialog.cpp
gui/bitmap/color_info_panel.cpp
gui/bitmap/palette_editor_panel.cpp
gui/bitmap/graphics_editor_panel.cpp
gui/exporter.cpp
gui/shared/colorutil.cpp
gui/shared/imageutil.cpp
gui/shared/nin10app.cpp
gui/logging/wxlogger.cpp
)
add_executable(
nin10edit
${SRC_NIN10EDIT}
)
target_link_libraries(
nin10edit
m
shared_files
${ImageMagick_LIBRARIES}
${wxWidgets_LIBRARIES}
)
endif(ENABLE_NIN10EDIT)
add_library(
shared_files
STATIC
${SRC_SHARED}
)
target_link_libraries(
shared_files
${ImageMagick_LIBRARIES}
)
add_executable(
nin10kit
${SRC_NIN10KIT}
)
target_link_libraries(
nin10kit
m
shared_files
${ImageMagick_LIBRARIES}
${wxWidgets_LIBRARIES}
)
add_executable(
nin10kitgui
${SRC_NIN10KITGUI}
)
target_link_libraries(
nin10kitgui
m
shared_files
${ImageMagick_LIBRARIES}
${wxWidgets_LIBRARIES}
)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nin10kit DESTINATION bin)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nin10kitgui DESTINATION bin)
install(FILES readme.pdf DESTINATION share/doc/nin10kit)