Files
SimpleRayTracing/CMakeLists.txt
Misaki 6800810369 Update project structure and improve performance
Added new files for BVH, AABB, and Debug functionalities.
Added new utility functions in Common.h.
Added gamma correction function in PostProcessing.h.
Changed the return type of path_trace to vec4s for alpha blending.
Changed BSDF function signatures to include sample index and bounce.
Changed the BSDF.h to replace inline functions with declarations.
Changed the Light and SkyLight evaluation functions to include throughput and sample index.
Changed the sphere creation function in GeometryUtilities.h for better quality.
Changed the scene structure to include a BVH tree for improved ray intersection.
Changed the scene initialization parameters for better performance.
Created new Debug functions for ray intersection counting.
Created new functions for triangle collection management in Triangle.c.
Improved pixel updating logic in Window.c.
Improved ray intersection performance with new BVH implementation.
Removed unused includes from Common.h.
Removed old library linking methods in CMakeLists.txt.
2025-04-21 15:56:19 +09:00

69 lines
2.1 KiB
CMake

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME SimpleRayTracer)
project(${PROJECT_NAME} LANGUAGES C)
find_package(OpenMP REQUIRED)
set(EXTERNAL_DIR "${CMAKE_SOURCE_DIR}/external")
set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/source")
set(HEADER_DIR "${CMAKE_SOURCE_DIR}/header")
set(LIBRARY_PATH "${CMAKE_SOURCE_DIR}/lib")
# Recursively find all .c files in the Sources directory
file(GLOB_RECURSE SOURCES "${SOURCE_DIR}/*.c")
add_executable(${PROJECT_NAME} WIN32 ${SOURCES})
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE ${EXTERNAL_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${HEADER_DIR})
# Define imported target for cglm
add_library(cglm_shared SHARED IMPORTED)
set_target_properties(cglm_shared PROPERTIES
IMPORTED_LOCATION "${LIBRARY_PATH}/cglm.dll"
IMPORTED_IMPLIB "${LIBRARY_PATH}/cglm.lib"
INTERFACE_INCLUDE_DIRECTORIES "${EXTERNAL_DIR}/cglm"
)
# Define imported target for assimp
add_library(assimp_shared SHARED IMPORTED)
set_target_properties(assimp_shared PROPERTIES
IMPORTED_LOCATION "${LIBRARY_PATH}/assimp-vc143-mt.dll"
IMPORTED_IMPLIB "${LIBRARY_PATH}/assimp-vc143-mt.lib"
INTERFACE_INCLUDE_DIRECTORIES "${EXTERNAL_DIR}/assimp"
)
target_link_libraries(${PROJECT_NAME} PRIVATE
cglm_shared
assimp_shared
)
# target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBRARY_PATH}/cglm.lib)
# target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBRARY_PATH}/assimp-vc143-mt.lib)
if(OpenMP_C_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenMP::OpenMP_C)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
if(WIN32)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_RUNTIME_DLLS:${PROJECT_NAME}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
VERBATIM
COMMAND_EXPAND_LISTS
)
endif()
# file(COPY ${LIBRARY_PATH}/cglm.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/)
# file(COPY ${LIBRARY_PATH}/assimp-vc143-mt.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/)