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
65 changes: 65 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,68 @@ if (BUILD_TESTING)
enable_testing()
endif()



# ------------------------------------------------------------------
# cmake install stuff
# ------------------------------------------------------------------

set(OWL_CMAKE_INSTALL_DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/owl-${OWL_VERSION}
)

include(CMakePackageConfigHelpers)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/owl/cmake/owlConfig.cmake.in"
"${PROJECT_BINARY_DIR}/owlConfig.cmake"
INSTALL_DESTINATION
${OWL_CMAKE_INSTALL_DESTINATION}
)

write_basic_package_version_file(
"owlConfigVersion.cmake"
VERSION ${OWL_VERSION}
COMPATIBILITY SameMajorVersion
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/owlConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/owlConfigVersion.cmake
DESTINATION
${OWL_CMAKE_INSTALL_DESTINATION}
)

install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/cmake
DESTINATION
${OWL_CMAKE_INSTALL_DESTINATION}
FILES_MATCHING
PATTERN *.cmake
PATTERN Findowl.cmake EXCLUDE
)

set(OWL_INSTALL_TARGETS owl owl_static)

install(
TARGETS
${OWL_INSTALL_TARGETS}
EXPORT owl-config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_SKIP
# on Windows put the dlls into bin
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
# ... and the import lib into the devel package
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(EXPORT owl-config
DESTINATION ${OWL_CMAKE_INSTALL_DESTINATION}
NAMESPACE owl::
)

install(
# DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/owl
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/owl
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}
)


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 14 additions & 12 deletions include/owl/owl_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,30 @@
# define OWL_CAN_DO_SPHERES 1
#endif


#if defined(_MSC_VER)
# define OWL_DLL_EXPORT __declspec(dllexport)
# define OWL_DLL_IMPORT __declspec(dllimport)
#ifdef _WIN32
# if defined(owl_STATIC) || defined(owl_mpi_STATIC)
# define OWL_INTERFACE /* nothing */
# elif defined(owl_EXPORTS) || defined(owl_mpi_EXPORTS)
# define OWL_INTERFACE __declspec(dllexport)
# else
# define OWL_INTERFACE __declspec(dllimport)
# endif
#elif defined(__clang__) || defined(__GNUC__)
# define OWL_DLL_EXPORT __attribute__((visibility("default")))
# define OWL_DLL_IMPORT __attribute__((visibility("default")))
# define OWL_INTERFACE __attribute__((visibility("default")))
#else
# define OWL_DLL_EXPORT
# define OWL_DLL_IMPORT
# define OWL_INTERFACE
#endif

#ifdef __cplusplus
# define OWL_IF_CPP(a) a
# define OWL_IF_CPP(a) a
#else
# define OWL_IF_CPP(a) /* drop it */
# define OWL_IF_CPP(a) /* ignore */
#endif

# ifdef __cplusplus
# define OWL_API extern "C" OWL_DLL_EXPORT
# define OWL_API extern "C" OWL_INTERFACE
# else
# define OWL_API /* bla */
# define OWL_API /* bla */ OWL_INTERFACE
# endif


Expand Down
60 changes: 35 additions & 25 deletions owl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ set(OWL_SOURCES
# -------------------------------------------------------
# infrastructure
# -------------------------------------------------------
include/owl/owl.h
include/owl/owl_host.h
include/owl/owl_device.h
include/owl/common/arrayND/array2D.h
include/owl/common/arrayND/array3D.h
include/owl/common/math/AffineSpace.h
include/owl/common/math/box.h
include/owl/common/math/constants.h
include/owl/common/math/fixedpoint.h
include/owl/common/math/LinearSpace.h
include/owl/common/math/Quaternion.h
include/owl/common/math/random.h
include/owl/common/math/vec/compare.h
include/owl/common/math/vec/functors.h
include/owl/common/math/vec/rotate.h
include/owl/common/math/vec.h
include/owl/common/owl-common.h
include/owl/common/parallel/parallel_for.h
include/owl/owl.h
include/owl/owl_device.h
include/owl/owl_device_buffer.h
include/owl/owl_host.h
../include/owl/owl.h
../include/owl/owl_host.h
../include/owl/owl_device.h
../include/owl/common/arrayND/array2D.h
../include/owl/common/arrayND/array3D.h
../include/owl/common/math/AffineSpace.h
../include/owl/common/math/box.h
../include/owl/common/math/constants.h
../include/owl/common/math/fixedpoint.h
../include/owl/common/math/LinearSpace.h
../include/owl/common/math/Quaternion.h
../include/owl/common/math/random.h
../include/owl/common/math/vec/compare.h
../include/owl/common/math/vec/functors.h
../include/owl/common/math/vec/rotate.h
../include/owl/common/math/vec.h
../include/owl/common/owl-common.h
../include/owl/common/parallel/parallel_for.h
# ../include/owl/owl.h
# ../include/owl/owl_device.h
# ../include/owl/owl_device_buffer.h
# ../include/owl/owl_host.h
helper/cuda.h
helper/optix.h
common.h
Expand Down Expand Up @@ -150,8 +150,17 @@ target_link_libraries(owl-config INTERFACE
if (OWL_CUDA_STATIC)
target_compile_definitions(owl-config INTERFACE -DOWL_CUDA_STATIC=1)
endif()
target_link_libraries(owl PUBLIC owl-config)
target_link_libraries(owl_static PUBLIC owl-config)
target_link_libraries(owl PUBLIC
$<BUILD_INTERFACE:owl-config>
)
target_link_libraries(owl_static PUBLIC
$<BUILD_INTERFACE:owl-config>
)
if (APPLE)
set_target_properties(owl PROPERTIES INSTALL_RPATH "$loader_path")
else()
set_target_properties(owl PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()

if (OWL_HAVE_TBB AND TBB_FOUND)
if (TARGET TBB::tbb)
Expand Down Expand Up @@ -183,7 +192,8 @@ endif()
target_include_directories(owl-config
INTERFACE
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_LIST_DIR}/include
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
#CMAKE_CURRENT_LIST_DIR}/include
)

if (WIN32)
Expand Down
43 changes: 43 additions & 0 deletions owl/cmake/owlConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Copyright 2021-2024 The Khronos Group
## SPDX-License-Identifier: Apache-2.0

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_dependency(Threads)

include(${CMAKE_CURRENT_LIST_DIR}/owl-config.cmake)

if (NOT TARGET owl::owl)
message(FATAL_ERROR "CMAKE_PREFIX_PATH or owl_DIR are pointing to a \
owl build directory. Please do a full install of owl \
(e.g. 'make install') and point to where you installed it \
(CMAKE_INSTALL_PREFIX in your build of owl). \
Consuming owl from a build directory is not supported.")
endif()
set(owl_FOUND ON)

set(OWL_DATAROOTDIR
${CMAKE_CURRENT_LIST_DIR}/../../../@CMAKE_INSTALL_DATAROOTDIR@/owl
)

if (@OWL_MPI@)
find_dependency(MPI)
set(OWL_FEATURE_MPI ON)
endif()


foreach(component ${owl_FIND_COMPONENTS})
# For requested component, execute its "config" script
message("cfind component ${component}")
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${component}-config.cmake")
include(${CMAKE_CURRENT_LIST_DIR}/${component}-config.cmake)
set(${component}_FOUND ON)
else()
set(${component}_FOUND OFF)
endif()
endforeach()

check_required_components(@PROJECT_NAME@)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#pragma once

#include "owl_host.h"
#include "owl/owl_host.h"

namespace owl {
namespace device {
Expand Down
Loading