-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (64 loc) · 2.29 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
cmake_minimum_required(VERSION 3.10)
project(Hazel)
set(CMAKE_CXX_STANDARD 14)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin/debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin/release)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
link_directories(${PROJECT_SOURCE_DIR}/lib)
# ##############################################################################
# Hazel
# ##############################################################################
# spdlog add_subdirectory(hazel/vendor/spdlog)
include_directories(hazel/vendor/spdlog/include)
# glad
set(GLAD_SRC hazel/vendor/glad/src/glad.c)
if (NOT WIN32)
list(APPEND LIBS dl)
else ()
list(APPEND LIBS Opengl32)
endif (NOT WIN32)
include_directories(hazel/vendor/glad/include)
# glfw
option(GLFW_BUILD_DOCS OFF)
option(GLFW_BUILD_EXAMPLES OFF)
option(GLFW_BUILD_TESTS OFF)
add_subdirectory(hazel/vendor/glfw)
include_directories(hazel/vendor/glfw/include)
list(APPEND LIBS glfw ${GLFW_LIBRARIES})
# Imgui
include_directories(hazel/vendor/imgui)
# glm
include_directories(hazel/vendor/glm)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DHZ_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DHZ_DEBUG")
include_directories(hazel/src)
# stb_image
include_directories(hazel/vendor/stb_image)
file(
GLOB
HZ_SRC
"hazel/src/hazel/core/*.cpp"
"hazel/src/hazel/debug/*.cpp"
"hazel/src/hazel/imgui/*.cpp"
"hazel/src/hazel/renderer/*.cpp"
"hazel/src/platform/windows/*.cpp"
"hazel/src/platform/opengl/*.cpp"
"hazel/vendor/imgui/*.cpp"
"hazel/vendor/stb_image/*.cpp")
add_library(hazel STATIC ${HZ_SRC} ${GLAD_SRC})
target_link_libraries(hazel PUBLIC ${LIBS})
# ##############################################################################
# Sandbox
# ##############################################################################
file(GLOB SANDBOX_SRC
"sandbox/src/*.cpp")
add_executable(sandbox ${SANDBOX_SRC})
target_link_libraries(sandbox PUBLIC hazel ${LIBS})
add_custom_command(TARGET sandbox
PRE_BUILD
COMMAND ${CMAKE_COMMAND}
-E copy_directory
${PROJECT_SOURCE_DIR}/sandbox/assets
$<TARGET_FILE_DIR:sandbox>/assets
)