Initial commit
This commit is contained in:
commit
686dcaf351
68 changed files with 6230 additions and 0 deletions
61
CMakeLists.txt
Normal file
61
CMakeLists.txt
Normal file
|
@ -0,0 +1,61 @@
|
|||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
# Set project name
|
||||
project(shaderpipeline)
|
||||
|
||||
# Check for C++17 support
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
if(COMPILER_SUPPORTS_CXX17)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
else()
|
||||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
|
||||
endif()
|
||||
|
||||
# Add headers
|
||||
include_directories("include/")
|
||||
|
||||
# OpenGL library
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
# Add Glad
|
||||
add_library(glad "glad.c")
|
||||
include_directories(include)
|
||||
|
||||
# Check if GLFW and Eigen are not empty
|
||||
file(GLOB GLFW_DIR lib/glfw/*)
|
||||
list(LENGTH GLFW_DIR NR_FILES_IN_GLFW_DIR)
|
||||
if(NR_FILES_IN_GLFW_DIR LESS_EQUAL 1)
|
||||
message(WARNING "Did you forget git submodule update --init --recursive ?")
|
||||
endif()
|
||||
|
||||
# Add GLFW as a submodule
|
||||
add_subdirectory(lib/glfw)
|
||||
include_directories(lib/glfw/include)
|
||||
|
||||
# Add Eigen as a submodule
|
||||
add_subdirectory(lib/eigen)
|
||||
include_directories(lib/eigen)
|
||||
|
||||
# Define the glsl files
|
||||
# Note: ${RESOURCEFILES} is not used, since it is not part of the C++ compilation step.
|
||||
# If you use an extension to your IDE that provides syntax highlighting etc for OpenGL,
|
||||
# you might need to add ${RESOURCEFILES} in add_executable().
|
||||
file(GLOB RESOURCEFILES "src/*" "glsl/*")
|
||||
|
||||
# Add c++ files
|
||||
set(SOURCES main.cpp glHelper.h)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
#add_executable(${PROJECT_NAME} ${SOURCES} ${RESOURCEFILES}) # in case you need the glsl files for an IDE extension
|
||||
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} glfw ${OPENGL_gl_LIBRARY} glad)
|
||||
|
||||
# make the current path available to the source code
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC CMAKELISTS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
# if using Visual Studio, set the startup project
|
||||
if(MSVC)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
|
||||
endif()
|
Reference in a new issue