-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
58 lines (47 loc) · 1.38 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
cmake_minimum_required(VERSION 3.15)
# Project name and version
project(GHDgui VERSION 1.0)
# O3 optimization
if(MSVC)
# MSVC-specific release flags
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG")
else()
# Flags for GCC/Clang
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
endif()
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find required packages
find_package(OpenGL REQUIRED)
# Header Files
file(GLOB PROJECT_HEADERS src/*.h
src/*.hpp)
# Source Files
file(GLOB PROJECT_SOURCES src/*.cpp)
# ImGui source files
file(GLOB IMGUI_SOURCES vendor/imgui/*.cpp)
# Add the include directories
include_directories(
vendor
vendor/imgui
vendor/glfw/include
vendor/glad/include
)
# Add GLFW library
add_subdirectory(vendor/glfw)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) # don't build docs
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) # don't build tests
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build examples
# Add glad as a library
add_library(glad STATIC vendor/glad/src/glad.c)
target_include_directories(glad PUBLIC vendor/glad/include)
# Add the main executable
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${IMGUI_SOURCES})
# Link libraries
target_link_libraries(${PROJECT_NAME} PRIVATE
glad
glfw
${GLFW_LIBRARIES}
${OPENGL_LIBRARIES}
)