2020-10-31 18:14:28 -04:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
|
|
|
|
2021-01-13 06:15:22 -05:00
|
|
|
set(EXECUTABLE re3)
|
|
|
|
set(PROJECT RE3)
|
|
|
|
|
|
|
|
project(${EXECUTABLE} C CXX)
|
2020-10-31 18:14:28 -04:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
|
|
|
|
if(WIN32)
|
2021-01-13 06:15:22 -05:00
|
|
|
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
2020-10-31 18:14:28 -04:00
|
|
|
else()
|
2021-01-13 06:15:22 -05:00
|
|
|
set(${PROJECT}_AUDIOS "OAL")
|
2020-10-31 18:14:28 -04:00
|
|
|
endif()
|
|
|
|
|
2021-01-13 06:15:22 -05:00
|
|
|
set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio")
|
2020-10-31 18:14:28 -04:00
|
|
|
|
2021-01-13 06:15:22 -05:00
|
|
|
option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF)
|
|
|
|
option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)
|
2020-12-06 09:42:15 -05:00
|
|
|
|
2021-01-13 06:15:22 -05:00
|
|
|
set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS})
|
|
|
|
message(STATUS "${PROJECT}_AUDIO = ${${PROJECT}_AUDIO} (choices=${${PROJECT}_AUDIOS})")
|
|
|
|
set("${PROJECT}_AUDIO_${${PROJECT}_AUDIO}" ON)
|
|
|
|
if(NOT ${PROJECT}_AUDIO IN_LIST ${PROJECT}_AUDIOS)
|
|
|
|
message(FATAL_ERROR "Illegal ${PROJECT}_AUDIO=${${PROJECT}_AUDIO}")
|
2020-10-31 18:14:28 -04:00
|
|
|
endif()
|
|
|
|
|
2021-01-13 06:15:22 -05:00
|
|
|
option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON)
|
|
|
|
if(${PROJECT}_VENDORED_LIBRW)
|
2020-12-06 07:54:06 -05:00
|
|
|
add_subdirectory(vendor/librw)
|
|
|
|
else()
|
|
|
|
find_package(librw REQUIRED)
|
|
|
|
endif()
|
2020-10-31 18:14:28 -04:00
|
|
|
add_subdirectory(src)
|
|
|
|
|
2021-01-13 06:15:22 -05:00
|
|
|
if(${PROJECT}_INSTALL)
|
2021-01-03 14:38:53 -05:00
|
|
|
install(DIRECTORY gamefiles/ DESTINATION ".")
|
2021-01-03 10:32:00 -05:00
|
|
|
if(LIBRW_PLATFORM_NULL)
|
|
|
|
set(platform "-null")
|
|
|
|
elseif(LIBRW_PLATFORM_PS2)
|
|
|
|
set(platform "-ps2")
|
|
|
|
elseif(LIBRW_PLATFORM_GL3)
|
|
|
|
if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
|
|
|
set(platform "-gl3-glfw")
|
|
|
|
else()
|
|
|
|
set(platform "-gl3-sdl2")
|
|
|
|
endif()
|
|
|
|
elseif(LIBRW_PLATFORM_D3D9)
|
|
|
|
set(platform "-d3d9")
|
|
|
|
endif()
|
2021-01-13 06:15:22 -05:00
|
|
|
if(${PROJECT}_AUDIO_OAL)
|
2021-01-03 10:32:00 -05:00
|
|
|
set(audio "-oal")
|
2021-01-13 06:15:22 -05:00
|
|
|
elseif(${PROJECT}_AUDIO_MSS)
|
2021-01-03 10:32:00 -05:00
|
|
|
set(audio "-mss")
|
|
|
|
endif()
|
2021-01-13 06:15:22 -05:00
|
|
|
if(${PROJECT}_WITH_OPUS)
|
2021-01-03 10:32:00 -05:00
|
|
|
set(audio "${audio}-opus")
|
|
|
|
endif()
|
|
|
|
if(NOT LIBRW_PLATFORM_PS2)
|
|
|
|
if(WIN32)
|
|
|
|
set(os "-win")
|
|
|
|
elseif(APPLE)
|
|
|
|
set(os "-apple")
|
|
|
|
elseif(UNIX)
|
|
|
|
set(os "-linux")
|
|
|
|
else()
|
|
|
|
set(compiler "-UNK")
|
|
|
|
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${platform}${audio}${os}${compiler}")
|
2020-12-06 07:54:06 -05:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTA III reversed")
|
|
|
|
set(CPACK_PACKAGE_VENDOR "GTAModding")
|
2021-01-03 10:32:00 -05:00
|
|
|
# FIXME: missing license (https://github.com/GTAmodding/re3/issues/794)
|
|
|
|
# set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE")
|
|
|
|
# set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
2020-12-06 07:54:06 -05:00
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
2021-01-03 10:32:00 -05:00
|
|
|
set(CPACK_GENERATOR "TXZ")
|
2020-12-06 07:54:06 -05:00
|
|
|
include(CPack)
|
2020-10-31 18:14:28 -04:00
|
|
|
endif()
|