-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (59 loc) · 2.32 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
cmake_minimum_required(VERSION 3.19.3)
project(MANDEL)
include(cmake/CompilerWarnings.cmake)
set(MANDEL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(MANDEL_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(
HEADER_FILES
"${MANDEL_INCLUDE_DIR}/utility.hpp"
"${MANDEL_INCLUDE_DIR}/buffer_object.hpp"
"${MANDEL_INCLUDE_DIR}/mandel.hpp"
"${MANDEL_INCLUDE_DIR}/shader.hpp"
"${MANDEL_INCLUDE_DIR}/uniform.hpp"
"${MANDEL_INCLUDE_DIR}/vertex_array_object.hpp"
"${MANDEL_INCLUDE_DIR}/mandel_handler.hpp"
"${MANDEL_INCLUDE_DIR}/pch.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/imgui_backend/imgui_impl_glfw.h"
"${CMAKE_CURRENT_SOURCE_DIR}/imgui_backend/imgui_impl_opengl3.h"
)
set(
SRC_FILES
"${MANDEL_SRC_DIR}/buffer_object.cpp"
"${MANDEL_SRC_DIR}/main.cpp"
"${MANDEL_SRC_DIR}/mandel.cpp"
"${MANDEL_SRC_DIR}/shader.cpp"
"${MANDEL_SRC_DIR}/utility.cpp"
"${MANDEL_SRC_DIR}/vertex_array_object.cpp"
"${MANDEL_SRC_DIR}/mandel_handler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/imgui_backend/imgui_impl_glfw.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/imgui_backend/imgui_impl_opengl3.cpp"
)
add_executable(mandel ${SRC_FILES} ${HEADER_FILES} ${GLEW_SRC_FILES} ${IMGUI_SRC_FILES})
set_project_warnings(mandel OFF)
target_compile_definitions(mandel PRIVATE _DEBUG=1)
target_compile_definitions(mandel PRIVATE IMGUI_IMPL_OPENGL_LOADER_GLEW=1) # setup imgui with glew
target_compile_definitions(mandel PRIVATE GLEW_STATIC=1) # use static
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
target_link_libraries(mandel PRIVATE GLEW::GLEW)
find_package(imgui CONFIG REQUIRED)
target_link_libraries(mandel PRIVATE imgui::imgui)
find_package(glfw3 CONFIG REQUIRED)
target_link_libraries(mandel PRIVATE glfw)
target_include_directories(mandel PRIVATE
${MANDEL_INCLUDE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/imgui_backend"
)
set_target_properties(
mandel PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)
# copy res file to executable directory
add_custom_command(TARGET mandel POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/res"
"$<TARGET_FILE_DIR:mandel>/res")
if (CMAKE_CXX_COMPILE_ID STREQUAL "GNU")
target_compile_options(mandel PRIVATE "-static-libgcc -static-libstdc++ -mwindows")
endif()