Some checks failed
JCS-Prod/RSE-Model/pipeline/pr-master There was a failure building this commit
> New Load/Free mecanism for file memory management > Added prototype of simple header parser for fast infos access > Fix seg. fault when forcing mtl export without RSPTextureLib dll > Added dependencies to Vulkan driver
103 lines
3.4 KiB
CMake
103 lines
3.4 KiB
CMake
# CMakeLists.txt
|
|
|
|
####################################################
|
|
# Written by JackCarterSmith, 2023
|
|
# This code is released under the RSE license.
|
|
####################################################
|
|
|
|
|
|
# General library configuration
|
|
if(DEFINED ENV{MS_COMPATIBLE})
|
|
set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries
|
|
endif()
|
|
|
|
include(CheckIncludeFile)
|
|
include(CheckCSourceCompiles)
|
|
|
|
|
|
# Define src/headers files
|
|
file(GLOB_RECURSE RSP_MOD_SOURCES ./src/*.c)
|
|
source_group("Source Files" FILES ${RSP_MOD_SOURCES})
|
|
file(GLOB RSP_PUBLIC_HRDS ./include/*.h)
|
|
set(RSP_PUBLIC_HRDS ${RSP_PUBLIC_HRDS} PARENT_SCOPE)
|
|
|
|
|
|
# Building instructions for RSP-Model library
|
|
if(DEFINED ENV{CI})
|
|
set(CMAKE_BUILD_TYPE RELEASE)
|
|
endif()
|
|
|
|
|
|
# Declare the shared library instance
|
|
if(RSPMODEL_SHARED)
|
|
add_library(rsp-model-lib SHARED ${RSP_MOD_SOURCES})
|
|
set_property(TARGET rsp-model-lib PROPERTY C_STANDARD 11)
|
|
set_target_properties(rsp-model-lib PROPERTIES VERSION 2.3.0)
|
|
|
|
target_include_directories(rsp-model-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
set_target_properties(rsp-model-lib PROPERTIES OUTPUT_NAME "${RSP_MODEL_LIB_NAME}")
|
|
|
|
if(WIN32)
|
|
set_target_properties(rsp-model-lib PROPERTIES DEFINE_SYMBOL RSPMODEL_DLL)
|
|
endif()
|
|
|
|
# MSVC does not append 'lib' - do it here to have consistent name
|
|
if(MSVC)
|
|
set_target_properties(rsp-model-lib PROPERTIES PREFIX "lib")
|
|
set_target_properties(rsp-model-lib PROPERTIES IMPORT_PREFIX "lib")
|
|
endif()
|
|
endif()
|
|
|
|
|
|
# Declare the static library instance
|
|
if(RSPMODEL_STATIC)
|
|
add_library(rsp-model-libstatic STATIC ${RSP_MOD_SOURCES})
|
|
set_property(TARGET rsp-model-libstatic PROPERTY C_STANDARD 11)
|
|
|
|
target_include_directories(rsp-model-libstatic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
# MSVC doesn't use a different file extension for shared vs. static
|
|
# libs. We are able to change OUTPUT_NAME to remove the _static
|
|
# for all other platforms.
|
|
if(NOT MSVC)
|
|
set_target_properties(rsp-model-libstatic PROPERTIES OUTPUT_NAME "${RSP_MODEL_LIB_NAME}")
|
|
set_target_properties(rsp-model-libstatic PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
|
else()
|
|
set_target_properties(rsp-model-libstatic PROPERTIES OUTPUT_NAME "${RSP_MODEL_LIB_NAME}_static")
|
|
set_target_properties(rsp-model-libstatic PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
|
endif()
|
|
|
|
# MSVC does not append 'lib' - do it here to have consistent name
|
|
if(MSVC)
|
|
set_target_properties(rsp-model-libstatic PROPERTIES PREFIX "lib")
|
|
endif()
|
|
endif()
|
|
|
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/create_symlink.cmake)
|
|
|
|
# Install libraries with OS specific name fix
|
|
if(RSPMODEL_SHARED)
|
|
# Create a symlink for libRSPModel.dll.a => libRSPModelXX.dll.a on Cygwin/MinGW
|
|
if(CYGWIN OR MINGW)
|
|
create_lib_symlink(libRSPModel${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET rsp-model-lib)
|
|
install(FILES $<TARGET_LINKER_FILE_DIR:rsp-model-lib>/libRSPModel${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
|
DESTINATION ${INSTALL_LIB_DIR})
|
|
endif()
|
|
|
|
if(NOT WIN32)
|
|
create_lib_symlink(libRSPModel${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET rsp-model-lib)
|
|
install(FILES $<TARGET_LINKER_FILE_DIR:rsp-model-lib>/libRSPModel${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
DESTINATION ${INSTALL_LIB_DIR})
|
|
endif()
|
|
endif()
|
|
|
|
if(RSPMODEL_STATIC)
|
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
create_lib_symlink(libRSPModel${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET rsp-model-libstatic)
|
|
install(FILES $<TARGET_LINKER_FILE_DIR:rsp-model-libstatic>/libRSPModel${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
DESTINATION ${INSTALL_LIB_DIR})
|
|
endif()
|
|
endif()
|