mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-03 14:03:52 +00:00
Python 2.6 support, SINGLE_FILE no longer defaults to ON
This commit is contained in:
parent
521696f551
commit
f3b00d94d1
@ -8,7 +8,7 @@ set -evx
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. -DCLI11_CXX_STD=$STD -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@
|
||||
cmake .. -DCLI11_SINGLE_FILE=ON -DCLI11_CXX_STD=$STD -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@
|
||||
cmake --build . -- -j2
|
||||
|
||||
set +evx
|
||||
|
@ -112,33 +112,16 @@ export(TARGETS CLI11
|
||||
# Register in the user cmake package registry
|
||||
export(PACKAGE CLI11)
|
||||
|
||||
# Single file test
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
set(Python_ADDITIONAL_VERSIONS 2.7 3.4 3.5 3.6 3.7 3.8)
|
||||
find_package(PythonInterp)
|
||||
set(Python_VERSION ${PYTHON_VERSION_STRING})
|
||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||
else()
|
||||
find_package(Python)
|
||||
endif()
|
||||
|
||||
if(Python_Interpreter_FOUND OR PYTHONINTERP_FOUND)
|
||||
if(Python_VERSION VERSION_LESS 2.7)
|
||||
set(CLI11_PYTHON_FOUND FALSE)
|
||||
else()
|
||||
set(CLI11_PYTHON_FOUND TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(CLI11_PYTHON_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(CLI11_SINGLE_FILE "Generate a single header file" ON "CUR_PROJ;CLI11_PYTHON_FOUND" OFF)
|
||||
option(CLI11_SINGLE_FILE "Generate a single header file" OFF)
|
||||
|
||||
if(CLI11_SINGLE_FILE)
|
||||
if(NOT CLI11_PYTHON_FOUND)
|
||||
message(FATAL_ERROR "CLI11_SINGLE_FILE requires Python 2.7 or 3 (not found)")
|
||||
# Single file test
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
find_package(PythonInterp REQUIRED)
|
||||
set(Python_VERSION ${PYTHON_VERSION_STRING})
|
||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||
else()
|
||||
message(STATUS "Building single file include using Python ${Python_VERSION} at ${Python_EXECUTABLE}")
|
||||
find_package(Python REQUIRED)
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include")
|
||||
|
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
||||
CLI11 1.5 Copyright (c) 2017-2018 University of Cincinnati, developed by Henry
|
||||
CLI11 1.6 Copyright (c) 2017-2018 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
|
||||
|
@ -9,7 +9,7 @@ import operator
|
||||
from copy import copy
|
||||
from functools import reduce
|
||||
|
||||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE)
|
||||
includes_system = re.compile(r"""^#include \<(.*)\>$""", re.MULTILINE)
|
||||
@ -112,12 +112,13 @@ class HeaderFile(object):
|
||||
def MakeHeader(output, main_header, include_dir = '../include', namespace=None, macro=None):
|
||||
# Set tag if possible to class variable
|
||||
try:
|
||||
proc = subprocess.Popen(['git', 'describe', '--tags', '--always'], cwd=str(DIR), stdout=subprocess.PIPE)
|
||||
proc = Popen(['git', 'describe', '--tags', '--always'], cwd=str(DIR), stdout=PIPE)
|
||||
out, _ = proc.communicate()
|
||||
if proc.returncode == 0:
|
||||
HeaderFile.TAG = out.decode("utf-8").strip()
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
if proc.returncode == 0:
|
||||
HeaderFile.TAG = out.decode("utf-8").strip()
|
||||
|
||||
base_dir = os.path.abspath(os.path.join(DIR, include_dir))
|
||||
main_header = os.path.join(base_dir, main_header)
|
||||
|
Loading…
x
Reference in New Issue
Block a user