Add cmake TRANSLATIONS_ONLY for translations.zip.

Builds translations.zip and nothing else.

This is for the nightly builder when only translations are changed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2021-12-19 13:57:05 +00:00
parent ea9d95dfa0
commit a5b2d070dc
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
4 changed files with 355 additions and 347 deletions

View File

@ -798,7 +798,9 @@ if(X86_64)
add_definitions(-D__AMD64__ -D__X86_64__) add_definitions(-D__AMD64__ -D__X86_64__)
endif() endif()
add_subdirectory (fex) if(NOT TRANSLATIONS_ONLY)
add_subdirectory(fex)
endif()
set( set(
SRC_MAIN SRC_MAIN
@ -1074,7 +1076,8 @@ if(ENABLE_FFMPEG)
) )
endif() endif()
add_library( if(NOT TRANSLATIONS_ONLY)
add_library(
vbamcore vbamcore
STATIC STATIC
${PROJECT_SRCS} ${PROJECT_SRCS}
@ -1091,12 +1094,13 @@ add_library(
${SRC_DEBUGGER} ${SRC_DEBUGGER}
${HDR_DEBUGGER} ${HDR_DEBUGGER}
${HDR_STB_IMAGE} ${HDR_STB_IMAGE}
) )
add_dependencies(vbamcore generate) add_dependencies(vbamcore generate)
set_property(TARGET vbamcore PROPERTY CXX_STANDARD 11) set_property(TARGET vbamcore PROPERTY CXX_STANDARD 11)
set_property(TARGET vbamcore PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET vbamcore PROPERTY CXX_STANDARD_REQUIRED ON)
endif()
if(ENABLE_SDL) if((NOT TRANSLATIONS_ONLY) AND ENABLE_SDL)
add_executable( add_executable(
vbam vbam
WIN32 WIN32

View File

@ -203,6 +203,7 @@ Here is the complete list:
| SSP_STATIC | Try to link static gcc stack protector library (gcc only) | OFF except Win32 | | SSP_STATIC | Try to link static gcc stack protector library (gcc only) | OFF except Win32 |
| OPENAL_STATIC | Try to link static OpenAL libraries | OFF | | OPENAL_STATIC | Try to link static OpenAL libraries | OFF |
| SSP_STATIC | Link gcc stack protecter libssp statically (gcc, with ENABLE_SSP) | OFF | | SSP_STATIC | Link gcc stack protecter libssp statically (gcc, with ENABLE_SSP) | OFF |
| TRANSLATIONS_ONLY | Build only the translations.zip and nothing else | OFF |
Note for distro packagers, we use the CMake module Note for distro packagers, we use the CMake module
[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs) [GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs)

View File

@ -5,4 +5,4 @@ gettext_create_translations(
${po_files} ${po_files}
) )
add_dependencies(visualboyadvance-m translations) add_dependencies(translations-zip translations)

View File

@ -281,7 +281,8 @@ else()
if((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) if((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
AND NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING
AND NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD) AND NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD
AND NOT TRANSLATIONS_ONLY)
set(ABI_CHECK TRUE) set(ABI_CHECK TRUE)
endif() endif()
@ -865,7 +866,8 @@ if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks") set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks")
endif() endif()
add_executable( if(NOT TRANSLATIONS_ONLY)
add_executable(
visualboyadvance-m visualboyadvance-m
WIN32 WIN32
MACOSX_BUNDLE MACOSX_BUNDLE
@ -874,9 +876,9 @@ add_executable(
${RES_WX} ${RES_WX}
${VBAM_ICON_PATH} ${VBAM_ICON_PATH}
${CM_STUFF} ${CM_STUFF}
) )
if(WIN32 AND (X86_64 OR X86_32) AND ENABLE_ONLINEUPDATES) if(WIN32 AND (X86_64 OR X86_32) AND ENABLE_ONLINEUPDATES)
if(NOT DEFINED WINSPARKLE_BIN_RELEASE_DIR) if(NOT DEFINED WINSPARKLE_BIN_RELEASE_DIR)
set(WINSPARKLE_BIN_RELEASE_DIR ${CMAKE_SOURCE_DIR}/dependencies/WinSparkle-0.6.0) set(WINSPARKLE_BIN_RELEASE_DIR ${CMAKE_SOURCE_DIR}/dependencies/WinSparkle-0.6.0)
endif() endif()
@ -893,9 +895,9 @@ if(WIN32 AND (X86_64 OR X86_32) AND ENABLE_ONLINEUPDATES)
endif() endif()
configure_file(autoupdater/wxmsw/winsparkle-path.h.in ${CMAKE_BINARY_DIR}/winsparkle-path.h) configure_file(autoupdater/wxmsw/winsparkle-path.h.in ${CMAKE_BINARY_DIR}/winsparkle-path.h)
endif() endif()
if(APPLE AND ENABLE_ONLINEUPDATES) if(APPLE AND ENABLE_ONLINEUPDATES)
include(FetchContent) include(FetchContent)
FetchContent_Declare(Sparkle FetchContent_Declare(Sparkle
@ -935,17 +937,17 @@ if(APPLE AND ENABLE_ONLINEUPDATES)
) )
TARGET_LINK_LIBRARIES(visualboyadvance-m ${SPARKLE_FRAMEWORK}) TARGET_LINK_LIBRARIES(visualboyadvance-m ${SPARKLE_FRAMEWORK})
endif() endif()
target_link_libraries( target_link_libraries(
visualboyadvance-m visualboyadvance-m
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${VBAM_LIBS} ${VBAM_LIBS}
) )
set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid) set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid)
if(ENABLE_FFMPEG) if(ENABLE_FFMPEG)
if(WIN32) if(WIN32)
list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS}) list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS})
endif() endif()
@ -963,11 +965,11 @@ if(ENABLE_FFMPEG)
PROPERTIES LINK_FLAGS ${FFMPEG_LDFLAGS_STR} PROPERTIES LINK_FLAGS ${FFMPEG_LDFLAGS_STR}
) )
endif() endif()
endif() endif()
# link libgcc/libstdc++ statically on mingw # link libgcc/libstdc++ statically on mingw
# and adjust link command when making a static binary # and adjust link command when making a static binary
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
if(WIN32) if(WIN32)
# Build a console app in debug mode on Windows # Build a console app in debug mode on Windows
if(CMAKE_BUILD_TYPE MATCHES Debug) if(CMAKE_BUILD_TYPE MATCHES Debug)
@ -995,37 +997,36 @@ if(CMAKE_COMPILER_IS_GNUCXX)
) )
endif() endif()
endif() endif()
elseif(MSVC) elseif(MSVC)
# the debug lib libcmtd is linked in debug mode, so don't link the normal version # the debug lib libcmtd is linked in debug mode, so don't link the normal version
set_target_properties(visualboyadvance-m PROPERTIES LINK_FLAGS_DEBUG "/nodefaultlib:libcmt /subsystem:console") set_target_properties(visualboyadvance-m PROPERTIES LINK_FLAGS_DEBUG "/nodefaultlib:libcmt /subsystem:console")
endif() endif()
# Make the app a console app in debug mode to get log messages. # Make the app a console app in debug mode to get log messages.
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug) if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_definitions(visualboyadvance-m PRIVATE -DWIN32_CONSOLE_APP) target_compile_definitions(visualboyadvance-m PRIVATE -DWIN32_CONSOLE_APP)
endif() endif()
if(NOT WIN32 AND NOT APPLE) if(NOT WIN32 AND NOT APPLE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/visualboyadvance-m.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/visualboyadvance-m.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/visualboyadvance-m.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/appdata) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/visualboyadvance-m.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/appdata)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/icons/sizes/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/icons/sizes/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor)
endif()
endif() endif()
option(TRANSLATIONS_ONLY "Build only the translations.zip" OFF)
# Make the translations.zip for windows builds. # Make the translations.zip for windows builds.
if(ENABLE_NLS AND WIN32) if(ENABLE_NLS)
file(GLOB catalogs ${CMAKE_BINARY_DIR}/po/wxvbam/*.gmo) file(GLOB catalogs ${CMAKE_BINARY_DIR}/po/wxvbam/*.gmo)
add_custom_command( add_custom_target(
OUTPUT ${CMAKE_BINARY_DIR}/translations.zip translations-zip ALL
COMMAND ${CMAKE_COMMAND} -D "ZIP_PROGRAM=${ZIP_PROGRAM}" -P ${CMAKE_CURRENT_SOURCE_DIR}/make-translations-zip.cmake COMMAND ${CMAKE_COMMAND} -D "ZIP_PROGRAM=${ZIP_PROGRAM}" -P ${CMAKE_CURRENT_SOURCE_DIR}/make-translations-zip.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS translations make-translations-zip.cmake ${catalogs} DEPENDS translations make-translations-zip.cmake ${catalogs}
) )
add_custom_target(translations-zip DEPENDS ${CMAKE_BINARY_DIR}/translations.zip)
add_dependencies(visualboyadvance-m translations-zip)
endif() endif()
# Update the gettext pot source. # Update the gettext pot source.
@ -1051,33 +1052,34 @@ if(ENABLE_NLS)
add_dependencies(gettext-pot xrc-strings) add_dependencies(gettext-pot xrc-strings)
add_dependencies(visualboyadvance-m gettext-pot) add_dependencies(translations-zip gettext-pot)
add_custom_command( add_custom_command(
TARGET visualboyadvance-m TARGET translations-zip
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -D SRC_DIR=${CMAKE_SOURCE_DIR}/po/wxvbam -D BIN_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/check-pot-updated.cmake COMMAND ${CMAKE_COMMAND} -D SRC_DIR=${CMAKE_SOURCE_DIR}/po/wxvbam -D BIN_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/check-pot-updated.cmake
) )
endif() endif()
find_program(GPG_PROGRAM gpg) if(NOT TRANSLATIONS_ONLY)
find_program(GPG_PROGRAM gpg)
if(GPG_PROGRAM) if(GPG_PROGRAM)
execute_process( execute_process(
COMMAND ${GPG_PROGRAM} -k COMMAND ${GPG_PROGRAM} -k
OUTPUT_VARIABLE GPG_KEYS OUTPUT_VARIABLE GPG_KEYS
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET ERROR_QUIET
) )
endif() endif()
option(ZIP_SUFFIX [=[suffix for release zip files, e.g. "-somebranch".zip]=] OFF) option(ZIP_SUFFIX [=[suffix for release zip files, e.g. "-somebranch".zip]=] OFF)
if(NOT ZIP_SUFFIX) if(NOT ZIP_SUFFIX)
set(ZIP_SUFFIX "") set(ZIP_SUFFIX "")
endif() endif()
if(UPSTREAM_RELEASE AND WIN32) if(UPSTREAM_RELEASE AND WIN32)
set(home "$ENV{HOME}") set(home "$ENV{HOME}")
if(NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{MSYSTEM_PREFIX}) if(NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{MSYSTEM_PREFIX})
@ -1135,7 +1137,7 @@ if(UPSTREAM_RELEASE AND WIN32)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/translations.zip.asc OUTPUT ${CMAKE_BINARY_DIR}/translations.zip.asc
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/translations.zip.asc COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/translations.zip.asc
# COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake # COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake
COMMAND ${GPG_PROGRAM} --detach-sign -a ${CMAKE_BINARY_DIR}/translations.zip COMMAND ${GPG_PROGRAM} --detach-sign -a ${CMAKE_BINARY_DIR}/translations.zip
DEPENDS translations-zip DEPENDS translations-zip
) )
@ -1148,7 +1150,7 @@ if(UPSTREAM_RELEASE AND WIN32)
TARGET visualboyadvance-m TARGET visualboyadvance-m
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove ${exezip}.asc COMMAND ${CMAKE_COMMAND} -E remove ${exezip}.asc
# COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake # COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake
COMMAND ${GPG_PROGRAM} --detach-sign -a ${exezip} COMMAND ${GPG_PROGRAM} --detach-sign -a ${exezip}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
@ -1166,9 +1168,9 @@ if(UPSTREAM_RELEASE AND WIN32)
) )
endif() endif()
endif() endif()
endif() endif()
if(APPLE) if(APPLE)
# this should set ROM file types correctly # this should set ROM file types correctly
set_property(TARGET visualboyadvance-m APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in) set_property(TARGET visualboyadvance-m APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in)
set(MACOSX_BUNDLE_ICON_FILE ${VBAM_ICON}) set(MACOSX_BUNDLE_ICON_FILE ${VBAM_ICON})
@ -1190,9 +1192,9 @@ if(APPLE)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
endif() endif()
endif() endif()
if(APPLE AND (UPSTREAM_RELEASE OR ENABLE_ONLINEUPDATES)) if(APPLE AND (UPSTREAM_RELEASE OR ENABLE_ONLINEUPDATES))
if(NOT CMAKE_BUILD_TYPE MATCHES Debug) if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
find_program(STRIP_PROGRAM strip) find_program(STRIP_PROGRAM strip)
@ -1247,15 +1249,15 @@ if(APPLE AND (UPSTREAM_RELEASE OR ENABLE_ONLINEUPDATES))
TARGET visualboyadvance-m TARGET visualboyadvance-m
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove ${appzip}.asc COMMAND ${CMAKE_COMMAND} -E remove ${appzip}.asc
# COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake # COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake
COMMAND ${GPG_PROGRAM} --detach-sign -a ${appzip} COMMAND ${GPG_PROGRAM} --detach-sign -a ${appzip}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
endif() endif()
endif() endif()
endif() endif()
if(UPSTREAM_RELEASE AND NOT WIN32 AND NOT APPLE AND NOT CMAKE_BUILD_TYPE MATCHES Debug) if(UPSTREAM_RELEASE AND NOT WIN32 AND NOT APPLE AND NOT CMAKE_BUILD_TYPE MATCHES Debug)
find_program(STRIP_PROGRAM strip) find_program(STRIP_PROGRAM strip)
if(STRIP_PROGRAM) if(STRIP_PROGRAM)
@ -1266,16 +1268,17 @@ if(UPSTREAM_RELEASE AND NOT WIN32 AND NOT APPLE AND NOT CMAKE_BUILD_TYPE MATCHES
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
endif() endif()
endif() endif()
install( install(
TARGETS visualboyadvance-m TARGETS visualboyadvance-m
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(BUILD_TESTING AND (NOT CMAKE_CROSSCOMPILING)) if(BUILD_TESTING AND (NOT CMAKE_CROSSCOMPILING))
add_subdirectory(tests) add_subdirectory(tests)
endif()
endif() endif()
# vim:sw=4 et tw=0: # vim:sw=4 et tw=0: