Skip to content

Commit

Permalink
Added archive file creation to release targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
jclaar committed Jun 26, 2024
1 parent 0e6a9f7 commit d513092
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ cmake_minimum_required( VERSION 3.1.0 )

cmake_policy( VERSION 3.14 )

project( zork VERSION 1.0.0 )
project( zork VERSION 1.2.0 )

set( CMAKE_CXX_STANDARD 20 )

message("Ver is ${CMAKE_PROJECT_VERSION}")

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.65.0 REQUIRED COMPONENTS serialization filesystem system)
set(THREADS_PREFER_PTHREAD_FLAG ON)
Expand Down Expand Up @@ -86,4 +88,28 @@ add_executable(zork

target_link_libraries(zork ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -ldl)

install(TARGETS zork DESTINATION bin)
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
if (APPLE)
add_custom_command(TARGET zork
POST_BUILD
COMMAND hdiutil create -volname "Zork" -srcfolder "${CMAKE_CURRENT_BINARY_DIR}/zork" -ov -format UDZO "Zork_mac_${CMAKE_PROJECT_VERSION}.dmg"
)
elseif(UNIX)
add_custom_command(TARGET zork
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E tar "zcfv" "zork_linux_${CMAKE_PROJECT_VERSION}.gz" "zork"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/zork"
COMMENT "Creating archive file for release."
)
else()
add_custom_command(TARGET zork
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "zork_win64_${CMAKE_PROJECT_VERSION}.zip" --format=zip "zork.exe"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/zork.exe"
COMMENT "Creating archive file for release."
)
endif()
endif()

0 comments on commit d513092

Please sign in to comment.