From c2fdf9f96b72909f99338bb6a1e6de790ef39c9e Mon Sep 17 00:00:00 2001 From: pivotiiii <17112987+pivotiiii@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:13:06 +0200 Subject: [PATCH] add github ubuntu action, update tclap for gcc>9 --- .github/workflows/ubuntu.yml | 74 +++++++++++++ .github/workflows/windows.yml | 3 +- dependencies.cmake | 4 +- patches/tclap.patch | 195 ++++++++++++++++++++++++++-------- src/Game.cpp | 2 - 5 files changed, 231 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/ubuntu.yml diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 0000000..9847d23 --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,74 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: Build and test on Ubuntu. +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ununtu-latest + c_compiler: gcc-9 + cpp_compiler: g++-9 + + steps: + - uses: actions/checkout@v4 + - name: Cache + uses: actions/cache@v4.0.2 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: ${{github.workspace}}/build/_deps/*-src + # An explicit key for restoring and saving the cache + key: ${{ runner.os }}-build-${{matrix.c_compiler}}-${{hashFiles('dependencies.cmake', 'patches/*.patch')}} + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -B ${{github.workspace}}/build + -S ${{github.workspace}} + -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DCMAKE_CXX_COMPILER=${{matrix.cpp_compiler}} + -DCMAKE_C_COMPILER=${{matrix.c_compiler}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} + + - name: Pack + working-directory: ${{github.workspace}}/build + run: cpack -G ZIP -C ${{env.BUILD_TYPE}} + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4.3.3 + with: + name: nsui_banner_fixer_ubuntu_${{matrix.c_compiler}}_${{env.BUILD_TYPE}} + path: | + ${{github.workspace}}/build/_CPack_Packages/Linux/ZIP/* + !${{github.workspace}}/build/_CPack_Packages/Linux/ZIP/*.zip diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d7e9511..15b25e0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -66,6 +66,7 @@ jobs: path: | ${{github.workspace}}/build_${{matrix.arch}}/_CPack_Packages/win32/ZIP/* ${{github.workspace}}/build_${{matrix.arch}}/_CPack_Packages/win64/ZIP/* - !${{github.workspace}}/build_${{matrix.arch}}/_CPack_Packages/*/ZIP/*.zip + !${{github.workspace}}/build_${{matrix.arch}}/_CPack_Packages/win32/ZIP/*.zip + !${{github.workspace}}/build_${{matrix.arch}}/_CPack_Packages/win64/ZIP/*.zip if-no-files-found: ignore diff --git a/dependencies.cmake b/dependencies.cmake index 4bdd90f..613991b 100644 --- a/dependencies.cmake +++ b/dependencies.cmake @@ -13,8 +13,8 @@ list(APPEND CMAKE_MODULE_PATH "${cmakehelpers_SOURCE_DIR}") FetchContent_Declare( tclap - GIT_REPOSITORY https://github.com/mirror/tclap.git - GIT_TAG 799a8b1f99818e39fee19d0601030770af1221e1 #v1.4.0-rc1 + GIT_REPOSITORY https://git.code.sf.net/p/tclap/code + GIT_TAG 4dd8ae4d5c7354db2f38acd76a226e593522c68f # PATCH_COMMAND git apply "${CMAKE_SOURCE_DIR}/patches/tclap.patch" UPDATE_DISCONNECTED 1 ) diff --git a/patches/tclap.patch b/patches/tclap.patch index 2dd8d49..7d63be4 100644 --- a/patches/tclap.patch +++ b/patches/tclap.patch @@ -1,62 +1,174 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index c2c9a26..e40e55a 100644 +index f92ecb0..c26ef95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -4,10 +4,12 @@ project(TCLAP VERSION 1.4.0 LANGUAGES CXX) +@@ -1,20 +1,11 @@ + cmake_minimum_required(VERSION 3.7) + + project(TCLAP VERSION 1.4.0 LANGUAGES CXX) +-set("PROJECT_DESCRIPTION" "A header-only templatized C++ command line parser library") +-set("PROJECT_HOMEPAGE_URL" "https://sourceforge.net/projects/tclap/") set(CMAKE_CXX_STANDARD 98) set(CMAKE_CXX_STANDARD_REQUIRED True) --add_definitions(-DHAVE_TCLAP_CONFIG_H) + add_definitions(-DHAVE_TCLAP_CONFIG_H) -enable_testing() -include(CTest) -+option(TCLAP_TESTS "enable tclap tests" OFF) -+option(TCLAP_EXAMPLES "enable tclap examples" OFF) -+option(TCLAP_DOCS "enable tclap documentation" OFF) -+ -+add_definitions(-DHAVE_TCLAP_CONFIG_H) - +-include(CPackComponent) +-include(GNUInstallDirs) +-include(CMakePackageConfigHelpers) +-string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}") +- include(CheckCXXSourceCompiles) check_cxx_source_compiles("#include -@@ -18,14 +20,23 @@ int main() { std::istringstream iss; }" TCLAP_HAVE_SSTREAM) + int main() { std::istrstream iss; }" TCLAP_HAVE_STRSTREAM) +@@ -28,129 +19,5 @@ set(GENERATED_CONFIG_BUILD_PATH "${GENERATED_CONFIG_BUILD_DIR}/${GENERATED_CONFI - configure_file(config.h.in tclap/TCLAPConfig.h) + configure_file(config.h.in "${GENERATED_CONFIG_BUILD_PATH}") --add_library(TCLAP INTERFACE) -+file(GLOB tclap_headers include/tclap/*.h) -+add_library(TCLAP INTERFACE ${tclap_headers}) - target_include_directories(TCLAP INTERFACE include/) --install(TARGETS TCLAP DESTINATION include) --install(FILES "${PROJECT_BINARY_DIR}/tclap/TCLAPConfig.h" +-cpack_add_component(lib +- DISPLAY_NAME "library" +- DESCRIPTION "The header-only library" +- REQUIRED +-) +- + add_library(TCLAP INTERFACE) +-target_include_directories(TCLAP INTERFACE +- $ +- $ +-) +- +-install(TARGETS TCLAP EXPORT TCLAP +- INCLUDES +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +-) +-install(FILES "${GENERATED_CONFIG_BUILD_PATH}" - DESTINATION include/tclap -- ) +- COMPONENT lib +-) +- - --add_subdirectory(docs) --add_subdirectory(examples) +-if(DOC_INSTALL_DIR) +-else() +- if(WIN32) +- set(DOC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/doc) +- else() +- set(DOC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/tclap) +- endif() +-endif() +- +-cpack_add_component(doc +- DISPLAY_NAME "documentation" +- DESCRIPTION "Documentation files for TCLAP" +-) +- +-install(DIRECTORY ${PROJECT_BINARY_DIR}/docs/html +- DESTINATION ${DOC_INSTALL_DIR} +- COMPONENT doc +-) +-install(FILES ${PROJECT_BINARY_DIR}/docs/index.html ${PROJECT_BINARY_DIR}/docs/manual.html +- ${PROJECT_BINARY_DIR}/docs/style.css DESTINATION ${DOC_INSTALL_DIR} +- COMPONENT doc +-) +- +-option(BUILD_EXAMPLES "Build examples" ON) +-option(BUILD_UNITTESTS "Build unit tests" ON) +-option(BUILD_DOC "Build documentation" ON) +- +-if(BUILD_DOC) +- add_subdirectory(docs) +-endif() +-if(BUILD_EXAMPLES) +- add_subdirectory(examples) +-endif() -add_subdirectory(tests) +-if(BUILD_UNITTESTS) +- add_subdirectory(unittests) +-endif() -add_subdirectory(include/tclap) -+#install(TARGETS TCLAP DESTINATION include) -+#install(FILES "${PROJECT_BINARY_DIR}/tclap/TCLAPConfig.h" -+# DESTINATION include/tclap -+# ) -+ -+if(TCLAP_DOCS) -+ add_subdirectory(docs) -+endif() -+if(TCLAP_EXAMPLES) -+ add_subdirectory(examples) -+endif() -+if(TCLAP_TESTS) -+ enable_testing() -+ include(CTest) -+ add_subdirectory(tests) -+endif() -+#add_subdirectory(include/tclap) +- +-set(PackagingTemplatesDir "${CMAKE_CURRENT_SOURCE_DIR}/packaging") +- +- +-set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +-set(CPACK_PACKAGE_VENDOR "tclap developers") +-set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}") +-set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") +-set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") +-set(CPACK_PACKAGE_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}") +-set(CPACK_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}") +-set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_MAINTAINER}") +-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") +-set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") +- +-set(CPACK_DEBIAN_LIB_PACKAGE_NAME "lib${PROJECT_NAME}-dev") +-set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libc6-dev") +-set(CPACK_DEBIAN_LIB_PACKAGE_SUGGESTS "cmake, pkg-config, pkg-conf") +- +-set(CPACK_DEBIAN_DOC_PACKAGE_NAME "${PROJECT_NAME}-dev") +- +-set(CPACK_RPM_LIB_PACKAGE_NAME "lib${PROJECT_NAME}-devel") +-set(CPACK_RPM_LIB_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}") +- +-set(CPACK_RPM_DOC_PACKAGE_NAME "${PROJECT_NAME}-doc") +- +-set(CPACK_DEB_COMPONENT_INSTALL ON) +-set(CPACK_RPM_COMPONENT_INSTALL ON) +-set(CPACK_NSIS_COMPONENT_INSTALL ON) +-set(CPACK_DEBIAN_COMPRESSION_TYPE "xz") +- +-set(PKGCONFIG_NAME "tclap") +-set(PKG_CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_NAME}.pc") +-configure_file("${PackagingTemplatesDir}/pkgconfig.pc.in" "${PKG_CONFIG_FILE_NAME}" @ONLY) +-install(FILES "${PKG_CONFIG_FILE_NAME}" +- DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig" +- COMPONENT lib +-) +- +-set(CONFIG_FILE_NAME_WITHOUT_EXT "${PROJECT_NAME}Config") +-set(CMAKE_CONFIG_VERSION_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_FILE_NAME_WITHOUT_EXT}-version.cmake") +-set(CMAKE_CONFIG_FILE_NAME "${CONFIG_FILE_NAME_WITHOUT_EXT}.cmake") +-set(CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME}") +- +-install(EXPORT TCLAP +- NAMESPACE TCLAP:: +- FILE "${CMAKE_CONFIG_FILE_NAME}" +- DESTINATION "${CMAKE_CONFIG_DESTINATION}" +- COMPONENT lib +-) +- +-if(${CMAKE_VERSION} VERSION_GREATER "3.14") +- set(OPTIONAL_ARCH_INDEPENDENT "ARCH_INDEPENDENT") +-endif() +- +-write_basic_package_version_file("${CMAKE_CONFIG_VERSION_FILE_NAME}" +- COMPATIBILITY AnyNewerVersion +- ${OPTIONAL_ARCH_INDEPENDENT} +-) +- +-install(FILES "${CMAKE_CONFIG_VERSION_FILE_NAME}" +- DESTINATION "${CMAKE_CONFIG_DESTINATION}" +- COMPONENT lib +-) +- +-include(CPack) ++target_include_directories(TCLAP INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) +diff --git a/include/tclap/CMakeLists.txt b/include/tclap/CMakeLists.txt +deleted file mode 100644 +index 79bad0b..0000000 +--- a/include/tclap/CMakeLists.txt ++++ /dev/null +@@ -1,4 +0,0 @@ +-file(GLOB HEADER_FILES *.h) +- +-#target_sources(TCLAP INTERFACE ${HEADER_FILES}) +-install(FILES ${HEADER_FILES} DESTINATION include/tclap COMPONENT lib) diff --git a/include/tclap/CmdLine.h b/include/tclap/CmdLine.h -index d75a944..c9e6177 100644 +index d75a944..42e4b09 100644 --- a/include/tclap/CmdLine.h +++ b/include/tclap/CmdLine.h -@@ -346,17 +346,18 @@ inline void CmdLine::_constructor() { +@@ -346,17 +346,17 @@ inline void CmdLine::_constructor() { _autoArgs.setParser(*this); // add(_autoArgs); @@ -74,14 +186,13 @@ index d75a944..c9e6177 100644 + v = new IgnoreRestVisitor(*this); + SwitchArg *ignore = new SwitchArg( + Arg::flagStartString(), Arg::ignoreNameString(), -+ "Ignores the rest of the labeled arguments following this flag.", false, -+ v); ++ "Ignores the rest of the labeled arguments following this flag.", ++ false, v); + _deleteOnExit(ignore); + _deleteOnExit(v); + _autoArgs.add(ignore); + addToArgList(ignore); + -+ v = new HelpVisitor(this, &_output); SwitchArg *help = new SwitchArg( "h", "help", "Displays usage information and exits.", false, v); diff --git a/src/Game.cpp b/src/Game.cpp index edf0f9c..8cc44f3 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -3,8 +3,6 @@ #include #include -#include - #include "Game.hpp" #if defined(_WIN32)