Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.26 FATAL_ERROR)

#
# Initial setup.
#

if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

#
# Options.
#

option(OPENPBRBSDF_ENABLE_INSTALL "Enable installation rules" ON)
option(OPENPBRBSDF_ENABLE_EXAMPLES "Enable examples" ON)

#
# Project.
#

project(openpbr-bsdf)

#
# Toolchain-dependent CMake Libraries.
#

include(CMakePackageConfigHelpers)
include(CTest)
include(GNUInstallDirs)

#
# Subdirectories.
#

add_subdirectory(include)

if(OPENPBRBSDF_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()

#
# Installation.
#

if(OPENPBRBSDF_ENABLE_INSTALL)
add_subdirectory(installation)
endif()
14 changes: 14 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
find_package(glm REQUIRED)

add_executable(openpbr-bsdf-minimal-cpp-example)
add_executable(openpbr-bsdf::minimal-cpp-example ALIAS openpbr-bsdf-minimal-cpp-example)
set_property(TARGET openpbr-bsdf-minimal-cpp-example PROPERTY EXPORT_NAME "minimal-cpp-example")
target_sources(openpbr-bsdf-minimal-cpp-example PRIVATE minimal_cpp_example.cpp)
target_link_libraries(openpbr-bsdf-minimal-cpp-example PRIVATE glm::glm openpbr-bsdf::headers)

get_target_property(sources openpbr-bsdf-minimal-cpp-example SOURCES)
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${sources})

if(OPENPBRBSDF_ENABLE_INSTALL)
install(TARGETS openpbr-bsdf-minimal-cpp-example EXPORT openpbr-bsdf-targets)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <glm/glm.hpp>

// Include OpenPBR main header after including GLM and tweaking any relevant OpenPBR settings.
#include "openpbr.h"
#include "openpbr/openpbr.h"

// Standard includes for this example.
#include <cstdint>
Expand Down
70 changes: 70 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
add_library(openpbr-bsdf-headers INTERFACE)
add_library(openpbr-bsdf::headers ALIAS openpbr-bsdf-headers)
set_target_properties(openpbr-bsdf-headers PROPERTIES EXPORT_NAME "headers")
target_sources(openpbr-bsdf-headers
PUBLIC FILE_SET HEADERS
FILES
openpbr/impl/data/openpbr_energy_array_access.h
openpbr/impl/data/openpbr_energy_arrays.h
openpbr/impl/data/openpbr_ideal_dielectric_avg_energy_complement_data.h
openpbr/impl/data/openpbr_ideal_dielectric_energy_complement_data.h
openpbr/impl/data/openpbr_ideal_dielectric_reflection_ratio_data.h
openpbr/impl/data/openpbr_ideal_metal_avg_energy_complement_data.h
openpbr/impl/data/openpbr_ideal_metal_energy_complement_data.h
openpbr/impl/data/openpbr_ltc_array.h
openpbr/impl/data/openpbr_ltc_data.h
openpbr/impl/data/openpbr_opaque_dielectric_avg_energy_complement_data.h
openpbr/impl/data/openpbr_opaque_dielectric_energy_complement_data.h
openpbr/impl/openpbr_aggregate_lobe.h
openpbr/impl/openpbr_bsdf.h
openpbr/impl/openpbr_coating_lobe.h
openpbr/impl/openpbr_complex.h
openpbr/impl/openpbr_comprehensive_microfacet_lobe.h
openpbr/impl/openpbr_constant_reflection_coefficient.h
openpbr/impl/openpbr_diffuse_lobe.h
openpbr/impl/openpbr_dispersion_utils.h
openpbr/impl/openpbr_fuzz_lobe.h
openpbr/impl/openpbr_generic_flipped_lobe.h
openpbr/impl/openpbr_generic_minimal_microfacet_lobe.h
openpbr/impl/openpbr_ior_reflection_coefficient.h
openpbr/impl/openpbr_lobe_utils.h
openpbr/impl/openpbr_math.h
openpbr/impl/openpbr_microfacet_multiple_scattering_data.h
openpbr/impl/openpbr_microfacet_multiple_scattering_lobes.h
openpbr/impl/openpbr_reflection_transmission_coefficient.h
openpbr/impl/openpbr_reflection_transmission_coefficient_structs.h
openpbr/impl/openpbr_sampling.h
openpbr/impl/openpbr_thin_film_iridescence_utils.h
openpbr/impl/openpbr_thin_wall_diffuse_transmission_lobe.h
openpbr/impl/openpbr_thin_wall_specular_transmission_lobe.h
openpbr/impl/openpbr_vndf_microfacet_distribution.h
openpbr/impl/openpbr_volume_utils.h
openpbr/interop/openpbr_interop.h
openpbr/interop/openpbr_interop_cpp.h
openpbr/interop/openpbr_interop_cuda.h
openpbr/interop/openpbr_interop_glsl.h
openpbr/interop/openpbr_interop_msl.h
openpbr/interop/openpbr_interop_slang.h
openpbr/openpbr.h
openpbr/openpbr_api.h
openpbr/openpbr_basis.h
openpbr/openpbr_bsdf_lobe_type.h
openpbr/openpbr_constants.h
openpbr/openpbr_data_constants.h
openpbr/openpbr_diffuse_specular.h
openpbr/openpbr_homogeneous_volume.h
openpbr/openpbr_resolved_inputs.h
openpbr/openpbr_settings.h
)
target_include_directories(openpbr-bsdf-headers
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

get_target_property(sources openpbr-bsdf-headers SOURCES)
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${sources})

if(OPENPBRBSDF_ENABLE_INSTALL)
install(TARGETS openpbr-bsdf-headers EXPORT openpbr-bsdf-targets FILE_SET HEADERS)
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions installation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/openpbr-bsdf-config.cmake.in" [=[
@PACKAGE_INIT@

set(OPENPBRBSDF_ENABLE_EXAMPLES @OPENPBRBSDF_ENABLE_EXAMPLES@)

include(CMakeFindDependencyMacro)

if(OPENPBRBSDF_ENABLE_EXAMPLES)
find_dependency(glm)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/openpbr-bsdf-targets.cmake")

check_required_components("openpbr-bsdf")
]=])

configure_package_config_file(
"${CMAKE_CURRENT_BINARY_DIR}/openpbr-bsdf-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/openpbr-bsdf-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/openpbr-bsdf
)

install(
EXPORT openpbr-bsdf-targets
NAMESPACE "openpbr-bsdf::"
DESTINATION "${CMAKE_INSTALL_DATADIR}/openpbr-bsdf"
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/openpbr-bsdf-config.cmake"
DESTINATION
"${CMAKE_INSTALL_DATADIR}/openpbr-bsdf"
)