-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
92 lines (74 loc) · 2.48 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
cmake_minimum_required(VERSION 3.20.0 FATAL_ERROR)
project(game)
# Clang deez nuts
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Include debug information
set(CMAKE_BUILD_TYPE Debug)
# Variables for Paths of External Libraries
set(GLFW_ROOT_DIR external/glfw)
set(GLAD_ROOT_DIR external/glad)
set(GLM_ROOT_DIR external/glm)
set(IMGUI_ROOT_DIR external/imgui)
set(FREETYPE_ROOT_DIR external/freetype)
set(ASSIMP_ROOT_DIR external/assimp)
# Add all Header Files
file(GLOB_RECURSE HEADER_FILES
${CMAKE_SOURCE_DIR}/include/*.h
${CMAKE_SOURCE_DIR}/include/*.hpp
)
IF (WIN32)
# Windows libraries:
find_package(OpenGL REQUIRED)
set(LIBS glfw opengl32 glad glm freetype assimp)
file(GLOB_RECURSE SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/*.cpp
# ${CMAKE_SOURCE_DIR}/platform/windows.cpp
# IMGUI
${IMGUI_ROOT_DIR}/imgui.cpp
${IMGUI_ROOT_DIR}/imgui_demo.cpp
${IMGUI_ROOT_DIR}/imgui_draw.cpp
${IMGUI_ROOT_DIR}/imgui_tables.cpp
${IMGUI_ROOT_DIR}/imgui_widgets.cpp
${IMGUI_ROOT_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_ROOT_DIR}/backends/imgui_impl_glfw.cpp
)
ELSE()
# Linux libraries:
set(LIBS glfw X11 glad glm freetype assimp)
file(GLOB_RECURSE SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/*.cpp
# ${CMAKE_SOURCE_DIR}/platform/linux.cpp
# IMGUI
${IMGUI_ROOT_DIR}/imgui.cpp
${IMGUI_ROOT_DIR}/imgui_demo.cpp
${IMGUI_ROOT_DIR}/imgui_draw.cpp
${IMGUI_ROOT_DIR}/imgui_tables.cpp
${IMGUI_ROOT_DIR}/imgui_widgets.cpp
${IMGUI_ROOT_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_ROOT_DIR}/backends/imgui_impl_glfw.cpp
)
ENDIF()
add_executable(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
# Add the External Libraries / Files Directory
add_subdirectory(${GLFW_ROOT_DIR})
add_subdirectory(${GLAD_ROOT_DIR})
add_subdirectory(${GLM_ROOT_DIR})
add_subdirectory(${FREETYPE_ROOT_DIR})
add_subdirectory(${ASSIMP_ROOT_DIR})
target_include_directories(${PROJECT_NAME}
PUBLIC ${GLFW_ROOT_DIR}/include
PUBLIC ${GLAD_ROOT_DIR}/include/glad
PUBLIC ${GLM_ROOT_DIR}/include
PUBLIC ${FREETYPE_ROOT_DIR}/include
PUBLIC ${ASSIMP_ROOT_DIR}/include
PUBLIC ${IMGUI_ROOT_DIR}
PUBLIC ${IMGUI_ROOT_DIR}/backends
PUBLIC .
)
target_link_directories(${PROJECT_NAME}
PRIVATE ${GLFW_ROOT_DIR}/src
PRIVATE ${GLAD_ROOT_DIR}/src
PRIVATE ${GLM_ROOT_DIR}/src
PUBLIC ${FREETYPE_ROOT_DIR}/include
)
target_link_libraries(${PROJECT_NAME} ${LIBS})