cmake: create binary package with nice filename

This commit is contained in:
Anonymous Maarten 2021-01-02 20:43:34 +01:00
parent 1275b70e9d
commit 9c5b50536e

View File

@ -59,7 +59,54 @@ if(LIBRW_INSTALL)
EXPORT librw-targets NAMESPACE librw:: EXPORT librw-targets NAMESPACE librw::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
) )
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
string(REPLACE "." ";" cmake_c_compiler_version_list "${CMAKE_C_COMPILER_VERSION}")
list(GET cmake_c_compiler_version_list 0 cmake_c_compiler_version_major)
string(TOLOWER "${LIBRW_PLATFORM}" librw_platform)
set(compiler)
set(os)
if(NOT LIBRW_PLATFORM STREQUAL "PS2")
if(MSVC)
set(compiler "-msvc${MSVC_VERSION}")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(compiler "-gcc${cmake_c_compiler_version_major}")
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(compiler "-clang${cmake_c_compiler_version_major}")
elseif(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
set(compiler "-appleclang${cmake_c_compiler_version_major}")
else()
set(compiler "-UNK")
message(WARNING "Unknown compiler. Created cpack package will be wrong. (override using cpack -P)")
endif()
endif()
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()
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}${os}${compiler}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A (partial) re-implementation of RenderWare Graphics") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A (partial) re-implementation of RenderWare Graphics")
set(CPACK_PACKAGE_VENDOR "aap") set(CPACK_PACKAGE_VENDOR "aap")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE")
@ -67,5 +114,6 @@ if(LIBRW_INSTALL)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_GENERATOR "TXZ")
include(CPack) include(CPack)
endif() endif()