cloudy-raytracer/CMakeLists.txt

67 lines
1.8 KiB
CMake
Raw Normal View History

2022-10-28 09:31:13 +02:00
cmake_minimum_required(VERSION 3.5)
project(CG1_Tracer LANGUAGES CXX)
2022-11-11 14:27:43 +01:00
set(CMAKE_CXX_STANDARD 17)
2022-10-28 09:31:13 +02:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT WIN32)
find_package(Threads REQUIRED)
find_package(X11 REQUIRED)
endif()
# This directory
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if(APPLE)
include_directories(AFTER "/opt/X11/include")
endif()
# which source files to use
file(GLOB common_src "common/*.cpp")
file(GLOB camera_src "camera/*.cpp")
file(GLOB light_src "light/*.cpp")
file(GLOB primitive_src "primitive/*.cpp")
file(GLOB renderer_src "renderer/*.cpp")
file(GLOB scene_src "scene/*.cpp")
file(GLOB shader_src "shader/*.cpp")
# The tracey library
add_library(tracey STATIC ${common_src} ${camera_src} ${light_src}
${primitive_src} ${renderer_src} ${scene_src} ${shader_src})
if(NOT WIN32)
target_link_libraries(tracey ${CMAKE_THREAD_LIBS_INIT} ${X11_LIBRARIES})
endif()
# Executables
add_executable(tracey_ex1 ex1.cpp)
target_link_libraries(tracey_ex1 tracey)
2022-11-11 14:39:48 +01:00
add_executable(tracey_ex2 ex2.cpp)
target_link_libraries(tracey_ex2 tracey)
2022-11-18 11:48:08 +01:00
add_executable(tracey_ex3_1 ex3.cpp)
target_link_libraries(tracey_ex3_1 tracey)
target_compile_definitions(tracey_ex3_1 PUBLIC SITUATION=1)
add_executable(tracey_ex3_2 ex3.cpp)
target_link_libraries(tracey_ex3_2 tracey)
target_compile_definitions(tracey_ex3_2 PUBLIC SITUATION=2)
if("${CMAKE_CURRENT_LIST_DIR}/light/ambientlight.cpp" IN_LIST light_src)
add_definitions(-DAMBIENTLIGHT_FOUND)
endif()
if("${CMAKE_CURRENT_LIST_DIR}/light/spotlight.cpp" IN_LIST light_src)
add_definitions(-DSPOTLIGHT_FOUND)
endif()
if("${CMAKE_CURRENT_LIST_DIR}/primitive/objmodel.cpp" IN_LIST primitive_src)
add_definitions(-DOBJMODEL_FOUND)
endif()
2022-11-25 14:58:29 +01:00
add_executable(tracey_ex4 ex4.cpp)
target_link_libraries(tracey_ex4 tracey)
2022-10-28 09:31:13 +02:00
2022-12-06 13:49:37 +01:00
add_executable(tracey_ex5 ex5.cpp)
target_link_libraries(tracey_ex5 tracey)
2022-10-28 09:31:13 +02:00
2022-11-11 14:27:43 +01:00