-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
558 lines (485 loc) · 19.8 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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# Copyright Linkoping University 2011-2015
# SGCT Project
#
# General project settings
#
cmake_minimum_required(VERSION 2.8)
SET(BUILD_SHARED_LIBS OFF)
PROJECT("sgct")
set(SGCT_VERSION_MAJOR "2")
set(SGCT_VERSION_MINOR "7")
set(SGCT_VERSION_REVISION "1")
set(SGCT_VERSION "${SGCT_VERSION_MAJOR}_${SGCT_VERSION_MINOR}_${SGCT_VERSION_REVISION}")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
STRING(REGEX REPLACE "/" "\\\\" SGCT_WIN_SOURCE_DIR ${PROJECT_SOURCE_DIR})
STRING(REGEX REPLACE "/" "\\\\" SGCT_WIN_BINARY_DIR ${PROJECT_BINARY_DIR})
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
option(SGCT_INSTALL "Install SGCT" OFF)
option(SGCT_EXAMPLES "Build SGCT examples" OFF)
option(SGCT_DOXYGEN "Build doxygen documentation" OFF)
option(SGCT_DOXYGEN_QUIET "Suppress warnings" ON)
#if(NOT WIN32)
# option(SGCT_MAKE_RELEASE "make realease" OFF)
#endif()
if (MSVC)
option(SGCT_USE_MSVC_RUNTIMES "To use MSVC DLLs or to create a static build" ON)
option(SGCT_BUILD_CSHARP_PROJECTS "Build C# projects" ON)
endif()
option(SGCT_BUILD_ALUT "Build ALUT" OFF)
option(SGCT_LIGHT_ONLY "Don't merge external libs" OFF)
if( MINGW )
option(SGCT_MINGW64 "Use MinGW64" ON)
endif()
macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY}
${XCODE_VALUE})
endmacro (set_xcode_property)
#png & zlib options
set(SKIP_INSTALL_ALL ON)
if( APPLE )
option(SGCT_CPP11 "Use libc++ instead of libstdc++" ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
if(CMAKE_GENERATOR STREQUAL Xcode)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
endif()
endif()
set(SGCT_TARGET_PATH ${PROJECT_BINARY_DIR})
set(SGCT_BINARY_PATH ${PROJECT_BINARY_DIR})
set(SGCT_SOURCE_PATH ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "SGCT target path: ${SGCT_TARGET_PATH}")
if( APPLE )
if( SGCT_CPP11 )
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/mac_cpp11")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/mac_cpp11")
else()
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/mac")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/mac")
endif()
elseif( MINGW )
set(SGCT_COMPILER "mingw")
if( SGCT_MINGW64 )
set(SGCT_ARCHITECTURE "x64")
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/${SGCT_COMPILER}_${SGCT_ARCHITECTURE}")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/${SGCT_COMPILER}_${SGCT_ARCHITECTURE}")
else()
set(SGCT_ARCHITECTURE "x86")
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/${SGCT_COMPILER}")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/${SGCT_COMPILER}")
endif()
elseif( MSVC )
if( CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" )
set(SGCT_COMPILER "msvc9")
set(SGCT_ARCHITECTURE "x86")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008 Win64" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008 Win64" )
set(SGCT_COMPILER "msvc9")
set(SGCT_ARCHITECTURE "x64")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 10" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10 2010" )
set(SGCT_COMPILER "msvc10")
set(SGCT_ARCHITECTURE "x86")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 10 Win64" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10 2010 Win64" )
set(SGCT_COMPILER "msvc10")
set(SGCT_ARCHITECTURE "x64")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 11" OR CMAKE_GENERATOR STREQUAL "Visual Studio 11 2012" )
set(SGCT_COMPILER "msvc11")
set(SGCT_ARCHITECTURE "x86")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 11 Win64" OR CMAKE_GENERATOR STREQUAL "Visual Studio 11 2012 Win64" )
set(SGCT_COMPILER "msvc11")
set(SGCT_ARCHITECTURE "x64")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 12" OR CMAKE_GENERATOR STREQUAL "Visual Studio 12 2013")
set(SGCT_COMPILER "msvc12")
set(SGCT_ARCHITECTURE "x86")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 12 Win64" OR CMAKE_GENERATOR STREQUAL "Visual Studio 12 2013 Win64")
set(SGCT_COMPILER "msvc12")
set(SGCT_ARCHITECTURE "x64")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 14" OR CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015")
set(SGCT_COMPILER "msvc14")
set(SGCT_ARCHITECTURE "x86")
elseif( CMAKE_GENERATOR STREQUAL "Visual Studio 14 Win64" OR CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015 Win64")
set(SGCT_COMPILER "msvc14")
set(SGCT_ARCHITECTURE "x64")
else()
#use mingw as template
set(SGCT_COMPILER "mingw")
set(SGCT_ARCHITECTURE "x86")
endif()
if(SGCT_ARCHITECTURE STREQUAL "x64")
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/${SGCT_COMPILER}_${SGCT_ARCHITECTURE}")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/${SGCT_COMPILER}_${SGCT_ARCHITECTURE}")
else()
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/${SGCT_COMPILER}")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/${SGCT_COMPILER}")
endif()
elseif( UNIX AND NOT APPLE )
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/linux_x64")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/linux_x64")
elseif( CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/linux")
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/linux")
else()
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/unix")
#use linux as template
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/linux")
endif()
else()
set(SGCT_LIB_PATH "${SGCT_TARGET_PATH}/lib/${CMAKE_SYSTEM_NAME}/${CMAKE_GENERATOR}")
#use linux as template
set(SGCT_LIB_SRC_PATH "${PROJECT_SOURCE_DIR}/lib/linux")
endif()
MESSAGE(STATUS "SGCT lib path: ${SGCT_LIB_PATH}")
SET(LIB_NAME sgct_light)
set( PDB_OUTPUT_DIRECTORY "${SGCT_LIB_PATH}" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${SGCT_LIB_PATH}" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${SGCT_LIB_PATH}" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${SGCT_LIB_PATH}" )
set( SGCT_RELEASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/release" )
if(SGCT_DOXYGEN_QUIET)
set(SGCT_DOXYGEN_QUIET_STATE "YES")
else()
set(SGCT_DOXYGEN_QUIET_STATE "NO")
endif()
#update version in files
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/SGCTVersion.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/sgct/SGCTVersion.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/release/build_release_xcode.sh.in ${CMAKE_CURRENT_BINARY_DIR}/src/installer/build_release_xcode.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/release/build_release_xcode_cpp11.sh.in ${CMAKE_CURRENT_BINARY_DIR}/src/installer/build_release_xcode_cpp11.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/release/build_release_linux.sh.in ${CMAKE_CURRENT_BINARY_DIR}/src/installer/build_release_linux.sh @ONLY)
#crate directories
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/installer)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs)
set(LibPath "${SGCT_LIB_PATH}")
set(EXECUTABLE_OUTPUT_PATH ${LibPath})
file (GLOB_RECURSE sgctSRC "${CMAKE_CURRENT_SOURCE_DIR}/src/sgct/*.cpp")
file (GLOB_RECURSE sgctInc "${CMAKE_CURRENT_SOURCE_DIR}/include/sgct/*.h")
#include_directories("include/external/freetype")
#Set(ALL_SRC ${sgctSRC} ${sgctInc} "${CMAKE_CURRENT_SOURCE_DIR}/include/sgct.h" "include/external/freetype")
Set(ALL_SRC ${sgctSRC} ${sgctInc} "${CMAKE_CURRENT_SOURCE_DIR}/include/sgct.h")
#print all
FOREACH(ALL_SRCName ${ALL_SRC})
MESSAGE(STATUS "Adding file: ${ALL_SRCName}")
ENDFOREACH(ALL_SRCName)
add_library(${LIB_NAME} STATIC
${ALL_SRC}
)
if(SGCT_LIGHT_ONLY)
INCLUDE_DIRECTORIES(
include
include/external
)
add_definitions(-DSGCT_DONT_USE_EXTERNAL)
else(SGCT_LIGHT_ONLY)
INCLUDE_DIRECTORIES(
include
)
endif(SGCT_LIGHT_ONLY)
find_package(OpenGL REQUIRED)
set( PDB_OUTPUT_DIRECTORY "${SGCT_LIB_PATH}/deps" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${SGCT_LIB_PATH}/deps" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${SGCT_LIB_PATH}/deps" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${SGCT_LIB_PATH}/deps" )
set( CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${PROJECT_BUILD_DIR}/bin" )
set( CMAKE_EXECUTABLE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BUILD_DIR}/bin" )
set( CMAKE_EXECUTABLE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BUILD_DIR}/bin" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BUILD_DIR}/bin" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BUILD_DIR}/bin" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BUILD_DIR}/bin" )
if(MSVC)
set(SGCTCompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
)
endif(MSVC)
if(NOT SGCT_LIGHT_ONLY)
ADD_SUBDIRECTORY(src/deps)
if(SGCT_BUILD_ALUT)
ADD_SUBDIRECTORY(additional_deps/freealut-1.1.0-src)
endif(SGCT_BUILD_ALUT)
endif()
set(COMMON_DEBUG_LIBS
${OPENGL_gl_LIBRARY}
)
set(COMMON_RELEASE_LIBS
${OPENGL_gl_LIBRARY}
)
if( MSVC )
set(DEBUG_LIBS
${COMMON_DEBUG_LIBS}
ws2_32
)
set(RELEASE_LIBS
${COMMON_RELEASE_LIBS}
ws2_32
)
elseif( WIN32 ) #MINGW or similar
set(DEBUG_LIBS
${COMMON_DEBUG_LIBS}
ws2_32
)
set(RELEASE_LIBS
${COMMON_RELEASE_LIBS}
ws2_32
)
elseif( APPLE )
find_library(COCOA_LIBRARY Cocoa REQUIRED)
find_library(IOKIT_LIBRARY IOKit REQUIRED)
find_library(COREVIDEO_LIBRARY CoreVideo REQUIRED)
set(DEBUG_LIBS
${COMMON_DEBUG_LIBS}
${COCOA_LIBRARY}
${IOKIT_LIBRARY}
${COREVIDEO_LIBRARY}
)
set(RELEASE_LIBS
${COMMON_RELEASE_LIBS}
${COCOA_LIBRARY}
${IOKIT_LIBRARY}
${COREVIDEO_LIBRARY}
)
else() #linux
find_package(X11 REQUIRED)
find_package(Threads REQUIRED)
set(LINUX_LIBS
${X11_X11_LIB}
${X11_Xrandr_LIB}
${X11_Xinerama_LIB}
${X11_Xinput_LIB}
${X11_Xxf86vm_LIB}
${X11_Xcursor_LIB}
${CMAKE_THREAD_LIBS_INIT}
)
set(DEBUG_LIBS
${COMMON_DEBUG_LIBS}
${LINUX_LIBS}
)
set(RELEASE_LIBS
${COMMON_RELEASE_LIBS}
${LINUX_LIBS}
)
endif()
if( MSVC )
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMTD.lib")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT.lib")
if (NOT SGCT_USE_MSVC_RUNTIMES)
foreach (flag ${SGCTCompilerFlags})
if (${flag} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif()
if (${flag} MATCHES "/MDd")
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
endif()
endforeach()
endif()
foreach(CompilerFlag ${SGCTCompilerFlags})
string(REPLACE "/Zi" "/Z7" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif()
if(MSVC AND NOT "${MSVC_VERSION}" LESS 1400)
add_definitions( "/MP" )
endif()
if( WIN32 )
add_definitions(-D__WIN32__)
if( MINGW )
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif()
elseif( APPLE )
add_definitions(-D__APPLE__)
if(SGCT_CPP11)
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
set_xcode_property(${LIB_NAME} CLANG_CXX_LANGUAGE_STANDARD "c++11")
set_xcode_property(${LIB_NAME} CLANG_CXX_LIBRARY "libc++")
else()
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libstdc++ ${CMAKE_CXX_FLAGS}")
set_xcode_property(${LIB_NAME} CLANG_CXX_LANGUAGE_STANDARD "c++11")
set_xcode_property(${LIB_NAME} CLANG_CXX_LIBRARY "libstdc++")
endif()
else()
add_definitions(-D__LINUX__)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif()
add_definitions(-DGLEW_STATIC)
add_definitions(-DGLEW_NO_GLU)
#if( CMAKE_COMPILER_IS_GNUCXX )
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++ -static")
#endif()
target_link_libraries( ${LIB_NAME} debug ${DEBUG_LIBS} optimized ${RELEASE_LIBS})
#to make sure that everything is build when post_build events runs
add_dependencies(${LIB_NAME} freetype glew glfw png16_static turbojpeg-static tinythreadpp tinyxml2static zlibstatic vrpn)
#copy configure files
add_custom_command(TARGET ${LIB_NAME}
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/src/deps/vrpn/vrpn_Configure.h ${PROJECT_SOURCE_DIR}/include/vrpn/vrpn_Configure.h
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/src/deps/lpng/zlib/zconf.h ${PROJECT_SOURCE_DIR}/include/external/zconf.h
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/src/deps/lpng/pnglibconf.h ${PROJECT_SOURCE_DIR}/include/external/pnglibconf.h
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/src/deps/libjpeg-turbo/jconfig.h ${PROJECT_SOURCE_DIR}/include/external/jconfig.h
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/src/deps/libjpeg-turbo/jconfigint.h ${PROJECT_SOURCE_DIR}/include/external/jconfigint.h
)
#merge libs
if(NOT SGCT_LIGHT_ONLY)
if(WIN32)
add_custom_command(TARGET ${LIB_NAME}
POST_BUILD
COMMAND "merge_libs.bat"
WORKING_DIRECTORY ${SGCT_LIB_PATH}
)
#copy script
add_custom_command(TARGET ${LIB_NAME}
PRE_BUILD
#COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${SGCT_LIB_SRC_PATH}/merge_libs.bat ${SGCT_LIB_PATH}/merge_libs.bat)
else()
if(CMAKE_GENERATOR STREQUAL Xcode)
set(SGCT_SHELL_NAME merge_libs_xcode.sh)
else()
set(SGCT_SHELL_NAME merge_libs.sh)
endif()
add_custom_command(TARGET ${LIB_NAME}
POST_BUILD
COMMAND "./${SGCT_SHELL_NAME}"
WORKING_DIRECTORY ${SGCT_LIB_PATH})
#copy script
add_custom_command(TARGET ${LIB_NAME}
PRE_BUILD
#COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${SGCT_LIB_SRC_PATH}/${SGCT_SHELL_NAME} ${SGCT_LIB_PATH}/${SGCT_SHELL_NAME})
endif()
endif()
#if(SGCT_MAKE_RELEASE)
# if( APPLE )
# if( SGCT_CPP11 )
# add_custom_command(TARGET ${LIB_NAME}
# POST_BUILD
# COMMAND "${PROJECT_BINARY_DIR}/src/installer/build_release_xcode_cpp11.sh"
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/src/installer)
# else()
# add_custom_command(TARGET ${LIB_NAME}
# POST_BUILD
# COMMAND "${PROJECT_BINARY_DIR}/src/installer/build_release_xcode.sh"
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/src/installer)
# endif()
# elseif( NOT WIN32 ) #linux
# add_custom_command(TARGET ${LIB_NAME}
# POST_BUILD
# COMMAND "${PROJECT_BINARY_DIR}/src/installer/build_release_linux.sh"
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/src/installer)
# endif()
#endif()
SET(SPOUT_ENABLED "0")
if(SGCT_EXAMPLES)
if( APPLE AND SGCT_CPP11 )
set(SGCT_RELEASE_LIBRARY "${SGCT_LIB_PATH}/libsgct_cpp11.a")
set(SGCT_DEBUG_LIBRARY "${SGCT_LIB_PATH}/libsgct_cpp11d.a")
elseif( MSVC )
set(SGCT_RELEASE_LIBRARY "${SGCT_LIB_PATH}/sgct.lib")
set(SGCT_DEBUG_LIBRARY "${SGCT_LIB_PATH}/sgctd.lib")
else() #mac, mingw and linux
set(SGCT_RELEASE_LIBRARY "${SGCT_LIB_PATH}/libsgct.a")
set(SGCT_DEBUG_LIBRARY "${SGCT_LIB_PATH}/libsgctd.a")
endif()
set(SGCT_INCLUDE_DIRECTORY "${SGCT_SOURCE_PATH}/include")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/examples)
file(COPY "${SGCT_SOURCE_PATH}/src/apps/SharedResources" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/bin/examples")
file(COPY "${SGCT_SOURCE_PATH}/config" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(SGCT_EXAMPLE_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin/examples)
ADD_SUBDIRECTORY(src/apps)
endif()
#must be placed after examples subdirectory
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/installers/sgct_osg_all_win.nsi.in ${CMAKE_CURRENT_BINARY_DIR}/src/installer/sgct_osg_all_win.nsi @ONLY)
if(SGCT_DOXYGEN)
find_package(Doxygen)
if (DOXYGEN_FOUND)
add_custom_command(TARGET ${LIB_NAME}
POST_BUILD
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
endif()
if(SGCT_INSTALL)
if(SGCT_LIGHT_ONLY)
if( MSVC )
INSTALL(FILES ${SGCT_LIB_PATH}/sgct_light.lib DESTINATION lib COMPONENT libraries CONFIGURATIONS Release)
INSTALL(FILES ${SGCT_LIB_PATH}/sgct_lightd.lib DESTINATION lib COMPONENT libraries CONFIGURATIONS Debug)
else( MSVC )
INSTALL(FILES ${SGCT_LIB_PATH}/libsgct_light.a DESTINATION lib COMPONENT libraries CONFIGURATIONS Release)
INSTALL(FILES ${SGCT_LIB_PATH}/libsgct_lightd.a DESTINATION lib COMPONENT libraries CONFIGURATIONS Debug)
endif( MSVC )
else(SGCT_LIGHT_ONLY)
if( MSVC )
INSTALL(FILES ${SGCT_LIB_PATH}/sgct.lib DESTINATION lib COMPONENT libraries CONFIGURATIONS Release)
INSTALL(FILES ${SGCT_LIB_PATH}/sgctd.lib DESTINATION lib COMPONENT libraries CONFIGURATIONS Debug)
else( MSVC )
if( APPLE AND SGCT_CPP11 )
INSTALL(FILES ${SGCT_LIB_PATH}/libsgct_cpp11.a DESTINATION lib COMPONENT libraries CONFIGURATIONS Release)
INSTALL(FILES ${SGCT_LIB_PATH}/libsgct_cpp11d.a DESTINATION lib COMPONENT libraries CONFIGURATIONS Debug)
else()
INSTALL(FILES ${SGCT_LIB_PATH}/libsgct.a DESTINATION lib COMPONENT libraries CONFIGURATIONS Release)
INSTALL(FILES ${SGCT_LIB_PATH}/libsgctd.a DESTINATION lib COMPONENT libraries CONFIGURATIONS Debug)
endif()
endif( MSVC )
#include files
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include/external DESTINATION include COMPONENT headers PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include/GL DESTINATION include COMPONENT headers PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include/glm DESTINATION include COMPONENT headers PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include/vrpn DESTINATION include COMPONENT headers PATTERN ".svn" EXCLUDE)
endif()
INSTALL(FILES ${PROJECT_SOURCE_DIR}/include/sgct.h DESTINATION include COMPONENT headers)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include/sgct DESTINATION include COMPONENT headers PATTERN ".svn" EXCLUDE)
#make install on other systems should not copy docs into the compiler's directory
if(MSVC)
#docs
INSTALL(FILES ${PROJECT_SOURCE_DIR}/EULA.rtf DESTINATION docs COMPONENT documentation)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/readme DESTINATION docs COMPONENT documentation PATTERN ".svn" EXCLUDE)
if (DOXYGEN_FOUND)
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/docs/html DESTINATION docs COMPONENT documentation PATTERN ".svn" EXCLUDE)
endif()
endif(MSVC)
set(CPACK_PACKAGE_NAME "SGCT")
set(CPACK_BUNDLE_NAME "SGCT")
#path to readme
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/installer_readme.txt")
#path to license
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/EULA.rtf")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/installer_readme.txt")
#New CMake variables:
#CPACK_WIX_PRODUCT_ICON
#CPACK_WIX_UI_BANNER
#CPACK_WIX_UI_DIALOG
#Documentation:
#CPACK_WIX_PRODUCT_ICON -- icon used to the left of the application entry in add/remove programs.
#CPACK_WIX_UI_BANNER -- 493 by 58 pixels, this bitmap will appear at the top of all but the first page of the installer.
#CPACK_WIX_UI_DIALOG -- 493 by 312 pixels, this bitmap will appear on the first page of the installer.
#fix nsis path problem
if(WIN32)
SET(IMAGE_PATH "${PROJECT_SOURCE_DIR}\\\\image.bmp")
SET(SIDEBAR_IMAGE "${PROJECT_SOURCE_DIR}/src/installers\\\\sgct.bmp")
#STRING(REGEX REPLACE "/" "\\\\" IMAGE_PATH "${PROJECT_SOURCE_DIR}/image.bmp")
else()
SET(IMAGE_PATH "${PROJECT_SOURCE_DIR}/image.bmp")
SET(SIDEBAR_IMAGE "${PROJECT_SOURCE_DIR}/src/installers/sgct.bmp")
endif()
SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "!define MUI_WELCOMEFINISHPAGE_BITMAP \\\"${SIDEBAR_IMAGE}\\\"\n!define MUI_ICON \\\"${PROJECT_SOURCE_DIR}/icon.ico\\\"")
#icon
#SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/icon.ico")
SET(CPACK_WIX_PRODUCT_ICON "${PROJECT_SOURCE_DIR}/icon.ico")
if(WIN32)
if(CMAKE_CL_64)
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
else(CMAKE_CL_64)
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
endif(CMAKE_CL_64)
SET(CPACK_PACKAGE_ICON ${IMAGE_PATH})
endif(WIN32)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SGCT - Simple Graphics Cluster Toolkit")
set(CPACK_PACKAGE_VENDOR "Linkoping University")
set(CPACK_PACKAGE_VERSION_MAJOR ${SGCT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SGCT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SGCT_VERSION_REVISION})
include(CPack)
endif(SGCT_INSTALL)