forked from openorbit/openorbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
142 lines (111 loc) · 3.74 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
# Root CMakeList file
# Force use of clang for vector extensions
set(CMAKE_C_COMPILER_INIT "clang")
set(CMAKE_CXX_COMPILER_INIT "clang")
project(openorbit)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH})
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Analyse Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
# Require SDL and OpenGL on non OS X targets
if (NOT APPLE)
find_package(SDL REQUIRED)
find_package(SDL_ttf QUIET)
endif (NOT APPLE)
if (APPLE)
find_library(IOKIT IOKit)
find_library(OBJC objc)
find_library(COCOA Cocoa)
if (NOT IOKIT)
message(FATAL_ERROR "cannot find IOKit.framework")
endif (NOT IOKIT)
if (NOT OBJC)
message(FATAL_ERROR "cannot find objc runtime")
endif (NOT OBJC)
if (NOT COCOA)
message(FATAL_ERROR "cannot find Cocoa.framework")
endif (NOT COCOA)
endif (APPLE)
find_package(OpenGL REQUIRED)
find_package(OpenAL REQUIRED)
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
find_package(SWIG REQUIRED)
find_package(freetype REQUIRED)
find_package(libxml2 REQUIRED)
find_library(LIBJANSSON jansson)
if (NOT LIBJANSSON)
message(FATAL_ERROR "cannot find libjansson")
endif (NOT LIBJANSSON)
find_library(LIBEDIT edit)
if (NOT LIBEDIT)
message(FATAL_ERROR "cannot find libedit")
endif (NOT LIBEDIT)
# TODO: Download missing packages, i.e. sdl, ode et.al.
# file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log])
# Enable later when sound system has been added
# find_package(OpenAL REQUIRED)
# Some binary I/O must know if byte-swapping is needed
include(TestBigEndian)
test_big_endian(BIG_ENDIAN)
# Need python libraries, and also the pyrexc compiler
find_package(PythonLibs REQUIRED)
if (APPLE)
include(cmake/InstallMacRes.txt)
endif (APPLE)
# TODO: Support more compilers
# TODO: Move compiler flags to file in cmake/arch-flags.cmake
include(cmake/arch-flags.cmake)
include_directories(include)
include_directories(${FREETYPE_INCLUDE_DIRS})
include_directories(${LIBXML2_INCLUDE_DIR})
add_subdirectory(lib)
add_subdirectory(scripts)
add_subdirectory(src)
add_subdirectory(include)
# Add docs target if we have doxygen
# Optionally add documentation target if we have Doxygen available
find_package(Doxygen)
if (DOXYGEN_FOUND)
# Try to locate dot, if available we use it to generate call graphs
find_program(DOT_EXECUTABLE dot)
if (DOT_EXECUTABLE)
set(DOT_FOUND "YES")
set(DOT_PATH "${DOT_EXECUTABLE}")
else (DOT_EXECUTABLE)
set(DOT_FOUND "NO")
set(DOT_PATH "")
endif (DOT_EXECUTABLE)
# Configure the doxygen file
set(DOXYGEN_CONFIG "${CMAKE_BINARY_DIR}/Doxyfile")
configure_file( "${CMAKE_SOURCE_DIR}/Doxyfile.in"
"${DOXYGEN_CONFIG}"
@ONLY)
if (NOT TARGET docs)
add_custom_target(docs ${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIG}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif (NOT TARGET docs)
endif (DOXYGEN_FOUND)
# Locate libcheck, we cannot build tests without it.
find_path(LIBCHECK_INCLUDE_DIR check.h)
find_library(LIBCHECK_LIBRARY check)
if (LIBCHECK_LIBRARY AND LIBCHECK_INCLUDE_DIR)
enable_testing()
if(NOT TARGET check)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
endif(NOT TARGET check)
add_subdirectory(tests)
endif (LIBCHECK_LIBRARY AND LIBCHECK_INCLUDE_DIR)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Orbit, an interactive modular space flight simulator")
set(CPACK_PACKAGE_VENDOR "Mattias Holm")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.org")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.org")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "1")
include(CPack)