forked from bestimmaa/ExSciVis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
131 lines (102 loc) · 4.34 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
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_policy(VERSION 2.8)
set(EXERCISE_SCIVIS exercise_scivis)
set(FRAMEWORK_NAME framework)
project(${EXERCISE_SCIVIS})
if(CMAKE_CURRENT_SOURCE_DIR EQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR "Source and binary directories must be different")
endif(CMAKE_CURRENT_SOURCE_DIR EQUAL CMAKE_CURRENT_BINARY_DIR)
if(MSVC)
set(BINARY_DIRECTORY build)
endif()
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX))
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_CXX_FLAGS "-std=c++0x")
endif()
option(EXERCISE_SCIVIS_IN_SOURCE_BUILD "EXERCISE_SCIVIS_IN_SOURCE_BUILD" OFF)
if(EXERCISE_SCIVIS_IN_SOURCE_BUILD)
add_definitions(-DEXERCISE_SCIVIS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-DEXERCISE_SCIVIS_BINARY_DIR="../")
else()
add_definitions(-DEXERCISE_SCIVIS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-DEXERCISE_SCIVIS_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}")
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external)
add_definitions(-DGLEW_STATIC)
set(GLFW_DIRECTORY glfw-3.0.3)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${GLFW_DIRECTORY}/include)
set(GLFW_INSTALL OFF CACHE STRING "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE STRING "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE STRING "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/${GLFW_DIRECTORY})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${GLFW_DIRECTORY}/include)
set(GLM_DIRECTORY glm-0.9.5.3)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${GLM_DIRECTORY})
set(GLFW_DIRECTORY glfw-3.0.3)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${GLFW_DIRECTORY}/include)
set(STBIMAGE_DIRECTORY stb-image)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${STBIMAGE_DIRECTORY})
################################
# Add libraries to executables
set(BINARY_FILES glfw ${GLFW_LIBRARIES} ${FREEIMAGE_LIBRARY})
################################
# Add output directory
if(MSVC)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(COPY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/Debug/ )
else(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(COPY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/Release/ )
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
else(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/Debug )
else(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/Release )
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif(MSVC)
option(EXERCISE_SCIVIS_AUTOMATED_TESTS "EXERCISE_SCIVIS_AUTOMATED_TESTS" OFF)
if(EXERCISE_SCIVIS_AUTOMATED_TESTS)
add_definitions(-DAUTOMATED_TESTS)
endif()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
if (NOT APPLE)
add_definitions(-fpermissive)
endif()
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/framework)
add_subdirectory(framework)
add_subdirectory(source)
set (EXERCISE_SCIVIS_TESTS "false" CACHE BOOL "Set to enable testing.")
if (EXERCISE_SCIVIS_TESTS)
set(UNITTEST_PP_DIRECTORY unittest-cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${UNITTEST_PP_DIRECTORY}/UnitTest++)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/${UNITTEST_PP_DIRECTORY})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/${UNITTEST_PP_DIRECTORY}/UnitTest++)
#set(BINARY_FILES UnitTest++ glfw ${GLFW_LIBRARIES} ${FREEIMAGE_LIBRARY})
add_subdirectory(tests)
enable_testing()
add_test( NAME testEXERCISE_SCIVIS COMMAND runTests )
endif (EXERCISE_SCIVIS_TESTS)
install (DIRECTORY data DESTINATION .)
# See http://www.vtk.org/Wiki/CMake:CPackPackageGenerators
set (CPACK_PACKAGE_VERSION_MAJOR "4")
set (CPACK_PACKAGE_VERSION_MINOR "4")
set (CPACK_PACKAGE_VERSION_PATCH "2")
# Use current date in YYYYMMDD format as patch number
# cpack mistakenly detects Mingw-w64 as win32
if (MINGW)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set (CPACK_SYSTEM_NAME win64)
endif ()
endif ()
if (WIN32)
set (CPACK_GENERATOR "ZIP")
else ()
set (CPACK_GENERATOR "TBZ2")
endif ()
include(CPack)