RSE-Model/CMakeLists.txt
JackCarterSmith d40a9f921c
Some checks failed
JCS-Prod/RSE-Model/pipeline/pr-master There was a failure building this commit
Minor feature update
> 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
2023-01-18 19:07:09 +01:00

97 lines
3.6 KiB
CMake

# CMakeLists.txt
####################################################
# Written by JackCarterSmith, 2023
# This code is released under the RSE license.
####################################################
# CMake requirement and general configuration
cmake_minimum_required(VERSION 3.12)
cmake_policy(VERSION 3.12)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
if(DEFINED ENV{MS_COMPATIBLE})
set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries
endif()
# Project definition
if(DEFINED ENV{CI}) # Jenkins CI integration mode
project(rse-model VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
set(RSE_MODEL_NAME $ENV{CI_OUTPUT_NAME})
else() # Standalone project mode, should not be used for release.
project(rse-model VERSION 2.3.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
set(RSE_MODEL_NAME RSEModel)
endif()
set(RSP_MODEL_LIB_NAME RSPModel${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
# Compilation option
option(RSPMODEL_SHARED "Build shared lib" ON)
option(RSPMODEL_STATIC "Build static lib" ON)
option(BUILD_TOOLS "Build lib tools" ON)
# Push compile infos to source
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/RSPModelLib/src/config.h @ONLY)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/RSEModel/src/config.h @ONLY)
# The project is divided in two parts:
# - RSPModelLib is the parser library for model type data, it's take HOB file as input and output extracted datas.
# It is intended to be used by others apps like rendering engine or others.
# - RSEModel is the standalone application of the library, take HOB file in argument and output OBJ/MTL file.
# Artists or users can directly use this program to retrieve data in common datas format.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
unset(RSE_MODEL_TARGETS_LIST)
add_subdirectory(RSPModelLib)
add_subdirectory(RSEModel)
if(RSPMODEL_SHARED)
list(APPEND RSE_MODEL_TARGETS_LIST rsp-model-lib)
endif()
if(RSPMODEL_STATIC)
list(APPEND RSE_MODEL_TARGETS_LIST rsp-model-libstatic)
endif()
if(NOT RSE_MODEL_TARGETS_LIST)
message(SEND_ERROR
"No library variant selected to build. "
"Please enable at least one of the following options: "
"RSPMODEL_STATIC, RSPMODEL_SHARED")
endif()
if(BUILD_TOOLS)
list(APPEND RSE_MODEL_TARGETS_LIST rse-model)
endif()
# GPG signature custom command
#add_custom_command(
# OUTPUT ""
# COMMAND gpg --batch --detach-sign
# -o ${RSE_MOD_NAME}_${CI_SYS_TARGET}.gpg
# ${RSE_MOD_NAME}
# DEPENDS ${RSE_MOD_NAME}
# VERBATIM
#)
# Install dependancies
install(FILES ${PROJECT_BINARY_DIR}/bin/glew32.dll ${PROJECT_BINARY_DIR}/bin/vulkan-1.dll
DESTINATION ${INSTALL_BIN_DIR})
# Install library includes
install(FILES ${RSP_PUBLIC_HRDS} DESTINATION ${INSTALL_INC_DIR})
# Install project artifacts
install(TARGETS ${RSE_MODEL_TARGETS_LIST}
RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR}
)