-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (53 loc) · 1.79 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
cmake_minimum_required(VERSION 3.1)
project(main C CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
option(DEBUG "output debug information")
IF(WIN32)
set(SDL2_DIR lib/sdl2)
list(APPEND CMAKE_PREFIX_PATH lib/glew)
list(APPEND CMAKE_PREFIX_PATH lib/glut)
set(GLUT_INCLUDE_DIR lib/glut/include)
set(GLEW_INCLUDE_DIR lib/glew/include)
ENDIF()
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
find_package(SDL2 REQUIRED)
find_library(SDL2_LIBRARY REQUIRED)
if(DEBUG)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
endif()
set(PACKAGE_DIRS
${OPENGL_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${SDL2_INCLUDE_DIRS}
)
set(PACKAGE_LIBS
${OPENGL_LIBRARY}
${GLUT_LIBRARY}
${GLEW_LIBRARY}
${SDL2_LIBRARIES}
)
include_directories(${PACKAGE_DIRS})
file(GLOB_RECURSE SRC_HDR include/*.h include/Windows/*.h include/Scene/*.h include/Renderer/*.h include/Camera/*.h lib/tinyxml2/tinyxml2.h, lib/glm/glm/**/**.hpp)
file(GLOB_RECURSE SRC_CPP src/*.cpp src/Camera/*.cpp src/Scene/*.cpp lib/tinyxml2/tinyxml2.cpp)
add_executable(main main.cpp ${SRC_HDR}
${SRC_CPP})
target_link_libraries(main ${PACKAGE_LIBS})
IF(WIN32)
foreach( dll ${SDL2_DLLS})
add_custom_command(TARGET main POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${dll}
$<TARGET_FILE_DIR:main>)
endforeach(dll )
endif()
add_custom_command(TARGET main POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets $<TARGET_FILE_DIR:main>/assets)