-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (53 loc) · 2.44 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
cmake_minimum_required(VERSION 3.0)
project(Glitter)
option(GLFW_BUILD_DOCS OFF)
option(GLFW_BUILD_EXAMPLES OFF)
option(GLFW_BUILD_TESTS OFF)
add_subdirectory(Glitter/Vendor/glfw)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -std=c++11 -O3")
if(NOT WIN32)
set(GLAD_LIBRARIES dl)
endif()
endif()
include_directories(Glitter/Headers/
Glitter/Vendor/glad/include/
Glitter/Vendor/glfw/include/
Glitter/Vendor/glm/
Glitter/Vendor/stb/)
file(GLOB VENDORS_SOURCES Glitter/Vendor/glad/src/glad.c)
file(GLOB PROJECT_HEADERS Glitter/Headers/*.hpp)
file(GLOB PROJECT_SOURCES Glitter/Sources/*.cpp)
file(GLOB PROJECT_SHADERS Glitter/Shaders/*.comp
Glitter/Shaders/*.frag
Glitter/Shaders/*.geom
Glitter/Shaders/*.vert)
file(GLOB PROJECT_CONFIGS CMakeLists.txt
Readme.md
.gitattributes
.gitignore
.gitmodules)
source_group("Headers" FILES ${PROJECT_HEADERS})
source_group("Shaders" FILES ${PROJECT_SHADERS})
source_group("Sources" FILES ${PROJECT_SOURCES})
source_group("Vendors" FILES ${VENDORS_SOURCES})
add_definitions(-DGLFW_INCLUDE_NONE
-DPROJECT_SOURCE_DIR=\"${PROJECT_SOURCE_DIR}\")
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS}
${PROJECT_SHADERS} ${PROJECT_CONFIGS}
${VENDORS_SOURCES} Glitter/Sources/State.cpp Glitter/Sources/State.h Glitter/Sources/shader.cpp Glitter/Sources/shader.h Glitter/Sources/resourcemanager.cpp Glitter/Sources/resourcemanager.h Glitter/Sources/EntityRenderer.cpp Glitter/Sources/EntityRenderer.h Glitter/Sources/Boid.cpp Glitter/Sources/Boid.h)
find_package(OpenMP REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC
glfw
${GLFW_LIBRARIES} ${GLAD_LIBRARIES}
OpenMP::OpenMP_CXX)
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME})
if (OPENMP_FOUND)
endif()
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Glitter/Shaders $<TARGET_FILE_DIR:${PROJECT_NAME}>
DEPENDS ${PROJECT_SHADERS})