-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (36 loc) · 1.41 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
cmake_minimum_required(VERSION 3.0)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory("${CMAKE_SOURCE_DIR}/frontend/GLFW/glfw-3.2.1/")
add_subdirectory("${CMAKE_SOURCE_DIR}/OpenGlBackend/")
add_executable(graphics
frontend/main.cpp
frontend/Entity.cpp
frontend/window.cpp
frontend/State.cpp
)
target_include_directories (graphics
PRIVATE "frontend/"
PUBLIC "OpenGlBackend/"
PUBLIC "OpenGlBackend/GLAD/include/"
)
target_link_libraries(graphics GLBackend glfw)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
find_package(OpenGL)
string (REPLACE "/" "\\" SOURCE_DIR "${CMAKE_SOURCE_DIR}")
add_custom_command(TARGET graphics
POST_BUILD
COMMAND IF NOT EXIST \"$(TargetDir)Resources\" mkdir \"$(TargetDir)Resources\"
COMMAND echo D | xcopy "${SOURCE_DIR}\\frontend\\Resources" \"$(TargetDir)Resources\" /D /E /I /Y
COMMENT "Copying resources to build directory..."
)
else()
add_custom_command(TARGET graphics
POST_BUILD
COMMAND [ -d "${CMAKE_BINARY_DIR}/Resources" ] || mkdir "${CMAKE_BINARY_DIR}/Resources"
COMMAND cp --verbose --update --preserve=mode,ownership,timestamps --recursive "${CMAKE_SOURCE_DIR}/frontend/Resources/*" "${CMAKE_BINARY_DIR}/Resources"
COMMENT "Copying resources to build directory..."
)
endif()