Files
Hoops_Exchange/CMakeLists.txt
2025-12-15 23:22:33 +08:00

94 lines
2.9 KiB
CMake

cmake_minimum_required(VERSION 3.20.2)
project(hoops_samples)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Exchange REQUIRED)
# Enable folder for IDEs project hierarchy
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_library(hoops_samples INTERFACE)
if(UNIX)
if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
target_compile_definitions(hoops_samples
INTERFACE
XPLAT=X64
)
else()
target_compile_definitions(hoops_samples
INTERFACE
XPLAT=X32
)
endif()
endif()
target_compile_definitions(hoops_samples
INTERFACE
"HOOPS_BINARY_DIRECTORY=R\"($<TARGET_FILE_DIR:A3DLIBS>)\""
"SAMPLES_DATA_DIRECTORY=R\"(${CMAKE_CURRENT_LIST_DIR}/data)\""
"SAMPLES_DATA_HTML_DIRECTORY=R\"(${CMAKE_CURRENT_BINARY_DIR}/data/html)\""
"SAMPLES_DEFAULT_OUTPUT_PATH=R\"(.\)\""
"SAMPLES_PUBLISH_GALLERY_DIRECTORY=R\"(${CMAKE_CURRENT_LIST_DIR}/publish/publishgallery)\""
"SAMPLES_PUBLISH_QUICKSTARTS_DIRECTORY=R\"(${CMAKE_CURRENT_LIST_DIR}/publish/publishquickstarts)\""
"SAMPLES_PUBLISH_HTML_DIRECTORY=R\"(${CMAKE_CURRENT_LIST_DIR}/publish/publishhtml)\""
"SAMPLES_ADOBE_RESOURCE_DIRECTORY=R\"(../resource)\""
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample_bin")
set(CMAKE_BUILD_RPATH "$<TARGET_FILE_DIR:A3DLIBS>;${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
if(MSVC)
target_compile_options(hoops_samples INTERFACE /W4 /WX)
target_compile_definitions(hoops_samples INTERFACE
WIN32
)
target_link_options(hoops_samples INTERFACE /WX)
else()
target_compile_options(hoops_samples INTERFACE -Wno-write-strings)
target_link_libraries(hoops_samples INTERFACE ${CMAKE_DL_LIBS})
endif()
target_link_libraries(hoops_samples
INTERFACE
A3DLIBS::Interface
hoops_unicode
)
if(UNIX AND NOT APPLE)
target_link_libraries(hoops_samples INTERFACE stdc++ pthread )
target_link_options(hoops_samples INTERFACE -Wl,--disable-new-dtags) # this line disable RUNPATH to use RPATH instead
endif()
add_library(hoops::samples ALIAS hoops_samples)
if(NOT ANDROID AND NOT IOS OR CATALYST)
# enable TranslateToPkParts build by default
if(NOT DEFINED HOOPS_BUILD_TranslateToPkParts)
set(HOOPS_BUILD_TranslateToPkParts ON)
endif()
# Set the C++ standard to C++11 if it is not already set
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
add_subdirectory(exchange/exchangesource)
# subdirectory for publish samples
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/publish/publishsource AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/publish/publishsource)
add_subdirectory(publish/publishsource)
endif()
# set variable HOOPS_SAMPLE_LIST for main project
if (NOT PROJECT_IS_TOP_LEVEL)
set(HOOPS_SAMPLE_LIST ${SAMPLE_LIST_Exchange} ${SAMPLE_LIST_Publish} PARENT_SCOPE)
endif()
message(STATUS "C++ standard set to ${CMAKE_CXX_STANDARD}")
endif()