-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
30 lines (26 loc) · 911 Bytes
/
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
cmake_minimum_required(VERSION 3.24)
project(project0)
include(FetchContent)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.6.x
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(SFML)
file(GLOB GLSL_SHADERS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src
src/*.vert src/*.frag)
set(SHADER_FILES "")
foreach(SHADER ${GLSL_SHADERS})
add_custom_command(
OUTPUT "${SHADER}.o"
COMMAND objcopy -I binary -O elf64-x86-64 -B i386
"${SHADER}" "${CMAKE_CURRENT_BINARY_DIR}/${SHADER}.o"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/${SHADER}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
)
list(APPEND SHADER_FILES "${SHADER}.o")
endforeach()
file(GLOB SOURCE_FILES src/*.cpp)
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${SHADER_FILES})
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-graphics)