Skip to content

Commit

Permalink
fix packaging step
Browse files Browse the repository at this point in the history
  • Loading branch information
jshbrntt committed Sep 27, 2024
1 parent e82db4f commit 594d6cc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ if(Git_FOUND)
)
string(SUBSTRING ${SEMVER_BUILD} 0 7 SEMVER_BUILD)
endif()
set(SEMVER ${SEMVER_VERSION_CORE})
if(DEFINED SEMVER_PRE_RELEASE)
string(APPEND SEMVER "-${SEMVER_PRE_RELEASE}")
endif()
if(DEFINED SEMVER_BUILD)
string(APPEND SEMVER "+${SEMVER_BUILD}")
endif()

configure_file(
"${CMAKE_SOURCE_DIR}/src/racer/version.hpp.in"
Expand Down Expand Up @@ -98,16 +105,16 @@ endif()
# Create target directory, only include project version in release builds
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE_LC)
set(TARGET_DIRECTORY "target")
set(TARGET_BASENAME "${PROJECT_NAME}-${PROJECT_VERSION}-${TARGET_TRIPLE}-${BUILD_TYPE_LC}")
set(TARGET_BASENAME "${PROJECT_NAME}-${SEMVER}-${TARGET_TRIPLE}-${BUILD_TYPE_LC}")
set(TARGET_PATH "${TARGET_DIRECTORY}/${TARGET_BASENAME}")

# Create zip archive on Windows, tar.gz archive on other platforms
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TARGET_ARCHIVE "${TARGET_BASENAME}.zip")
set(ARCHIVE_COMMAND cd ${CMAKE_SOURCE_DIR}/${TARGET_PATH} && zip -r ${TARGET_ARCHIVE} ${TARGET_BASENAME})
set(ARCHIVE_COMMAND cd ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY} && zip -r ${TARGET_ARCHIVE} ${TARGET_BASENAME})
else()
set(TARGET_ARCHIVE "${TARGET_BASENAME}.tar.gz")
set(ARCHIVE_COMMAND tar -czvf ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_ARCHIVE} -C ${CMAKE_SOURCE_DIR}/${TARGET_PATH} ${TARGET_BASENAME})
set(ARCHIVE_COMMAND tar -czvf ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY}/${TARGET_ARCHIVE} -C ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY} ${TARGET_BASENAME})
endif()

set(PROJECT_ASSETS_SOURCE_PATH ${CMAKE_SOURCE_DIR}/src/racer/assets)
Expand All @@ -125,7 +132,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${PROJECT_NAME}>/${TARGET_EXECUTABLE} ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_EXECUTABLE}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_ASSETS_SOURCE_PATH} ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/assets
COMMAND ${ARCHIVE_COMMAND}
COMMAND sha256sum ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_ARCHIVE} > ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_ARCHIVE}.sha256
COMMAND sha256sum ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY}/${TARGET_ARCHIVE} > ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY}/${TARGET_ARCHIVE}.sha256
)
else()
# Create symlink to assets directory for development
Expand Down

0 comments on commit 594d6cc

Please sign in to comment.