forked from TurningWheel/Barony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
447 lines (406 loc) · 17 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
cmake_minimum_required(VERSION 2.6)
project(barony)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
if (DEFINED ENV{STEAMWORKS_ENABLED})
set (STEAMWORKS_ENABLED $ENV{STEAMWORKS_ENABLED})
else()
set (STEAMWORKS_ENABLED 0)
endif()
#FMOD can be disabled in one of two ways:
# * Not having FMOD installed will automatically disable FMOD (and, consequently, the game's sound engine as a whole).
# * Running cmake with -DFMOD_ENABLED=OFF
set(FMOD 0) #Acts as an alias to FMOD_FOUND
option(FMOD_ENABLED "Use the FMOD Ex library in the sound engine" ON)
set(OPENAL 0) #Acts as an alias to OPENAL_FOUND
option(OPENAL_ENABLED "Use the OpenAL library in the sound engine" OFF)
set(TREMOR 0)
option(TREMOR_ENABLED "Use Tremor instead of libvorbis for OpenAL" OFF)
if(FMOD_ENABLED AND OPENAL_ENABLED)
set(FMOD_ENABLED OFF)
endif()
set(PANDORA 0)
option(PANDORA_ENABLED "Build for the OpenPandora" OFF)
if(PANDORA_ENABLED)
set(PANDORA 1)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_OSX_ARCHITECTURES x86_64)
if (STEAMWORKS_ENABLED)
message("------------------------")
message("Building with steamworks")
message("------------------------")
else()
message("------------------------")
message("Building without steamworks")
message("------------------------")
endif()
set (Apple 0)
set (Windows 0)
set (Linux 0)
set (NOT_DWORD_DEFINED 0)
if( NOT WIN32 )
if(PANDORA)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -ffast-math -funroll-loops -fstrict-aliasing -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g -fuse-ld=gold -fuse-linker-plugin")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall ")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fstrict-aliasing -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g -fuse-ld=gold -fuse-linker-plugin -fsingle-precision-constant")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fstrict-aliasing -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g -fuse-ld=gold -fuse-linker-plugin -fsingle-precision-constant")
else()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -pg -ffast-math -funroll-loops -fstrict-aliasing")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pg")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fstrict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
endif()
if (APPLE)
set (Apple 1)
set (NOT_DWORD_DEFINED 1)
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -x objective-c")
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -x objective-c")
set(MACOSX_BUNDLE true)
set(MACOSX_BUNDLE_BUNDLE_NAME Barony)
#TODO: Make version a define which is also set in src/Config.h
set(MACOSX_BUNDLE_INFO_STRING Barony 2.0.2)
set(MACOSX_BUNDLE_LONG_VERSION 2.0.2)
set(MACOSX_BUNDLE_SHORT_VERSION_STRING 2.0.2)
set(MACOSX_BUNDLE_BUNDLE_VERSION 2.0.2)
set(MACOSX_BUNDLE_ICON_FILE "barony.icns")
#set(MACOSX_BUNDLE_ICON_FILE "game.icns")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -stdlib=libc++")
else()
set (Apple 0)
set (Linux 1) #TODO: Should not assume this? What if BSD/DOS/whatever-have-you?
set (NOT_DWORD_DEFINED 1)
if (NOT DISABLE_MALIGN_DOUBLE) #Only compile with -malign-double if not told to disable. Pass via command line flags.
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -malign-double")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -malign-double")
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -rdynamic -Wl,-rpath=$ORIGIN")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -rdynamic -Wl,-rpath=$ORIGIN")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,-rpath=$ORIGIN -Wno-write-strings")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -Wl,-rpath=$ORIGIN -Wno-write-strings")
endif()
else()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -pg -O3 -ffast-math -funroll-loops -malign-double -fstrict-aliasing -mwindows")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -malign-double -fstrict-aliasing -mwindows")
set (Windows 1)
endif()
if (ARCHITECTURE)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mcpu=${ARCHITECTURE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} -mcpu=${ARCHITECTURE}")
endif()
if (APPLE)
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -LD_RUNPATH_SEARCH_PATHS=@loader_path/../Frameworks -rpath @loader_path/../Frameworks")
endif()
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set ( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
IF(APPLE)
#include_directories(/usr/X11R6/include/)
#link_directories(/usr/X11R6/lib)
#FIND_LIBRARY(OpenGL_LIBRARY OpenGL )
#SET(EXTRA_LIBS ${OpenGL_LIBRARY} X11)
FIND_LIBRARY(OpenGL_LIBRARY OpenGL )
SET(EXTRA_LIBS ${OpenGL_LIBRARY})
#set(CMAKE_LIBRARY_PATH "/Library/Frameworks/")
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_net REQUIRED)
find_package(SDL2_ttf REQUIRED)
ENDIF (APPLE)
# Find OpenGL
if (NOT APPLE)
find_package(OpenGL REQUIRED)
endif()
#find_package(GLM REQUIRED)
if (NOT WIN32)
if (NOT APPLE)
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
PKG_SEARCH_MODULE(SDL2NET REQUIRED SDL2_net)
PKG_SEARCH_MODULE(SDL2TTF REQUIRED SDL2_ttf)
find_package(SDL2_net REQUIRED)
find_package(SDL2_ttf REQUIRED)
endif()
endif()
if (NOT WIN32)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${SDL2IMAGE_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2NET_INCLUDE_DIR} ${SDL2_NET_INCLUDE_DIRS} ${SDL2TTF_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIRS})
else()
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS})
endif()
if (OPENAL_ENABLED)
find_package(OpenAL)
if(TREMOR_ENABLED)
find_package(TREMOR)
else()
find_package(OGGVORBIS)
endif()
if (OPENAL_FOUND AND ((TREMOR_ENABLED AND TREMOR_FOUND) OR ((NOT TREMOR_ENABLED) AND OGGVORBIS_FOUND)))
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
if(TREMOR_ENABLED)
set(TREMOR 1)
INCLUDE_DIRECTORIES(${TREMOR_INCLUDE_DIR})
else()
INCLUDE_DIRECTORIES(${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR})
endif()
set(OPENAL 1)
endif()
endif()
find_package(Threads REQUIRED)
if( NOT WIN32 AND NOT APPLE)
#Linux needs these two.
#Windows has manual links later on.
#And Macs have their own special line.
if (FMOD_ENABLED)
find_package(FMOD)
if (FMOD_FOUND)
set(FMOD 1)
endif()
endif()
find_package(PNG REQUIRED)
elseif (APPLE)
#This is to make libpng work on Macs.
exec_program(libpng-config ARGS --cflags
OUTPUT_VARIABLE FMOD_CXX_FLAGS)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FMOD_CXX_FLAGS}")
MESSAGE("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
exec_program(libpng-config ARGS --ldflags
OUTPUT_VARIABLE FMOD_LINK_FLAGS)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FMOD_LINK_FLAGS}")
MESSAGE("CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
if (FMOD_ENABLED)
set(FMOD 1)
endif()
endif()
if( NOT WIN32 AND STEAMWORKS_ENABLED)
find_package(STEAMWORKS REQUIRED)
#find_package(STEAMWORKS_CWRAPPER REQUIRED)
endif()
if (STEAMWORKS_ENABLED)
#include_directories(${STEAMWORKS_CWRAPPER_INCLUDE_DIR})
include_directories(${STEAMWORKS_INCLUDE_DIR})
endif()
# Add include directories
#include_directories(${GLM_INCLUDE_DIR})
if( NOT WIN32 )
include_directories(${THREADS_INCLUDE_DIR})
endif()
if(NOT WIN32 AND NOT APPLE)
#Remember, Windows and Mac don't have find_package for fmod and png.
if (FMOD_FOUND)
include_directories(${FMOD_INCLUDE_DIR})
endif()
include_directories(${PNG_INCLUDE_DIR})
elseif (APPLE)
if (FMOD_ENABLED)
include_directories("${PROJECT_SOURCE_DIR}/libraries/fmod/inc")
link_directories("${PROJECT_SOURCE_DIR}/libraries/fmod/lib")
endif()
find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIR})
endif()
# Add the source directory
#file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.h) # Can't do this because it'd then compile barony and editor together. Which just won't work.
#file(GLOB_RECURSE BOOK_FILES books/*)
#file(GLOB_RECURSE IMAGE_FILES images/*)
#file(GLOB_RECURSE ITEM_FILES items/*)
#file(GLOB_RECURSE MAP_FILES maps/*)
#file(GLOB_RECURSE MODEL_FILES models/*)
#file(GLOB_RECURSE MUSIC_FILES music/*)
#file(GLOB_RECURSE SOUND_FILES sound/*)
#add_subdirectory(books)
configure_file ( "${PROJECT_SOURCE_DIR}/src/Config.hpp.in" "${PROJECT_SOURCE_DIR}/src/Config.hpp")
message("***************************")
message("Debug flags: ")
message("${CMAKE_C_FLAGS_DEBUG}")
message("${CMAKE_CXX_FLAGS_DEBUG}")
#-g -Wall -pg -ffast-math -funroll-loops -fstrict-aliasing
message("Release flags: ")
message("${CMAKE_C_FLAGS_RELEASE}")
message("${CMAKE_CXX_FLAGS_RELEASE}")
#-O3 -DNDEBUG -Wall -pg -ffast-math -funroll-loops -fstrict-aliasing
message("***************************")
add_subdirectory(src)
#ADD_DEFINITONS(${PNG_DEFINITIONS})
if (APPLE)
set(COPY_FRAMEWORKS ${PROJECT_SOURCE_DIR}/../Frameworks/SDL.framework ${PROJECT_SOURCE_DIR}/../Frameworks/SDL_image.framework ${PROJECT_SOURCE_DIR}/../Frameworks/SDL_mixer.framework ${PROJECT_SOURCE_DIR}/../Frameworks/SDL_net.framework)
message("{COPY_FRAMEWORKS}: ${COPY_FRAMEWORKS}")
#add_executable(barony MACOSX_BUNDLE OSX/SDLmain.m ${GAME_SOURCES} ${COPY_FRAMEWORKS} ${BOOK_FILES} ${IMAGE_FILES} ${ITEM_FILES} ${MAP_FILES} ${MODEL_FILES} ${MUSIC_FILES} ${SOUND_FILES} libfmodex.dylib)
#add_executable(barony MACOSX_BUNDLE OSX/SDLmain.m ${GAME_SOURCES} ${COPY_FRAMEWORKS} libfmodex.dylib /opt/local/lib/libpng16.16.dylib)
#add_executable(barony MACOSX_BUNDLE OSX/SDLmain.m ${GAME_SOURCES} ${MACOSX_BUNDLE_ICON_FILE} libfmodex.dylib /opt/local/lib/libpng16.16.dylib)
if (FMOD_ENABLED)
add_executable(barony MACOSX_BUNDLE ${GAME_SOURCES} ${MACOSX_BUNDLE_ICON_FILE} libfmodex.dylib /opt/local/lib/libpng16.16.dylib)
else()
add_executable(barony MACOSX_BUNDLE ${GAME_SOURCES} ${MACOSX_BUNDLE_ICON_FILE} /opt/local/lib/libpng16.16.dylib)
endif()
#add_executable(barony OSX/SDLmain.m ${GAME_SOURCES})
#add_executable(barony ${GAME_SOURCES})
#SET_SOURCE_FILES_PROPERTIES(${COPY_FRAMEWORKS} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
#SET_SOURCE_FILES_PROPERTIES(${BOOK_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/books/)
#SET_SOURCE_FILES_PROPERTIES(${IMAGE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/images/)
#SET_SOURCE_FILES_PROPERTIES(${ITEM_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/items/)
#SET_SOURCE_FILES_PROPERTIES(${MAP_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/maps/)
#SET_SOURCE_FILES_PROPERTIES(${MODEL_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/models/)
#SET_SOURCE_FILES_PROPERTIES(${MUSIC_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/music/)
#SET_SOURCE_FILES_PROPERTIES(${SOUND_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/sound/)
if (FMOD_ENABLED)
SET_SOURCE_FILES_PROPERTIES(libfmodex.dylib PROPERTIES MACOSX_PACKAGE_LOCATION MacOS)
endif()
SET_SOURCE_FILES_PROPERTIES(/opt/local/lib/libpng16.16.dylib PROPERTIES MACOSX_PACKAGE_LOCATION MacOS)
SET_SOURCE_FILES_PROPERTIES(${COPY_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
SET_SOURCE_FILES_PROPERTIES(${MACOSX_BUNDLE_ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set_source_files_properties(${GAME_SOURCES} PROPERTIES COMPILE_FLAGS "-x objective-c++")
#set_source_files_properties(${GAME_SOURCES} PROPERTIES COMPILE_FLAGS "-stdlib=libc++")
else()
add_executable(barony ${GAME_SOURCES})
endif()
if(WIN32)
target_link_libraries(barony -lmingw32)
target_link_libraries(barony -lSDL2main)
target_link_libraries(barony -lSDL2)
target_link_libraries(barony -lSDL2_net)
target_link_libraries(barony -lSDL2_image)
target_link_libraries(barony -lSDL2_ttf)
if(STEAMWORKS_ENABLED)
#target_link_libraries(barony -lsteamworks_cwrapper -lstdc++)
target_link_libraries(barony -lsteam_api)
endif()
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
# 64 bit
target_link_libraries(barony -L/usr/lib64 -lstdc++)
endif()
target_link_libraries(barony ${SDL2_LIBRARIES} ${SDL2_LIBRARY} ${SDL2IMAGE_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_NET_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${SDL2TTF_LIBRARY})
if (STEAMWORKS_ENABLED)
target_link_libraries(barony ${STEAMWORKS_LIBRARY})
#target_link_libraries(barony ${STEAMWORKS_CWRAPPER_LIBRARIES} -lstdc++)
endif()
if (APPLE)
target_link_libraries(barony ${GLUT_LIBRARIES})
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "BSD")
# For backtrace
find_path(EXECINFO_INC NAMES execinfo.h)
find_library(EXECINFO_LIB NAMES execinfo)
include_directories(${EXECINFO_INC})
target_link_libraries(barony ${EXECINFO_LIB})
endif()
endif()
target_link_libraries(barony ${OPENGL_LIBRARIES})
target_link_libraries(barony ${THREADS_LIBRARIES})
target_link_libraries(barony -lm)
if( NOT WIN32 AND NOT APPLE)
#Remember, Windows and Mac aren't using find_package for FMOD and PNG.
target_link_libraries(barony ${PNG_LIBRARY})
if (FMOD_FOUND)
target_link_libraries(barony ${FMOD_LIBRARY})
endif()
endif()
# We need to link to Winsock if we're on Windows
if(WIN32)
target_link_libraries(barony wsock32 ws2_32)
target_link_libraries(barony -lpng -lfmodex)
endif()
if(APPLE)
if (FMOD_ENABLED)
target_link_libraries(barony -lfmodex) #Finally manually link fmod for mac.
endif()
endif()
target_link_libraries(barony ${EXTRA_LIBS}) #Apple needs this for OpenGL to work.
if (OPENAL)
target_link_libraries(barony ${OPENAL_LIBRARY})
if(TREMOR_ENABLED)
target_link_libraries(barony ${TREMOR_LIBRARY})
else()
target_link_libraries(barony ${VORBISFILE_LIBRARY} ${OGG_LIBRARY})
endif()
endif()
if (NOT APPLE)
#install(TARGETS barony
# RUNTIME DESTINATION bin
# COMPONENT Runtime
#)
else()
install(TARGETS barony
RUNTIME DESTINATION bin COMPONENT Runtime BUNDLE DESTINATION Resources
)
endif()
if (APPLE)
#add_executable(editor OSX/SDLmain.m ${EDITOR_SOURCES})
#set(MACOSX_BUNDLE_ICON_FILE "${PROJECT_SOURCE_DIR}/editor.icns")
#add_executable(editor MACOSX_BUNDLE OSX/SDLmain.m ${EDITOR_SOURCES} ${COPY_FRAMEWORKS} libfmodex.dylib /opt/local/lib/libpng16.16.dylib)
#add_executable(editor MACOSX_BUNDLE OSX/SDLmain.m ${EDITOR_SOURCES} libfmodex.dylib /opt/local/lib/libpng16.16.dylib)
if (FMOD_ENABLED)
add_executable(editor MACOSX_BUNDLE ${EDITOR_SOURCES} libfmodex.dylib /opt/local/lib/libpng16.16.dylib)
else()
add_executable(editor MACOSX_BUNDLE ${EDITOR_SOURCES} /opt/local/lib/libpng16.16.dylib)
endif()
#SET_SOURCE_FILES_PROPERTIES(${MACOSX_BUNDLE_ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set_source_files_properties(${EDITOR_SOURCES} PROPERTIES COMPILE_FLAGS "-x objective-c++")
else()
add_executable(editor ${EDITOR_SOURCES})
endif()
if(WIN32)
target_link_libraries(editor -lmingw32)
target_link_libraries(editor -lSDL2main)
target_link_libraries(editor -lSDL2)
target_link_libraries(editor -lSDL2_net)
target_link_libraries(editor -lSDL2_image)
target_link_libraries(editor -lSDL2_ttf)
if(STEAMWORKS_ENABLED)
#target_link_libraries(editor -lsteamworks_cwrapper -lstdc++)
target_link_libraries(editor -lsteam_api)
endif()
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
# 64 bit
target_link_libraries(editor -L/usr/lib64 -lstdc++)
endif()
target_link_libraries(editor ${SDL2_LIBRARIES} ${SDL2_LIBRARY} ${SDL2IMAGE_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_NET_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${SDL2TTF_LIBRARY})
if (STEAMWORKS_ENABLED)
target_link_libraries(editor ${STEAMWORKS_LIBRARY})
#target_link_libraries(editor ${STEAMWORKS_CWRAPPER_LIBRARIES} -lstdc++)
endif()
endif()
target_link_libraries(editor ${OPENGL_LIBRARIES})
target_link_libraries(editor ${THREADS_LIBRARIES})
target_link_libraries(editor -lm)
# We need to link to Winsock if we're on Windows
if( NOT WIN32 AND NOT APPLE)
#Remember, Windows and Mac aren't using find_package for FMOD and PNG.
target_link_libraries(editor ${PNG_LIBRARY})
if (FMOD_FOUND)
target_link_libraries(editor ${FMOD_LIBRARY})
endif()
endif()
if(WIN32)
target_link_libraries(editor wsock32 ws2_32)
target_link_libraries(editor -lfmodex)
endif()
if (APPLE)
if (FMOD_ENABLED)
target_link_libraries(editor -lfmodex) #Finally manually link fmod for mac.
endif()
endif()
target_link_libraries(editor ${EXTRA_LIBS}) #Apple needs this for OpenGL to work.
if (OPENAL)
target_link_libraries(editor ${OPENAL_LIBRARY})
if(TREMOR_ENABLED)
target_link_libraries(editor ${TREMOR_LIBRARY})
else()
target_link_libraries(editor ${VORBISFILE_LIBRARY})
endif()
endif()
#install(TARGETS editor
# RUNTIME DESTINATION bin COMPONENT Runtime
#)
#install(DIRECTORY data DESTINATION share/barony )
if (APPLE)
# SET_TARGET_PROPERTIES(
# barony
# PROPERTIES
# RESOURCE ${BOOK_FILES} ${IMAGE_FILES} ${ITEM_FILES} ${MAP_FILES} ${MODEL_FILES} ${MUSIC_FILES} ${SOUND_FILES}
# )
endif()