Skip to content

Commit

Permalink
add github ubuntu action, update tclap for gcc>9
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotiiii committed Apr 28, 2024
1 parent 3e3fb90 commit c2fdf9f
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 47 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 2 additions & 2 deletions dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
195 changes: 153 additions & 42 deletions patches/tclap.patch
Original file line number Diff line number Diff line change
@@ -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 <strstream>
@@ -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_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
-)
-
-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);

Expand All @@ -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);
2 changes: 0 additions & 2 deletions src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <iostream>
#include <vector>

#include <boost/process.hpp>

#include "Game.hpp"

#if defined(_WIN32)
Expand Down

0 comments on commit c2fdf9f

Please sign in to comment.