-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
109 lines (89 loc) · 2.5 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
cmake_minimum_required(VERSION 3.5)
project(binocle)
# Policies
if("${CMAKE_VERSION}" VERSION_GREATER 3.5)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0025 NEW)
endif()
# cmake modules directory
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Enables CMake database for YCM
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
# Enables CMake debugging with VSCode
include(CMakeToolsHelpers OPTIONAL)
# Skip the platform compiler checks for cross compiling
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
# Add our own DEBUG define for Debug build types
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
# Registers build options that are exposed to cmake
include(CMakeOptions.txt)
if(BINOCLE_LUAJIT)
add_definitions(-DBINOCLE_LUAJIT)
endif ()
if(BINOCLE_SHOW_CONSOLE)
add_definitions(-DBINOCLE_SHOW_CONSOLE)
endif()
if(BINOCLE_LOG_MEMORY_ALLOCATIONS)
add_definitions(-DBINOCLE_LOG_MEMORY_ALLOCATIONS)
endif()
include(BinocleUtils)
SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "2")
SET(VERSION_PATCH "1")
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set(BINOCLE_LINK_LIBRARIES binocle-static)
#if (EMSCRIPTEN)
# set(BINOCLE_LINK_LIBRARIES binocle-static lua)
#endif()
#
#if (APPLE AND NOT IOS)
# set(BINOCLE_LINK_LIBRARIES binocle-static luajit-5.1)
#endif()
#
#if (IOS)
# set(BINOCLE_LINK_LIBRARIES binocle-static lua)
#endif()
#
#if (ANDROID)
# set(BINOCLE_LINK_LIBRARIES binocle-static luajit-5.1)
#endif()
#
#if (MSVC)
# set(BINOCLE_LINK_LIBRARIES binocle-static luajit-5.1)
#endif()
if (MSVC)
message("Including Windows defines")
include(BinocleWindows)
elseif(APPLE AND NOT ANDROID)
if(IOS)
message("Including iOS defines")
include(BinocleIOS)
elseif (WATCHOS)
message("Including watchOS defines")
include(BinocleWatchOS)
else()
message("Including Mac defines")
include(BinocleMac)
endif()
elseif(ANDROID)
message("Including Android defines")
include(BinocleAndroid)
elseif(EMSCRIPTEN)
message("Setting BINOCLE_DATA_DIR before including web settings")
set(BINOCLE_DATA_DIR "${CMAKE_SOURCE_DIR}/assets/")
message("Including Emscripten defines")
include(BinocleWeb)
endif()
message("Including documentation defines")
include(BinocleDocs)
if(BUILD_DOC)
return()
endif()
add_subdirectory(src)
if (${BUILD_EXAMPLE})
message("Building example project is enabled")
add_subdirectory(example)
endif()
message("Linking with the following libraries: ${BINOCLE_LINK_LIBRARIES}")