-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
99 lines (83 loc) · 4.13 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(horus_eye CXX C)
IF(MSVC AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
ENDIF()
IF (UNIVERSAL)
# Necessary for a Mac Universal Binary
SET (CMAKE_OSX_ARCHITECTURES ppc;i386;x86_64)
SET (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
SET (MACOSX_DEPLOYMENT_TARGET 10.5)
ENDIF (UNIVERSAL)
if((NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) AND (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/.gitignore"))
# Don't polute the git repository with the generated files for out-of-source builds
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/.gitignore "*")
endif()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND UNIVERSAL)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=10.5")
ENDIF()
if(ANDROID)
if(${ANDROID_NATIVE_API_LEVEL} LESS 9)
message(FATAL_ERROR "ANDROID_NATIVE_API_LEVEL must be at least 9")
endif()
else()
macro(find_host_package)
find_package(${ARGN})
endmacro(find_host_package)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
MESSAGE("== Horus Eye ==")
find_host_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --always
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE horus_eye_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE GIT_DESCRIBE_SUCCESS)
if(NOT ${GIT_DESCRIBE_SUCCESS} EQUAL 0)
# Source is not in a git repository
set(horus_eye_VERSION "Unknown version")
endif()
else(GIT_FOUND)
set(horus_eye_VERSION "Unknown version")
endif(GIT_FOUND)
set(RESOURCES_VERSION jsonmetadata)
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/resources-${RESOURCES_VERSION}.tar.gz)
if(GIT_FOUND)
message("= Downloading resources file version '${RESOURCES_VERSION}'...")
execute_process(COMMAND ${GIT_EXECUTABLE} archive --remote=git://uspgamedev.org/horus-resources.git
-o ${CMAKE_CURRENT_BINARY_DIR}/resources-${RESOURCES_VERSION}.tar.gz ${RESOURCES_VERSION} resources/ )
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${CMAKE_CURRENT_BINARY_DIR}/resources-${RESOURCES_VERSION}.tar.gz
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data")
else(GIT_FOUND)
message("-- WARNING: Git not found, unable to download resources.")
endif(GIT_FOUND)
endif()
# FindUGDK
option(HORUSEYE_INTERNAL_UGDK "Set to ON to use an internal UGDK instead of the system one." ON)
option(HORUSEYE_FORCE_SUBMODULE "Set to ON to force git submodule update whenever cmake is ran." ON)
if(NOT HORUSEYE_INTERNAL_UGDK)
find_package(UGDK)
if(NOT UGDK_FOUND)
set(HORUSEYE_INTERNAL_UGDK ON CACHE BOOL "Set to ON to use an internal UGDK instead of the system one." FORCE)
message(FATAL_ERROR "Unable to find UGDK, forcing internal. Please, re-run CMake.")
endif(NOT UGDK_FOUND)
include_directories(${UGDK_INCLUDE_DIRS})
set(UGDK_EXTERNAL_LIBRARIES ${UGDK_LIBRARIES})
else(NOT HORUSEYE_INTERNAL_UGDK)
if(HORUSEYE_FORCE_SUBMODULE OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/externals/ugdk/CMakeLists.txt")
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
else(GIT_FOUND)
message(FATAL_ERROR "Git submodule 'externals/ugdk' not initialized and git not found.")
endif(GIT_FOUND)
endif()
set(UGDK_BUILD_TESTS ON CACHE BOOL "Set to ON to enable building tests.")
set(UGDK_BUILD_EXAMPLES OFF CACHE BOOL "Set to ON to enable building examples.")
add_definitions(-DEMBBEDED_UGDK="${CMAKE_CURRENT_BINARY_DIR}/externals/ugdk")
add_subdirectory(externals/ugdk EXCLUDE_FROM_ALL)
include_directories(${UGDK_EXTERNAL_INCLUDE_DIRS})
set(UGDK_EXTERNAL_LIBRARIES libugdk)
endif(NOT HORUSEYE_INTERNAL_UGDK)
add_subdirectory(src) # The game binary.
add_ugdk_android_project(horus_eye "Horus Eye" "org.uspgamedev.horuseye")