forked from uic-evl/omicron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
144 lines (135 loc) · 6.91 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
###################################################################################################
# THE OMICRON PROJECT
#-------------------------------------------------------------------------------------------------
# Copyright 2010-2012 Electronic Visualization Laboratory, University of Illinois at Chicago
# Authors:
# Alessandro Febretti [email protected]
#-------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011, Electronic Visualization Laboratory, University of Illinois at Chicago
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
###################################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS On)
cmake_minimum_required(VERSION 2.8.1)
project(OmicronSDK)
include(CPack)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
#cmake_policy(SET CMP0008 NEW)
endif()
###################################################################################################
# Create a build name depending on the OS, Toolset and architecture.
if(CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
set(OMICRON_OS_WIN 1)
set(OMICRON_ARCH_32 1)
set(OMICRON_ARCH_WIN32 1)
set(OMICRON_TOOL_VS9 1)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008 Win64")
set(OMICRON_OS_WIN 1)
set(OMICRON_ARCH_64 1)
set(OMICRON_ARCH_WIN32 1)
set(OMICRON_TOOL_VS9 1)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 10")
set(OMICRON_OS_WIN 1)
set(OMICRON_ARCH_32 1)
set(OMICRON_ARCH_WIN32 1)
set(OMICRON_TOOL_VS10 1)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 10 Win64")
set(OMICRON_OS_WIN 1)
set(OMICRON_ARCH_64 1)
set(OMICRON_ARCH_WIN32 1)
set(OMICRON_TOOL_VS10 1)
elseif(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
if(APPLE)
set(OMICRON_OS_OSX 1)
set(OMICRON_ARCH_32 1)
set(OMICRON_ARCH_I386 1)
set(OMICRON_TOOL_GCC 1)
else()
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(OMICRON_OS_LINUX 1)
set(OMICRON_ARCH_64 1)
set(OMICRON_ARCH_AMD64 1)
set(OMICRON_TOOL_GCC 1)
else()
set(OMICRON_OS_LINUX 1)
set(OMICRON_ARCH_32 1)
set(OMICRON_ARCH_I386 1)
set(OMICRON_TOOL_GCC 1)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ldl -lrt -pthread")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ldl -lrt -pthread")
endif()
elseif(CMAKE_GENERATOR STREQUAL "Xcode")
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
set(OMICRON_OS_OSX 1)
set(OMICRON_ARCH_32 1)
set(OMICRON_ARCH_I386 1)
set(OMICRON_TOOL_GCC 1)
endif()
set(OMICRON_DATA_PATH "${CMAKE_SOURCE_DIR}/data")
###################################################################################################
# Set the output directories for libraries and binary files
if(OMICRON_USE_CUSTOM_OUTPUT)
message("set custom output")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OMICRON_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OMICRON_ARCHIVE_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OMICRON_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${OMICRON_LIBRARY_OUTPUT_DIRECTORY_DEBUG})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${OMICRON_LIBRARY_OUTPUT_DIRECTORY_RELEASE})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${OMICRON_LIBRARY_OUTPUT_DIRECTORY_RELEASE})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${OMICRON_ARCHIVE_OUTPUT_DIRECTORY_DEBUG})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${OMICRON_ARCHIVE_OUTPUT_DIRECTORY_RELEASE})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${OMICRON_ARCHIVE_OUTPUT_DIRECTORY_RELEASE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${OMICRON_RUNTIME_OUTPUT_DIRECTORY_DEBUG})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${OMICRON_RUNTIME_OUTPUT_DIRECTORY_RELEASE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${OMICRON_RUNTIME_OUTPUT_DIRECTORY_RELEASE})
else()
message("NO set custom output")
if(MSVC OR CMAKE_GENERATOR STREQUAL "Xcode")
# Since visual studio builds are multiconfiguration, set two separate directories for debug and release builds
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/debug)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/release)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/lib/debug)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib/release)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/release)
# Make sure the output bin directories exist, so the cmake scripts can copy
# third party dlls there if needed.
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG})
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE})
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
endif()
endif()
###################################################################################################
# Visual studio specific options.
if(MSVC)
# Exclude libcmt when linking in visual studio
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:libcmt.lib")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /NODEFAULTLIB:libcmt.lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /NODEFAULTLIB:libcmt.lib")
add_definitions(-D_CRT_SECURE_NO_WARNINGS /wd4244 /wd4018)
endif(MSVC)
###################################################################################################
# Add subdirectiories
add_subdirectory(src)