forked from OctaForge/OF-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
91 lines (81 loc) · 2.71 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
# OCtaForge CMakeLists.txt
# written for all platforms OF covers
#
# author: Daniel 'q66' Kolesa <[email protected]>
# license: see COPYING.txt
cmake_minimum_required(VERSION 2.6)
project(OctaForge)
option(OF_LUAJIT_LOCAL "LuaJIT is stored locally in platform_OS" OFF)
option(OF_SDL2_LOCAL "SDL2 is stored locally in platform_OS" OFF)
option(OF_BUILD_AMALG "Build an amalgamated variant" OFF)
option(OF_OVR "Oculus Rift support" OFF)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OF_TARGET_ARCH "x64")
set(OF_TARGET_X64 1)
else()
set(OF_TARGET_ARCH "x86")
set(OF_TARGET_X86 1)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(OF_TARGET_OS "Windows")
set(OF_TARGET_WINDOWS 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(OF_TARGET_OS "Linux")
set(OF_TARGET_LINUX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(OF_TARGET_OS "OSX")
set(OF_TARGET_OSX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(OF_TARGET_OS "FreeBSD")
set(OF_TARGET_FREEBSD 1)
else()
message(FATAL_ERROR "Unsupported OS: ${CMAKE_SYSTEM_NAME}")
endif()
if(OF_TARGET_WINDOWS)
if(MSVC)
set(OF_CXX_FLAGS "/EHsc /MT")
else()
set(OF_CXX_FLAGS "-fomit-frame-pointer -ffast-math -Wall -fsigned-char")
endif()
include_directories(src/platform_windows/include)
set(OF_PLATFORM_SRC "windows")
set(OF_PLATFORM_BIN "win")
elseif(OF_TARGET_OSX)
set(OF_CXX_FLAGS "-fomit-frame-pointer -ffast-math -Wall -fsigned-char")
include_directories(src/platform_osx/include)
set(OF_PLATFORM_SRC "osx")
set(OF_PLATFORM_BIN "darwin")
set(CMAKE_FRAMEWORK_PATH src/platform_osx/Frameworks)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
else()
set(OF_CXX_FLAGS "-fomit-frame-pointer -ffast-math -Wall -fsigned-char")
if(OF_TARGET_LINUX)
set(OF_PLATFORM_SRC "linux")
set(OF_PLATFORM_BIN "linux")
elseif(OF_TARGET_FREEBSD)
set(OF_PLATFORM_SRC "freebsd")
set(OF_PLATFORM_BIN "freebsd")
elseif(OF_TARGET_SOLARIS)
set(OF_PLATFORM_SRC "solaris")
set(OF_PLATFORM_BIN "solaris")
endif()
endif()
include_directories(src/platform_${OF_PLATFORM_SRC}/include)
if(OF_TARGET_X64)
link_directories(${CMAKE_SOURCE_DIR}/src/platform_${OF_PLATFORM_SRC}/lib64)
else()
link_directories(${CMAKE_SOURCE_DIR}/src/platform_${OF_PLATFORM_SRC}/lib32)
endif()
if(OF_TARGET_WINDOWS)
add_definitions(-DWIN32 -DWINDOWS)
if(OF_TARGET_X64)
add_definitions(-DWIN64)
endif()
endif()
set(OF_C_FLAGS "${OF_CXX_FLAGS}")
if(NOT DEFINED MSVC)
set(OF_CXX_FLAGS "${OF_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OF_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OF_CXX_FLAGS}")
add_subdirectory(src)