-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (41 loc) · 1.42 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
# Variables
set(TARGET shadertoy)
# Project setup
cmake_minimum_required(VERSION 3.1.0)
project(${TARGET} C CXX)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
set(CMAKE_BUILD_TYPE Debug)
# Target configuration
file(GLOB_RECURSE FILES
${CMAKE_CURRENT_LIST_DIR}/src/*.c
${CMAKE_CURRENT_LIST_DIR}/src/*.cpp
${CMAKE_CURRENT_LIST_DIR}/src/*.h)
add_executable(${TARGET} ${FILES})
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
# GLSL compilation
#add_custom_target(GLSL_COMPILE COMMAND ${CMAKE_CURRENT_LIST_DIR}/glsl_compile.sh)
#add_dependencies(${TARGET} GLSL_COMPILE)
# Find SFML
find_package(SFML 2 REQUIRED graphics window system)
if (SFML_FOUND)
target_include_directories(${TARGET} PRIVATE ${SFML_INCLUDE_DIR})
target_link_libraries(${TARGET} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
else()
message(FATAL_ERROR "Failed to find SFML")
endif()
# Find GLEW
#find_package(GLEW REQUIRED)
#if (GLEW_FOUND)
# target_include_directories(${TARGET} PRIVATE ${GLEW_INCLUDE_DIR})
# target_link_libraries(${TARGET} ${GLEW_LIBRARIES})
#else()
# message(FATAL_ERROR "Failed to find GLEW")
#endif()
# Find OpenGL
find_package(OpenGL REQUIRED)
if (OPENGL_FOUND)
target_include_directories(${TARGET} PRIVATE ${OPENGL_INCLUDE_DIR})
target_link_libraries(${TARGET} ${OPENGL_LIBRARIES})
else()
message(FATAL_ERROR "Failed to find OpenGL")
endif()