Skip to content

Commit

Permalink
Merge pull request #2115 from joto/cmdline-parser
Browse files Browse the repository at this point in the history
Use CLI11 command line parser library
  • Loading branch information
lonvia authored Jan 7, 2024
2 parents 4a8f42b + 482719e commit 59bb561
Show file tree
Hide file tree
Showing 38 changed files with 12,779 additions and 726 deletions.
20 changes: 0 additions & 20 deletions .github/actions/win-getopt/action.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,6 @@ jobs:
runs-on: ${{ matrix.os }}

env:
GETOPT_INCLUDE_DIR: ${{ github.workspace }}/../wingetopt/src
GETOPT_LIBRARY: ${{ github.workspace }}/../wingetopt/build/Release/wingetopt.lib
VCPKG_DEFAULT_BINARY_CACHE: C:/vcpkg_binary_cache

steps:
Expand All @@ -428,7 +426,6 @@ jobs:
shell: bash
- uses: ./.github/actions/win-postgres
- uses: ./.github/actions/win-install
- uses: ./.github/actions/win-getopt
- uses: ./.github/actions/win-cmake
- uses: ./.github/actions/win-build
- uses: ./.github/actions/win-test
Expand Down
17 changes: 6 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ endif()
option(EXTERNAL_LIBOSMIUM "Do not use the bundled libosmium" OFF)
option(EXTERNAL_PROTOZERO "Do not use the bundled protozero" OFF)
option(EXTERNAL_FMT "Do not use the bundled fmt" OFF)
option(EXTERNAL_CLI11 "Do not use the bundled CLI11" OFF)

set(USE_PROJ_LIB "auto" CACHE STRING "Which version of PROJ API to use: ('4', '6', 'off', or 'auto')")

Expand Down Expand Up @@ -175,10 +176,14 @@ if (NOT EXTERNAL_FMT)
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/contrib/fmt/include")
endif()

if (NOT EXTERNAL_CLI11)
set(CLI11_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/contrib/CLI11/include")
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR})

find_package(Osmium 2.17.3 REQUIRED COMPONENTS io)
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS} ${PROTOZERO_INCLUDE_DIR} ${FMT_INCLUDE_DIR})
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS} ${PROTOZERO_INCLUDE_DIR} ${FMT_INCLUDE_DIR} ${CLI11_INCLUDE_DIR})

if (WITH_LUA)
if (WITH_LUAJIT)
Expand Down Expand Up @@ -261,16 +266,6 @@ endif()

if (WIN32)
list(APPEND LIBS ws2_32)
if (MSVC)
find_path(GETOPT_INCLUDE_DIR getopt.h)
find_library(GETOPT_LIBRARY NAMES wingetopt getopt)
if (GETOPT_INCLUDE_DIR AND GETOPT_LIBRARY)
include_directories(SYSTEM ${GETOPT_INCLUDE_DIR})
list(APPEND LIBS ${GETOPT_LIBRARY})
else()
message(FATAL_ERROR "Can not find getopt library for Windows. Please get it from https://github.com/alex85k/wingetopt or alternative source.")
endif()
endif()
endif()

message(STATUS "Libraries used to build: ${LIBS}")
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ to configure and build itself.

Required libraries are

* [CLI11](https://github.com/CLIUtils/CLI11)
* [expat](https://libexpat.github.io/)
* [proj](https://proj.org/)
* [bzip2](http://www.bzip.org/)
Expand Down
25 changes: 25 additions & 0 deletions contrib/CLI11/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CLI11 2.2 Copyright (c) 2017-2023 University of Cincinnati, developed by Henry
Schreiner under NSF AWARD 1414736. All rights reserved.

Redistribution and use in source and binary forms of CLI11, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions contrib/CLI11/README.contrib
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Source: https://github.com/CLIUtils/CLI11
Revision: v2.3.2
Loading

0 comments on commit 59bb561

Please sign in to comment.