This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2024CG-project-render/CMakeLists.txt
github-classroom[bot] 5d6a4935ec
Initial commit
2024-09-26 09:17:55 +00:00

41 lines
1.4 KiB
CMake

cmake_minimum_required(VERSION 3.0)
# name the project/executable
project(raycasting)
# some checks to determine the compiler capabilities, don't worry about this
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
# define the location of the current directory as '${ROOT}'
set(ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
# define the paths to the cpp files
set(SRCFILES
${ROOT}/src/first_hit.cpp
${ROOT}/src/Plane.cpp
${ROOT}/src/Sphere.cpp
${ROOT}/src/Triangle.cpp
${ROOT}/src/TriangleSoup.cpp
${ROOT}/src/viewing_ray.cpp
${ROOT}/main.cpp
)
# pass the SRCFILES files to be included during compilation
add_executable(${PROJECT_NAME} ${SRCFILES})
# the 'include' and 'eigen' folders contain files that also need to be included in the project
include_directories(${ROOT}/include ${ROOT}/eigen)
# if using Visual Studio, set the startup project (because it's sadly not smart enough to do this by itself)
if(MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
endif()