-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (38 loc) · 1.33 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
cmake_minimum_required(VERSION 3.13.4)
project(MainProject)
set (CMAKE_CXX_STANDARD 20)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(BUILD_RPATH_USE_ORIGIN TRUE)
# add_compile_definitions(GLFW_INCLUDE_NONE TRUE)
add_compile_definitions(DEBUG)
macro(add_gl EXECUTABLE_NAME)
target_include_directories(${EXECUTABLE_NAME}
PUBLIC external/glfw/include
PUBLIC external/glad/include
)
target_link_directories(${EXECUTABLE_NAME}
PRIVATE external/glfw/src
PRIVATE external/glad/src
)
target_link_libraries(${EXECUTABLE_NAME} glfw glad GL X11 pthread Xrandr Xi dl)
endmacro(add_gl)
function(set_target_dir TARGET SUBDIR)
set_target_properties( ${TARGET}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SUBDIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SUBDIR}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${SUBDIR}"
)
endfunction(set_target_dir TARGET SUBDIR)
add_subdirectory(examples/0_hello_triangle/)
add_subdirectory(examples/1_shaders/)
add_subdirectory(examples/2_textures/)
add_subdirectory(examples/3_transformations/)
subdirs(
external/glfw
external/glad
external/glm
src/
)