-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·75 lines (55 loc) · 2.09 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
cmake_minimum_required(VERSION 3.10)
# -----------------------------------
# - windows file names issue -
# -----------------------------------
file(TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_SOURCE_DIR)
file(TO_CMAKE_PATH ${CMAKE_BINARY_DIR} CMAKE_BINARY_DIR)
# -----------------------------------
# - create project -
# -----------------------------------
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER gcc)
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g")
project(AgeOfAnarchy VERSION 0.0.1)
add_executable(${CMAKE_PROJECT_NAME})
include_directories("lib")
# -----------------------------------
# - set policy for relative paths -
# -----------------------------------
cmake_policy(SET CMP0079 NEW)
cmake_policy(SET CMP0076 NEW)
# -----------------------------------
# - environment control -
# -----------------------------------
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds not allowed. Please run \"cmake ..\" from the build directory. You may need to delete \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" first.")
endif()
# -----------------------------------
# - custom functions -
# -----------------------------------
include(cmake/macros.cmake)
# -----------------------------------
# - macOS specific issues -
# -----------------------------------
if(APPLE)
include_directories("/usr/local/include")
endif()
# -----------------------------------
# - Windows specific issues -
# -----------------------------------
#if(WIN32)
# include_directories("C:/mingw64/x86_64-w64-mingw32/include/")
#endif()
# ------------------------
# - Vulkan setup -
# ------------------------
find_library(VKLIB vulkan HINTS "/usr/local/lib")
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC ${VKLIB})
find_library(GLFWLIB glfw HINTS "/usr/local/opt/glfw/lib")
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC ${GLFWLIB})
# -----------------------------------
# - compilation spec files -
# -----------------------------------
add_subdirectory("lib")
add_subdirectory("resources")
add_subdirectory("src")