Add Release Scripts

This commit is contained in:
2026-04-28 14:21:18 -04:00
parent ef017db91a
commit 8cbfa12c2a

View File

@@ -115,22 +115,25 @@ set_property(TARGET "${CMAKE_PROJECT_NAME}" PROPERTY CXX_STANDARD 17)
#========================================================================================
# CHANGE RESOURCES DEFINITION
#========================================================================================
# You will change which line is commented depending
# on if the compiled binary is for development or
# production.
#
# Uncomment the line below when in development, this uses the resources folder
# in the CMake project for the RESOURCES_PATH definition
target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/")
#
# Uncomment the line below when in production, this uses a folder in the same working
# directory of the binary called "resources". Effectively RESOURCES_PATH
# becomes ./resources/. You would copy the resources folder of the cmake project
# and ship it will the compiled binary
#target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC RESOURCES_PATH="./resources/")
# By default, when in debug mode. Resources are pulled from the folder in the root of
# the project. This is statically mapped. The value of RESOURCES_PATH become
# /home/user1/Projects/Project. Thats not very usefull for shipping the application as
# the user is unlikely to have your same folder structure.
#
# So in release mode, the value of RESOURCES_PATH become ./resources/ so it will use the
# resources folder in the same folder as the executable
target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC
RESOURCES_PATH="$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/resources/>$<$<CONFIG:Release>:./resources/>"
)
# This copis the resources folder to the build location when in release mode
add_custom_command(TARGET "${CMAKE_PROJECT_NAME}" POST_BUILD
COMMAND $<$<CONFIG:Release>:${CMAKE_COMMAND}>
$<$<CONFIG:Release>:-E>
$<$<CONFIG:Release>:copy_directory>
$<$<CONFIG:Release>:"${CMAKE_CURRENT_SOURCE_DIR}/resources">
$<$<CONFIG:Release>:"$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/resources">
)
# Add our sources