This repository has been archived by the owner on Dec 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
CMakeLists.txt
167 lines (152 loc) · 4.48 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
#
# Set up project
#
cmake_minimum_required(VERSION 2.6)
project(nodeboxeditor)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
#
# Configuration
#
set(NBE_MAJOR_VERSION 0)
set(NBE_MINOR_VERSION 9)
set(NBE_PATCH_VERSION 0)
set(NBE_LABEL_VERSION "Obsidian Glass")
option(DEBUG "Debug mode" 0)
if(DEBUG)
message("-- Is debug")
set(IS_DEBUG true)
endif(DEBUG)
configure_file(
"${PROJECT_SOURCE_DIR}/src/conf_cmake.hpp.in"
"${PROJECT_BINARY_DIR}/conf_cmake.hpp"
)
#
# Source files
#
set(NBE_SRC
src/main.cpp
src/Configuration.cpp
src/GUIHelpers.cpp
src/EditorState.cpp
src/MenuState.cpp
src/Editor.cpp
src/minetest.cpp
src/project/project.cpp
src/project/media.cpp
src/project/node.cpp
src/project/nodebox.cpp
src/modes/NBEditor.cpp
src/modes/NodeEditor.cpp
src/modes/TextureEditor.cpp
src/dialogs/FileDialog.cpp
src/dialogs/TextureDialog.cpp
src/dialogs/ImageDialog.cpp
src/FileFormat/FileFormat.cpp
src/FileFormat/helpers.cpp
src/FileFormat/NBE.cpp
src/FileFormat/Lua.cpp
src/FileFormat/CPP.cpp
src/FileFormat/obj.cpp
src/util/string.cpp
src/util/filesys.cpp
src/util/SimpleFileCombiner.cpp
src/util/tinyfiledialogs.c
)
add_executable(${PROJECT_NAME} ${NBE_SRC})
#
# Dependencies
#
find_package(Irrlicht REQUIRED)
if(WIN32)
# Windows
if(MSVC) # MSVC Specifics
set(PLATFORM_LIBS dbghelp.lib ${PLATFORM_LIBS})
# Surpress some useless warnings
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
else() # Probably MinGW = GCC
set(PLATFORM_LIBS "")
endif()
set(PLATFORM_LIBS ws2_32.lib shlwapi.lib ${PLATFORM_LIBS})
# Zlib stuff
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
CACHE PATH "Zlib include directory")
set(ZLIB_LIBRARIES "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.lib"
CACHE FILEPATH "Path to zlibwapi.lib")
set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll"
CACHE FILEPATH "Path to zlibwapi.dll (for installation)")
else(WIN32)
find_package(ZLIB REQUIRED)
endif(WIN32)
find_package(X11 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(JPEG REQUIRED)
find_package(BZip2 REQUIRED)
find_package(PNG REQUIRED)
include_directories(
${PROJECT_BINARY_DIR}
${IRRLICHT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${CMAKE_BUILD_TYPE}
${X11_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
)
set(TLL
${IRRLICHT_LIBRARY}
${ZLIB_LIBRARIES}
${X11_LIBRARIES}
${OPENGL_LIBRARIES}
${JPEG_LIBRARIES}
${BZIP2_LIBRARIES}
${PNG_LIBRARIES}
)
if(UNIX)
find_library(XXF86VM_LIBRARY Xxf86vm)
target_link_libraries(
${PROJECT_NAME}
${TLL}
${XXF86VM_LIBRARY}
)
else()
target_link_libraries(
${PROJECT_NAME}
${TLL}
)
endif(UNIX)
#
# Executable
#
file(MAKE_DIRECTORY "bin")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -pthread")
#
# Installation
#
install(FILES media/fontlucida.png DESTINATION share/nodeboxeditor/media)
install(FILES media/gui_scale.png DESTINATION share/nodeboxeditor/media)
install(FILES media/coordinates.png DESTINATION share/nodeboxeditor/media)
install(FILES media/icon_mode_node.png DESTINATION share/nodeboxeditor/media)
install(FILES media/icon_mode_nodebox.png DESTINATION share/nodeboxeditor/media)
install(FILES media/icon_mode_texture.png DESTINATION share/nodeboxeditor/media)
install(FILES media/sky.jpg DESTINATION share/nodeboxeditor/media)
install(FILES media/texture_box.png DESTINATION share/nodeboxeditor/media)
install(FILES media/texture_terrain.png DESTINATION share/nodeboxeditor/media)
install(FILES media/icon.png DESTINATION share/nodeboxeditor/media)
install(FILES media/rotate_x.png DESTINATION share/nodeboxeditor/media)
install(FILES media/rotate_y.png DESTINATION share/nodeboxeditor/media)
install(FILES media/rotate_z.png DESTINATION share/nodeboxeditor/media)
install(FILES media/flip_x.png DESTINATION share/nodeboxeditor/media)
install(FILES media/flip_y.png DESTINATION share/nodeboxeditor/media)
install(FILES media/flip_z.png DESTINATION share/nodeboxeditor/media)
install(FILES editor.conf.example DESTINATION share/nodeboxeditor)
if(UNIX)
install (FILES nodeboxeditor.desktop DESTINATION share/applications)
endif()
install(FILES README.md DESTINATION share/nodeboxeditor)
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
if(WIN32)
if(DEFINED IRRLICHT_DLL)
install(FILES ${IRRLICHT_DLL} DESTINATION bin)
endif()
endif()