-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (56 loc) · 2.33 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
#FILE: /CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(Lucent)
# Enable c++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# Dependencies directory
set(LucentDependencies ${PROJECT_SOURCE_DIR}/deps)
# Include dirs
set(ALL_DEP_INCLUDES ${LucentDependencies}/include/All
${LucentDependencies}/external)
# Include our source files
set(OUR_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(OUR_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${OUR_SRC_DIR} ${OUR_INC_DIR})
# Dependencies
# OpenGL
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})
if(WIN32)
set(WIN_DEP_INCLUDES ${LucentDependencies}/include/Windows)
# Set libraries (TODO: Doesnt seem to work properly always making release being used FIX)
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
set(ASSIMP_LIBRARIES ${LucentDependencies}/lib/x86/Debug/assimp-vc140-mt.lib)
set(GLEW_LIBRARIES ${LucentDependencies}/lib/x86/Debug/glew32d.lib)
set(FREETYPE_LIBRARIES ${LucentDependencies}/lib/x86/Debug/freetype28d.lib)
else()
set(ASSIMP_LIBRARIES ${LucentDependencies}/lib/x86/Release/assimp-vc140-mt.lib)
set(GLEW_LIBRARIES ${LucentDependencies}/lib/x86/Release/glew32.lib)
set(FREETYPE_LIBRARIES ${LucentDependencies}/lib/x86/Release/freetype28.lib)
endif()
# Set SDL2_LIBRARY manually
set(SDL2_LIBRARY ${LucentDependencies}/lib/x86/SDL2.lib ${LucentDependencies}/lib/x86/SDL2main.lib)
# Include our local dependencies for windows
include_directories(${ALL_DEP_INCLUDES} ${WIN_DEP_INCLUDES})
elseif(UNIX)
# Add Module Path
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMAKE)
# Sets SDL2_INCLUDE_DIR and SDL2_LIBRARY
find_package(SDL2 REQUIRED)
# Sets GLEW libraries and includes
find_package(GLEW REQUIRED)
# Sets ASSIMP_FOUND, ASSIMP_INCLUDE_DIRS, ASSIMP_LIBRARIES
find_package(ASSIMP REQUIRED)
# Find FreeType library
find_package(Freetype REQUIRED)
if(ASSIMP_FOUND MATCHES NOT_FOUND)
message(FATAL_ERROR "Did not find ASSIMP, do you have it installed?")
elseif(ASSIMP_FOUND MATCHES FOUND)
message(STATUS "Successfully located assimp!")
endif()
# Include the found path for our deps on UNIX
include_directories(${ASSIMP_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${ALL_DEP_INCLUDES})
endif()
# Setup submodules
add_subdirectory(deps/external)
add_subdirectory(src)