-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
60 lines (49 loc) · 1.84 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
cmake_minimum_required(VERSION 3.23.0)
project(cae VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 20)
set(PROFILE FALSE)
if (PROFILE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
if (APPLE)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-omit-leaf-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-omit-leaf-frame-pointer")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
endif ()
endif ()
endif ()
find_package(OpenGL REQUIRED)
find_package(SDL2 REQUIRED)
if (SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
endif ()
set(GLM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/libs/glm/include)
set(GLAD_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/libs/glad/include)
set(STB_IMAGE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/libs/image/include)
set(KHR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/libs/KHR/include)
set(GLAD
${CMAKE_CURRENT_SOURCE_DIR}/libs/glad/src/glad.c
${CMAKE_CURRENT_SOURCE_DIR}/libs/glad/include/glad/glad.h)
set(STB_IMAGE
${CMAKE_CURRENT_SOURCE_DIR}/libs/image/src/stb_image.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/image/include/image/stb_image.h)
file(GLOB_RECURSE IMGUI "libs/imgui/*")
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*)
set(COMPILATION_UNIT
src/main.cpp
${GLAD}
${STB_IMAGE}
${IMGUI}
${SOURCES}
)
add_executable(${PROJECT_NAME} ${COMPILATION_UNIT})
target_include_directories(${PROJECT_NAME} PUBLIC
${GLAD_INCLUDE_DIRS}
${GLM_INCLUDE_DIRS}
${STB_IMAGE_INCLUDE_DIRS}
${KHR_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME} OpenGL::GL ${SDL2_LIBRARIES})