# CMakeLists.txt #################################################### # Written by JackCarterSmith, 2022 # 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.1.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) # 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. unset(RSE_MODEL_TARGETS_LIST) if(BUILD_TOOLS) set(RSE_MODEL_TARGETS_LIST rse-model) endif() 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() 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) add_subdirectory(RSPModelLib) add_subdirectory(RSEModel) # 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 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} )