All checks were successful
JCS-Prod/RSE-Terrain/pipeline/pr-master This commit looks good
85 lines
3.0 KiB
CMake
85 lines
3.0 KiB
CMake
# 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()
|
|
|
|
include(CheckIncludeFile)
|
|
include(CheckCSourceCompiles)
|
|
|
|
add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part
|
|
#add_definitions(-DNO_PNG_SUPPORT) # Can be used to disable code support for PNG exporting
|
|
|
|
|
|
# Project definition
|
|
if(DEFINED ENV{CI}) # Jenkins CI integration mode
|
|
project(rse-terrain VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Terrain" LANGUAGES C)
|
|
set(RSE_TER_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION})
|
|
else() # Standalone project mode, should not be used for release.
|
|
project(rse-terrain VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Terrain" LANGUAGES C)
|
|
set(RSE_TER_NAME RSE_Terrain-${PROJECT_VERSION})
|
|
endif()
|
|
# Push compile infos to source
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
|
|
|
|
|
|
# Import needed packages and references their include path
|
|
find_package(ZLIB 1.2.12 REQUIRED)
|
|
include_directories(${ZLIB_INCLUDE_DIR})
|
|
find_package(PNG 1.6.37 REQUIRED)
|
|
include_directories(${PNG_INCLUDE_DIR})
|
|
#find_package(GLEW REQUIRED) # Enable when GL rendering is ready
|
|
#include_directories(${GLEW_INCLUDE_DIR})
|
|
|
|
|
|
# Define src/headers files
|
|
FILE(GLOB_RECURSE RSE_TER_SOURCES src/*.c)
|
|
FILE(GLOB_RECURSE RSE_TER_HEADERS src/*.h)
|
|
SOURCE_GROUP("Source Files" FILES ${RSE_TER_SOURCES})
|
|
SOURCE_GROUP("Header Files" FILES ${RSE_TER_HEADERS})
|
|
|
|
|
|
# Building instructions for RSE-Terrain
|
|
if(DEFINED ENV{RSE-WS})
|
|
set(CMAKE_BUILD_TYPE DEBUG)
|
|
endif()
|
|
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
add_executable(rse-terrain ${RSE_TER_SOURCES} ${RSE_TER_HEADERS}) # Set the inputs for the compiler (srcs&hrds)
|
|
set_property(TARGET rse-terrain PROPERTY C_STANDARD 90)
|
|
set_target_properties(rse-terrain PROPERTIES OUTPUT_NAME ${RSE_TER_NAME}) # Define the executable file name
|
|
# Link externals libraries to the linker
|
|
if(MSVC)
|
|
# msvc does not append 'lib' - do it here to have consistent name
|
|
#set_target_properties(rse-terrain PROPERTIES PREFIX "lib")
|
|
set_target_properties(rse-terrain PROPERTIES IMPORT_PREFIX "lib")
|
|
target_link_libraries(rse-terrain ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES})
|
|
else()
|
|
target_link_libraries(rse-terrain ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES} m)
|
|
endif()
|
|
|
|
|
|
# GPG signature custom command
|
|
#add_custom_command(
|
|
# OUTPUT ""
|
|
# COMMAND gpg --batch --detach-sign
|
|
# -o ${RSE_TER_NAME}_${CI_SYS_TARGET}.gpg
|
|
# ${RSE_TER_NAME}
|
|
# DEPENDS ${RSE_TER_NAME}
|
|
# VERBATIM
|
|
#)
|
|
|
|
|
|
# Install project executable
|
|
install(TARGETS rse-terrain
|
|
RUNTIME DESTINATION bin
|
|
) |