CMake: Properly detect when setup.iss has changed

This commit is contained in:
Vicki Pfau 2020-12-09 22:25:56 -08:00
parent 9397eee606
commit e98ca08afc
1 changed files with 21 additions and 23 deletions

View File

@ -985,26 +985,6 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba DESTINATION ${CMAKE_I
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba-util DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT ${BINARY_NAME}-dev)
if(WIN32)
set(BIN_DIR ".\\")
string(REGEX REPLACE "[^-A-Za-z0-9_.]" "-" CLEAN_VERSION_STRING "${VERSION_STRING}")
file(RELATIVE_PATH SETUP_DIR_SLASH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/setup")
file(RELATIVE_PATH RES_DIR_SLASH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/res")
string(REPLACE "/" "\\" SETUP_DIR "${SETUP_DIR_SLASH}")
string(REPLACE "/" "\\" RES_DIR "${RES_DIR_SLASH}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES ".*64$")
set(WIN_BITS 64)
else()
set(WIN_BITS 32)
endif()
if(GIT_TAG)
set(IS_RELEASE 1)
else()
set(IS_RELEASE 0)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/setup/setup.iss.in" ${CMAKE_CURRENT_BINARY_DIR}/setup.iss)
endif()
# Packaging
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/licenses/blip_buf.txt DESTINATION ${CMAKE_INSTALL_DOCDIR}/licenses COMPONENT ${BINARY_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/licenses/inih.txt DESTINATION ${CMAKE_INSTALL_DOCDIR}/licenses COMPONENT ${BINARY_NAME})
@ -1036,6 +1016,25 @@ else()
add_custom_target(LICENSE ALL DEPENDS LICENSE.txt)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CHANGES.txt ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT ${BINARY_NAME})
if(DISTBUILD AND WIN32)
set(BIN_DIR ".\\")
string(REGEX REPLACE "[^-A-Za-z0-9_.]" "-" CLEAN_VERSION_STRING "${VERSION_STRING}")
file(RELATIVE_PATH SETUP_DIR_SLASH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/setup")
file(RELATIVE_PATH RES_DIR_SLASH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/res")
string(REPLACE "/" "\\" SETUP_DIR "${SETUP_DIR_SLASH}")
string(REPLACE "/" "\\" RES_DIR "${RES_DIR_SLASH}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES ".*64$")
set(WIN_BITS 64)
else()
set(WIN_BITS 32)
endif()
if(GIT_TAG)
set(IS_RELEASE 1)
else()
set(IS_RELEASE 0)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/setup/setup.iss.in" setup.iss)
set_source_files_properties(setup.iss PROPERTIES GENERATED ON)
if(INSTALLER_NAME)
set(INSTALLER_TARGET "${INSTALLER_NAME}.exe")
set(ISCC_FLAGS "/F${INSTALLER_NAME}")
@ -1045,15 +1044,14 @@ else()
if(CMAKE_CROSSCOMPILING)
find_program(WINE NAMES wine wine-stable wine-development)
find_file(ISCC ISCC.exe HINTS "$ENV{HOME}/.wine/drive_c/Program Files/" PATH_SUFFIXES "Inno Setup 5")
message(STATUS "${WINE}" "${ISCC}" setup.iss /Q ${ISCC_FLAGS})
add_custom_command(OUTPUT ${INSTALLER_TARGET}
COMMAND "${WINE}" "${ISCC}" setup.iss /Q ${ISCC_FLAGS}
DEPENDS ${BINARY_NAME}-qt ${BINARY_NAME}-sdl CHANGES LICENSE)
DEPENDS ${BINARY_NAME}-qt ${BINARY_NAME}-sdl setup.iss CHANGES LICENSE)
else()
find_program(ISCC NAMES ISCC ISCC.exe PATH_SUFFIXES "Inno Setup 5")
add_custom_command(OUTPUT ${INSTALLER_TARGET}
COMMAND "${ISCC}" setup.iss /Q ${ISCC_FLAGS}
DEPENDS ${BINARY_NAME}-qt ${BINARY_NAME}-sdl CHANGES LICENSE)
DEPENDS ${BINARY_NAME}-qt ${BINARY_NAME}-sdl setup.iss CHANGES LICENSE)
endif()
if(ISCC)
add_custom_target(installer ALL DEPENDS ${INSTALLER_TARGET})