Skip to content

Commit 59bb561

Browse files
authored
Merge pull request #2115 from joto/cmdline-parser
Use CLI11 command line parser library
2 parents 4a8f42b + 482719e commit 59bb561

38 files changed

+12779
-726
lines changed

.github/actions/win-getopt/action.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,6 @@ jobs:
405405
runs-on: ${{ matrix.os }}
406406

407407
env:
408-
GETOPT_INCLUDE_DIR: ${{ github.workspace }}/../wingetopt/src
409-
GETOPT_LIBRARY: ${{ github.workspace }}/../wingetopt/build/Release/wingetopt.lib
410408
VCPKG_DEFAULT_BINARY_CACHE: C:/vcpkg_binary_cache
411409

412410
steps:
@@ -428,7 +426,6 @@ jobs:
428426
shell: bash
429427
- uses: ./.github/actions/win-postgres
430428
- uses: ./.github/actions/win-install
431-
- uses: ./.github/actions/win-getopt
432429
- uses: ./.github/actions/win-cmake
433430
- uses: ./.github/actions/win-build
434431
- uses: ./.github/actions/win-test

CMakeLists.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ endif()
5555
option(EXTERNAL_LIBOSMIUM "Do not use the bundled libosmium" OFF)
5656
option(EXTERNAL_PROTOZERO "Do not use the bundled protozero" OFF)
5757
option(EXTERNAL_FMT "Do not use the bundled fmt" OFF)
58+
option(EXTERNAL_CLI11 "Do not use the bundled CLI11" OFF)
5859

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

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

179+
if (NOT EXTERNAL_CLI11)
180+
set(CLI11_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/contrib/CLI11/include")
181+
endif()
182+
178183
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR})
179184

180185
find_package(Osmium 2.17.3 REQUIRED COMPONENTS io)
181-
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS} ${PROTOZERO_INCLUDE_DIR} ${FMT_INCLUDE_DIR})
186+
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS} ${PROTOZERO_INCLUDE_DIR} ${FMT_INCLUDE_DIR} ${CLI11_INCLUDE_DIR})
182187

183188
if (WITH_LUA)
184189
if (WITH_LUAJIT)
@@ -261,16 +266,6 @@ endif()
261266

262267
if (WIN32)
263268
list(APPEND LIBS ws2_32)
264-
if (MSVC)
265-
find_path(GETOPT_INCLUDE_DIR getopt.h)
266-
find_library(GETOPT_LIBRARY NAMES wingetopt getopt)
267-
if (GETOPT_INCLUDE_DIR AND GETOPT_LIBRARY)
268-
include_directories(SYSTEM ${GETOPT_INCLUDE_DIR})
269-
list(APPEND LIBS ${GETOPT_LIBRARY})
270-
else()
271-
message(FATAL_ERROR "Can not find getopt library for Windows. Please get it from https://github.com/alex85k/wingetopt or alternative source.")
272-
endif()
273-
endif()
274269
endif()
275270

276271
message(STATUS "Libraries used to build: ${LIBS}")

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ to configure and build itself.
4343

4444
Required libraries are
4545

46+
* [CLI11](https://github.com/CLIUtils/CLI11)
4647
* [expat](https://libexpat.github.io/)
4748
* [proj](https://proj.org/)
4849
* [bzip2](http://www.bzip.org/)

contrib/CLI11/LICENSE

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CLI11 2.2 Copyright (c) 2017-2023 University of Cincinnati, developed by Henry
2+
Schreiner under NSF AWARD 1414736. All rights reserved.
3+
4+
Redistribution and use in source and binary forms of CLI11, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
3. Neither the name of the copyright holder nor the names of its contributors
13+
may be used to endorse or promote products derived from this software without
14+
specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

contrib/CLI11/README.contrib

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Source: https://github.com/CLIUtils/CLI11
2+
Revision: v2.3.2

0 commit comments

Comments
 (0)