Skip to content
Merged
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
19 changes: 19 additions & 0 deletions orc-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ option(ORC_RT_INCLUDE_DOCS "Build the ORC-RT documentation." ON)
option(ORC_RT_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(ORC_RT_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(ORC_RT_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(ORC_RT_ENABLE_RTTI "Enable RTTI." ON)
option(ORC_RT_ENABLE_EXCEPTIONS "Enable exceptions." ON)
option(ORC_RT_INCLUDE_TESTS "Build ORC-RT tests." ${LLVM_INCLUDE_TESTS})

set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
Expand All @@ -40,6 +42,23 @@ set(CMAKE_FOLDER "orc-rt")
set(ORC_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(ORC_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

# Configure RTTI and exceptions compile flags
set(ORC_RT_COMPILE_FLAGS)
if(NOT ORC_RT_ENABLE_RTTI)
list(APPEND ORC_RT_COMPILE_FLAGS -fno-rtti)
endif()

if(NOT ORC_RT_ENABLE_EXCEPTIONS)
list(APPEND ORC_RT_COMPILE_FLAGS -fno-exceptions)
endif()

# Generate config header
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/orc-rt-c/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/orc-rt-c/config.h
@ONLY
)

#===============================================================================
# Setup Source Code
#===============================================================================
Expand Down
14 changes: 13 additions & 1 deletion orc-rt/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,28 @@ set(ORC_RT_HEADERS
orc-rt/span.h
)

# Add generated config header
set(ORC_RT_GENERATED_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/orc-rt-c/config.h
)

# TODO: Switch to filesets when we move to cmake-3.23.
add_library(orc-rt-headers INTERFACE)
target_include_directories(orc-rt-headers INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set_property(TARGET orc-rt-headers
PROPERTY PUBLIC_HEADER ${ORC_RT_HEADERS}
PROPERTY PUBLIC_HEADER ${ORC_RT_HEADERS} ${ORC_RT_GENERATED_HEADERS}
)
install(TARGETS orc-rt-headers
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/
COMPONENT OrcRT_Development
)

# Install generated config header
install(FILES ${ORC_RT_GENERATED_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/orc-rt-c/
COMPONENT OrcRT_Development
)
3 changes: 3 additions & 0 deletions orc-rt/lib/executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ add_library(orc-rt-executor STATIC ${files})
target_link_libraries(orc-rt-executor
PUBLIC orc-rt-headers
)

# Apply RTTI and exceptions compile flags
target_compile_options(orc-rt-executor PRIVATE ${ORC_RT_COMPILE_FLAGS})
install(TARGETS orc-rt-executor
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT OrcRT_Development
Expand Down
Loading