summaryrefslogtreecommitdiffstats
path: root/flake.lock
blob: b85571b617888ecf5482f6716feba98988b2853d (plain)
1
2
3
4
5
6
7
8
9
10
{
    "inputs": {
        "nixpkgs": {
            "narHash": "sha256-rMiWaLXkhizEEMEeMDutUl0Y/c+VEjfjvMkvBwvuQJU=",
            "uri": "github:edolstra/nixpkgs/eeeffd24cd7e407cfaa99e98cfbb8f93bf4cc033"
        }
    },
    "nonFlakeInputs": {},
    "version": 1
}
on value='inactive/h5ocompare'>inactive/h5ocompare Mirror from: https://github.com/HDFGroup/hdf5.git
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-05-03 16:45:16 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2023-05-03 18:26:57 (GMT)
commit7df92eee39e904bb38e74ce5f7971ebc4886472b (patch)
treee15ab5693fa57f2a873173f1631d4515b77e6825
parentc75b4af1a2630ace445da1ec661191601583f79a (diff)
downloadhdf5-7df92eee39e904bb38e74ce5f7971ebc4886472b.zip
hdf5-7df92eee39e904bb38e74ce5f7971ebc4886472b.tar.gz
hdf5-7df92eee39e904bb38e74ce5f7971ebc4886472b.tar.bz2
Changes to isolate API Test option files and use fetchcontent (#2880)
Diffstat
-rw-r--r--config/cmake/cacheinit.cmake11
-rw-r--r--doxygen/dox/Overview.dox2
-rw-r--r--test/API/CMake/CheckAsan.cmake37
-rw-r--r--test/API/CMake/CheckUbsan.cmake37
-rw-r--r--test/API/CMakeLists.txt38
-rw-r--r--test/API/driver/CMakeLists.txt37
-rw-r--r--test/API/driver/kwsys/.clang-format22
-rw-r--r--test/API/driver/kwsys/.hooks-config2
-rw-r--r--test/API/driver/kwsys/Base64.c225
-rw-r--r--test/API/driver/kwsys/Base64.h.in110
-rw-r--r--test/API/driver/kwsys/CMakeLists.txt1260
-rw-r--r--test/API/driver/kwsys/CONTRIBUTING.rst49
-rw-r--r--test/API/driver/kwsys/CTestConfig.cmake9
-rw-r--r--test/API/driver/kwsys/CTestCustom.cmake.in14
-rw-r--r--test/API/driver/kwsys/CommandLineArguments.cxx768
-rw-r--r--test/API/driver/kwsys/CommandLineArguments.hxx.in270
-rw-r--r--test/API/driver/kwsys/Configure.h.in89
-rw-r--r--test/API/driver/kwsys/Configure.hxx.in65
-rw-r--r--test/API/driver/kwsys/ConsoleBuf.hxx.in398
-rw-r--r--test/API/driver/kwsys/Copyright.txt38
-rw-r--r--test/API/driver/kwsys/Directory.cxx236
-rw-r--r--test/API/driver/kwsys/Directory.hxx.in72
-rw-r--r--test/API/driver/kwsys/DynamicLoader.cxx495
-rw-r--r--test/API/driver/kwsys/DynamicLoader.hxx.in106
-rw-r--r--test/API/driver/kwsys/Encoding.h.in69
-rw-r--r--test/API/driver/kwsys/Encoding.hxx.in80
-rw-r--r--test/API/driver/kwsys/EncodingC.c72
-rw-r--r--test/API/driver/kwsys/EncodingCXX.cxx288
-rw-r--r--test/API/driver/kwsys/ExtraTest.cmake.in1
-rw-r--r--test/API/driver/kwsys/FStream.cxx55
-rw-r--r--test/API/driver/kwsys/FStream.hxx.in278
-rw-r--r--test/API/driver/kwsys/GitSetup/.gitattributes6
-rw-r--r--test/API/driver/kwsys/GitSetup/LICENSE202
-rw-r--r--test/API/driver/kwsys/GitSetup/NOTICE5
-rw-r--r--test/API/driver/kwsys/GitSetup/README87
-rw-r--r--test/API/driver/kwsys/GitSetup/config4
-rw-r--r--test/API/driver/kwsys/GitSetup/config.sample32
-rw-r--r--test/API/driver/kwsys/GitSetup/git-gerrit-push74
-rw-r--r--test/API/driver/kwsys/GitSetup/git-gitlab-push177
-rw-r--r--test/API/driver/kwsys/GitSetup/pre-commit26
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-aliases6
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-gerrit147
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-gitlab140
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-hooks64
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-ssh111
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-stage82
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-upstream104
-rw-r--r--test/API/driver/kwsys/GitSetup/setup-user39
-rw-r--r--test/API/driver/kwsys/GitSetup/tips55
-rw-r--r--test/API/driver/kwsys/Glob.cxx448
-rw-r--r--test/API/driver/kwsys/Glob.hxx.in134
-rw-r--r--test/API/driver/kwsys/IOStream.cxx255
-rw-r--r--test/API/driver/kwsys/IOStream.hxx.in126
-rw-r--r--test/API/driver/kwsys/MD5.c494
-rw-r--r--test/API/driver/kwsys/MD5.h.in97
-rw-r--r--test/API/driver/kwsys/Process.h.in544
-rw-r--r--test/API/driver/kwsys/ProcessUNIX.c2920
-rw-r--r--test/API/driver/kwsys/ProcessWin32.c2786
-rw-r--r--test/API/driver/kwsys/README.rst37
-rw-r--r--test/API/driver/kwsys/RegularExpression.cxx1218
-rw-r--r--test/API/driver/kwsys/RegularExpression.hxx.in562
-rw-r--r--test/API/driver/kwsys/SetupForDevelopment.sh20
-rw-r--r--test/API/driver/kwsys/SharedForward.h.in879
-rw-r--r--test/API/driver/kwsys/String.c100
-rw-r--r--test/API/driver/kwsys/String.h.in57
-rw-r--r--test/API/driver/kwsys/String.hxx.in65
-rw-r--r--test/API/driver/kwsys/System.c236
-rw-r--r--test/API/driver/kwsys/System.h.in60
-rw-r--r--test/API/driver/kwsys/SystemInformation.cxx5466
-rw-r--r--test/API/driver/kwsys/SystemInformation.hxx.in170
-rw-r--r--test/API/driver/kwsys/SystemTools.cxx4703
-rw-r--r--test/API/driver/kwsys/SystemTools.hxx.in981
-rw-r--r--test/API/driver/kwsys/Terminal.c414
-rw-r--r--test/API/driver/kwsys/Terminal.h.in170
-rw-r--r--test/API/driver/kwsys/clang-format.bash128
-rw-r--r--test/API/driver/kwsys/hash_fun.hxx.in166
-rw-r--r--test/API/driver/kwsys/hash_map.hxx.in423
-rw-r--r--test/API/driver/kwsys/hash_set.hxx.in392
-rw-r--r--test/API/driver/kwsys/hashtable.hxx.in995
-rw-r--r--test/API/driver/kwsys/kwsysHeaderDump.pl41
-rw-r--r--test/API/driver/kwsys/kwsysPlatformTests.cmake216
-rw-r--r--test/API/driver/kwsys/kwsysPlatformTestsC.c108
-rw-r--r--test/API/driver/kwsys/kwsysPlatformTestsCXX.cxx335
-rw-r--r--test/API/driver/kwsys/kwsysPrivate.h34
-rw-r--r--test/API/driver/kwsys/testCommandLineArguments.cxx209
-rw-r--r--test/API/driver/kwsys/testCommandLineArguments1.cxx93
-rw-r--r--test/API/driver/kwsys/testConfigure.cxx30
-rw-r--r--test/API/driver/kwsys/testConsoleBuf.cxx782
-rw-r--r--test/API/driver/kwsys/testConsoleBuf.hxx17
-rw-r--r--test/API/driver/kwsys/testConsoleBufChild.cxx55
-rw-r--r--test/API/driver/kwsys/testDirectory.cxx110
-rw-r--r--test/API/driver/kwsys/testDynamicLoader.cxx133
-rw-r--r--test/API/driver/kwsys/testDynload.c13
-rw-r--r--test/API/driver/kwsys/testDynloadImpl.c10
-rw-r--r--test/API/driver/kwsys/testDynloadImpl.h15
-rw-r--r--test/API/driver/kwsys/testDynloadUse.c15
-rw-r--r--test/API/driver/kwsys/testEncode.c67
-rw-r--r--test/API/driver/kwsys/testEncoding.cxx286
-rw-r--r--test/API/driver/kwsys/testFStream.cxx113
-rw-r--r--test/API/driver/kwsys/testFail.c24
-rw-r--r--test/API/driver/kwsys/testHashSTL.cxx64
-rw-r--r--test/API/driver/kwsys/testProcess.c728
-rw-r--r--test/API/driver/kwsys/testSharedForward.c.in27
-rw-r--r--test/API/driver/kwsys/testSystemInformation.cxx106
-rw-r--r--test/API/driver/kwsys/testSystemTools.binbin766 -> 0 bytes
-rw-r--r--test/API/driver/kwsys/testSystemTools.cxx1128
-rw-r--r--test/API/driver/kwsys/testSystemTools.h.in12
-rw-r--r--test/API/driver/kwsys/testTerminal.c22
-rw-r--r--test/API/driver/kwsys/update-gitsetup.bash20
-rw-r--r--test/API/driver/kwsys/update-third-party.bash169
-rw-r--r--test/CMakeLists.txt24
-rw-r--r--testpar/API/CMakeLists.txt27
-rw-r--r--testpar/CMakeLists.txt24
113 files changed, 89 insertions, 36608 deletions
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index 4460891..376b28f 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -49,6 +49,10 @@ set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++"
set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)
+########################
+# compression options
+########################
+
set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE)
set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.2.13" CACHE STRING "Use ZLIB from original location" FORCE)
@@ -62,6 +66,13 @@ set (LIBAEC_TGZ_ORIGNAME "libaec-v1.0.6.tar.gz" CACHE STRING "Use LIBAEC from or
set (LIBAEC_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE)
########################
+# API test options
+########################
+set (KWSYS_TGZ_ORIGPATH "https://gitlab.kitware.com/utils/kwsys/-/archive/master/kwsys-master.tar.gz" CACHE STRING "Use KWSYS from original location" FORCE)
+set (KWSYS_TGZ_ORIGNAME "kwsys-master.tar.gz" CACHE STRING "Use KWSYS from original compressed file" FORCE)
+set (KWSYS_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for KWSYS FetchContent" FORCE)
+
+########################
# filter plugin options
########################
diff --git a/doxygen/dox/Overview.dox b/doxygen/dox/Overview.dox
index 70974ec..f909d8d 100644
--- a/doxygen/dox/Overview.dox
+++ b/doxygen/dox/Overview.dox
@@ -23,8 +23,8 @@ documents cover a mix of tasks, concepts, and reference, to help a specific
\par Versions
Version-specific documentation (see the version in the title area) can be found
here:
- - <a href="https://docs.hdfgroup.org/hdf5/v1_14/index.html">HDF5 1.14.x (this site)</a>
- <a href="https://docs.hdfgroup.org/hdf5/develop/index.html">HDF5 <code>develop</code> branch</a>
+ - <a href="https://docs.hdfgroup.org/hdf5/v1_14/index.html">HDF5 1.14.x (this site)</a>
- <a href="https://docs.hdfgroup.org/hdf5/v1_12/index.html">HDF5 1.12.x</a>
- <a href="https://docs.hdfgroup.org/hdf5/v1_10/index.html">HDF5 1.10.x</a>
- <a href="https://docs.hdfgroup.org/hdf5/v1_8/index.html">HDF5 1.8.x</a>
diff --git a/test/API/CMake/CheckAsan.cmake b/test/API/CMake/CheckAsan.cmake
deleted file mode 100644
index 32f4b45..0000000
--- a/test/API/CMake/CheckAsan.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-set(ASAN_FLAG "-fsanitize=address")
-set(ASAN_C_FLAGS "-O1 -g ${ASAN_FLAG} -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fno-optimize-sibling-calls")
-set(ASAN_CXX_FLAGS ${ASAN_C_FLAGS})
-
-get_property(ASAN_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
-foreach(lang ${ASAN_LANGUAGES})
- set(ASAN_${lang}_LANG_ENABLED 1)
-endforeach()
-
-if(ASAN_C_LANG_ENABLED)
- include(CheckCCompilerFlag)
- set(CMAKE_REQUIRED_LINK_OPTIONS ${ASAN_FLAG})
- check_c_compiler_flag(${ASAN_FLAG} ASAN_C_FLAG_SUPPORTED)
- if(NOT ASAN_C_FLAG_SUPPORTED)
- message(STATUS "Asan flags are not supported by the C compiler.")
- else()
- if(NOT CMAKE_C_FLAGS_ASAN)
- set(CMAKE_C_FLAGS_ASAN ${ASAN_C_FLAGS} CACHE STRING "Flags used by the C compiler during ASAN builds." FORCE)
- endif()
- endif()
- unset(CMAKE_REQUIRED_LINK_OPTIONS)
-endif()
-
-if(ASAN_CXX_LANG_ENABLED)
- include(CheckCXXCompilerFlag)
- set(CMAKE_REQUIRED_LINK_OPTIONS ${ASAN_FLAG})
- check_cxx_compiler_flag(${ASAN_FLAG} ASAN_CXX_FLAG_SUPPORTED)
- if(NOT ASAN_CXX_FLAG_SUPPORTED)
- message(STATUS "Asan flags are not supported by the CXX compiler.")
- else()
- if(NOT CMAKE_CXX_FLAGS_ASAN)
- set(CMAKE_CXX_FLAGS_ASAN ${ASAN_CXX_FLAGS} CACHE STRING "Flags used by the CXX compiler during ASAN builds." FORCE)
- endif()
- endif()
- unset(CMAKE_REQUIRED_LINK_OPTIONS)
-endif()
-
diff --git a/test/API/CMake/CheckUbsan.cmake b/test/API/CMake/CheckUbsan.cmake
deleted file mode 100644
index f2b9c2c..0000000
--- a/test/API/CMake/CheckUbsan.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-set(UBSAN_FLAG "-fsanitize=undefined")
-set(UBSAN_C_FLAGS "-O1 -g ${UBSAN_FLAG} -fno-omit-frame-pointer")
-set(UBSAN_CXX_FLAGS ${UBSAN_C_FLAGS})
-
-get_property(UBSAN_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
-foreach(lang ${UBSAN_LANGUAGES})
- set(UBSAN_${lang}_LANG_ENABLED 1)
-endforeach()
-
-if(UBSAN_C_LANG_ENABLED)
- include(CheckCCompilerFlag)
- set(CMAKE_REQUIRED_LINK_OPTIONS ${UBSAN_FLAG})
- check_c_compiler_flag(${UBSAN_FLAG} UBSAN_C_FLAG_SUPPORTED)
- if(NOT UBSAN_C_FLAG_SUPPORTED)
- message(STATUS "Ubsan flags are not supported by the C compiler.")
- else()
- if(NOT CMAKE_C_FLAGS_UBSAN)
- set(CMAKE_C_FLAGS_UBSAN ${UBSAN_C_FLAGS} CACHE STRING "Flags used by the C compiler during UBSAN builds." FORCE)
- endif()
- endif()
- unset(CMAKE_REQUIRED_LINK_OPTIONS)
-endif()
-
-if(UBSAN_CXX_LANG_ENABLED)
- include(CheckCXXCompilerFlag)
- set(CMAKE_REQUIRED_LINK_OPTIONS ${UBSAN_FLAG})
- check_cxx_compiler_flag(${UBSAN_FLAG} UBSAN_CXX_FLAG_SUPPORTED)
- if(NOT UBSAN_CXX_FLAG_SUPPORTED)
- message(STATUS "Ubsan flags are not supported by the CXX compiler.")
- else()
- if(NOT CMAKE_CXX_FLAGS_UBSAN)
- set(CMAKE_CXX_FLAGS_UBSAN ${UBSAN_CXX_FLAGS} CACHE STRING "Flags used by the CXX compiler during UBSAN builds." FORCE)
- endif()
- endif()
- unset(CMAKE_REQUIRED_LINK_OPTIONS)
-endif()
-
diff --git a/test/API/CMakeLists.txt b/test/API/CMakeLists.txt
index d189d67..c2f95bd 100644
--- a/test/API/CMakeLists.txt
+++ b/test/API/CMakeLists.txt
@@ -9,26 +9,12 @@
# help@hdfgroup.org.
#
-#------------------------------------------------------------------------------
-# Set module path
-#------------------------------------------------------------------------------
-set(HDF5_TEST_API_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${HDF5_TEST_API_CMAKE_MODULE_PATH})
-
-# TODO: probably not necessary
-#------------------------------------------------------------------------------
-# Setup CMake Environment
-#------------------------------------------------------------------------------
-if (WIN32)
- message("The HDF5 API test suite is currently not supported on this platform." FATAL_ERROR)
-endif ()
+cmake_minimum_required (VERSION 3.18)
+project (HDF5_TEST_API C)
#------------------------------------------------------------------------------
# Setup testing configuration file
#------------------------------------------------------------------------------
-if (HDF5_TEST_PARALLEL)
- set (HDF5_TEST_API_HAVE_PARALLEL 1)
-endif ()
if (HDF5_TEST_API_ENABLE_ASYNC)
set (H5_API_TEST_HAVE_ASYNC 1)
endif ()
@@ -46,9 +32,27 @@ if (HDF5_TEST_API_ENABLE_DRIVER)
endif ()
#------------------------------------------------------------------------------
-# Setup for API tests
+# Define for API tests
#------------------------------------------------------------------------------
+set (HDF5_API_TESTS
+ attribute
+ dataset
+ datatype
+ file
+ group
+ link
+ misc
+ object
+)
+
+if (HDF5_TEST_API_ENABLE_ASYNC)
+ set (HDF5_API_TESTS
+ ${HDF5_API_TESTS}
+ async
+ )
+endif ()
+
# Ported HDF5 tests
set (HDF5_API_TESTS_EXTRA
testhdf5
diff --git a/test/API/driver/CMakeLists.txt b/test/API/driver/CMakeLists.txt
index 2210068..23ba053 100644
--- a/test/API/driver/CMakeLists.txt
+++ b/test/API/driver/CMakeLists.txt
@@ -1,17 +1,34 @@
-cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.18)
project(H5_API_TEST_DRIVER CXX)
-include(CheckAsan)
-include(CheckUbsan)
+if (NOT KWSYS_USE_LOCALCONTENT)
+ set (KWSYS_URL ${KWSYS_TGZ_ORIGPATH}/${KWSYS_TGZ_ORIGNAME})
+else ()
+ set (KWSYS_URL ${TGZPATH}/${KWSYS_TGZ_ORIGNAME})
+endif ()
+# Only tgz files
+FetchContent_Declare (KWSYS
+ URL ${KWSYS_URL}
+ URL_HASH ""
+)
+FetchContent_GetProperties(KWSYS)
+if(NOT kwsys_POPULATED)
+ FetchContent_Populate(KWSYS)
-set(CMAKE_CXX_STANDARD 11)
+ # Copy an additional/replacement files into the populated source
+ #file(COPY ${HDF_RESOURCES_DIR}/KWSYS/CMakeLists.txt DESTINATION ${hdf5_kwsys_SOURCE_DIR})
-set(KWSYS_NAMESPACE h5_api_test_sys)
-set(KWSYS_USE_SystemTools 1)
-set(KWSYS_USE_Process 1)
-set(KWSYS_USE_RegularExpression 1)
-add_subdirectory(kwsys)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/kwsys)
+ set(CMAKE_CXX_STANDARD 11)
+
+ set(KWSYS_NAMESPACE h5_api_test_sys)
+ set(KWSYS_USE_SystemTools 1)
+ set(KWSYS_USE_Process 1)
+ set(KWSYS_USE_RegularExpression 1)
+
+ add_subdirectory(${hdf5_kwsysb_SOURCE_DIR} ${hdf5_kwsys_BINARY_DIR})
+endif()
+
+include_directories(${hdf5_kwsys_BINARY_DIR})
add_executable(h5_api_test_driver h5_api_test_driver.cxx)
target_link_libraries(h5_api_test_driver h5_api_test_sys)
diff --git a/test/API/driver/kwsys/.clang-format b/test/API/driver/kwsys/.clang-format
deleted file mode 100644
index 588b790..0000000
--- a/test/API/driver/kwsys/.clang-format
+++ /dev/null
@@ -1,22 +0,0 @@
----
-# This configuration requires clang-format version 6.0 exactly.
-BasedOnStyle: Mozilla
-AlignOperands: false
-AllowShortFunctionsOnASingleLine: InlineOnly
-AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakAfterReturnType: None
-BinPackArguments: true
-BinPackParameters: true
-BraceWrapping:
- AfterClass: true
- AfterEnum: true
- AfterFunction: true
- AfterStruct: true
- AfterUnion: true
-BreakBeforeBraces: Custom
-ColumnLimit: 79
-IndentPPDirectives: AfterHash
-SortUsingDeclarations: false
-SpaceAfterTemplateKeyword: true
-Standard: Cpp03
-...
diff --git a/test/API/driver/kwsys/.hooks-config b/test/API/driver/kwsys/.hooks-config
deleted file mode 100644
index 739cdd2..0000000
--- a/test/API/driver/kwsys/.hooks-config
+++ /dev/null
@@ -1,2 +0,0 @@
-[hooks "chain"]
- pre-commit = GitSetup/pre-commit
diff --git a/test/API/driver/kwsys/Base64.c b/test/API/driver/kwsys/Base64.c
deleted file mode 100644
index bf876f2..0000000
--- a/test/API/driver/kwsys/Base64.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Base64.h)
-
-/* Work-around CMake dependency scanning limitation. This must
- duplicate the above list of headers. */
-#if 0
-# include "Base64.h.in"
-#endif
-
-static const unsigned char kwsysBase64EncodeTable[65] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
-
-static const unsigned char kwsysBase64DecodeTable[256] = {
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
- 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D,
- 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- /*------------------------------------*/
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
-};
-
-static unsigned char kwsysBase64EncodeChar(int c)
-{
- return kwsysBase64EncodeTable[(unsigned char)c];
-}
-
-static unsigned char kwsysBase64DecodeChar(unsigned char c)
-{
- return kwsysBase64DecodeTable[c];
-}
-
-/* Encode 3 bytes into a 4 byte string. */
-void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
-{
- dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
- dest[1] =
- kwsysBase64EncodeChar(((src[0] << 4) & 0x30) | ((src[1] >> 4) & 0x0F));
- dest[2] =
- kwsysBase64EncodeChar(((src[1] << 2) & 0x3C) | ((src[2] >> 6) & 0x03));
- dest[3] = kwsysBase64EncodeChar(src[2] & 0x3F);
-}
-
-/* Encode 2 bytes into a 4 byte string. */
-void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
-{
- dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
- dest[1] =
- kwsysBase64EncodeChar(((src[0] << 4) & 0x30) | ((src[1] >> 4) & 0x0F));
- dest[2] = kwsysBase64EncodeChar(((src[1] << 2) & 0x3C));
- dest[3] = '=';
-}
-
-/* Encode 1 bytes into a 4 byte string. */
-void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
-{
- dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
- dest[1] = kwsysBase64EncodeChar(((src[0] << 4) & 0x30));
- dest[2] = '=';
- dest[3] = '=';
-}
-
-/* Encode 'length' bytes from the input buffer and store the
- encoded stream into the output buffer. Return the length of the encoded
- buffer (output). Note that the output buffer must be allocated by the caller
- (length * 1.5 should be a safe estimate). If 'mark_end' is true than an
- extra set of 4 bytes is added to the end of the stream if the input is a
- multiple of 3 bytes. These bytes are invalid chars and therefore they will
- stop the decoder thus enabling the caller to decode a stream without
- actually knowing how much data to expect (if the input is not a multiple of
- 3 bytes then the extra padding needed to complete the encode 4 bytes will
- stop the decoding anyway). */
-size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
- unsigned char* output, int mark_end)
-{
- const unsigned char* ptr = input;
- const unsigned char* end = input + length;
- unsigned char* optr = output;
-
- /* Encode complete triplet */
-
- while ((end - ptr) >= 3) {
- kwsysBase64_Encode3(ptr, optr);
- ptr += 3;
- optr += 4;
- }
-
- /* Encodes a 2-byte ending into 3 bytes and 1 pad byte and writes. */
-
- if (end - ptr == 2) {
- kwsysBase64_Encode2(ptr, optr);
- optr += 4;
- }
-
- /* Encodes a 1-byte ending into 2 bytes and 2 pad bytes */
-
- else if (end - ptr == 1) {
- kwsysBase64_Encode1(ptr, optr);
- optr += 4;
- }
-
- /* Do we need to mark the end */
-
- else if (mark_end) {
- optr[0] = optr[1] = optr[2] = optr[3] = '=';
- optr += 4;
- }
-
- return (size_t)(optr - output);
-}
-
-/* Decode 4 bytes into a 3 byte string. */
-int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
-{
- unsigned char d0, d1, d2, d3;
-
- d0 = kwsysBase64DecodeChar(src[0]);
- d1 = kwsysBase64DecodeChar(src[1]);
- d2 = kwsysBase64DecodeChar(src[2]);
- d3 = kwsysBase64DecodeChar(src[3]);
-
- /* Make sure all characters were valid */
-
- if (d0 == 0xFF || d1 == 0xFF || d2 == 0xFF || d3 == 0xFF) {
- return 0;
- }
-
- /* Decode the 3 bytes */
-
- dest[0] = (unsigned char)(((d0 << 2) & 0xFC) | ((d1 >> 4) & 0x03));
- dest[1] = (unsigned char)(((d1 << 4) & 0xF0) | ((d2 >> 2) & 0x0F));
- dest[2] = (unsigned char)(((d2 << 6) & 0xC0) | ((d3 >> 0) & 0x3F));
-
- /* Return the number of bytes actually decoded */
-
- if (src[2] == '=') {
- return 1;
- }
- if (src[3] == '=') {
- return 2;
- }
- return 3;
-}
-
-/* Decode bytes from the input buffer and store the decoded stream
- into the output buffer until 'length' bytes have been decoded. Return the
- real length of the decoded stream (which should be equal to 'length'). Note
- that the output buffer must be allocated by the caller. If
- 'max_input_length' is not null, then it specifies the number of encoded
- bytes that should be at most read from the input buffer. In that case the
- 'length' parameter is ignored. This enables the caller to decode a stream
- without actually knowing how much decoded data to expect (of course, the
- buffer must be large enough). */
-size_t kwsysBase64_Decode(const unsigned char* input, size_t length,
- unsigned char* output, size_t max_input_length)
-{
- const unsigned char* ptr = input;
- unsigned char* optr = output;
-
- /* Decode complete triplet */
-
- if (max_input_length) {
- const unsigned char* end = input + max_input_length;
- while (ptr < end) {
- int len = kwsysBase64_Decode3(ptr, optr);
- optr += len;
- if (len < 3) {
- return (size_t)(optr - output);
- }
- ptr += 4;
- }
- } else {
- unsigned char* oend = output + length;
- while ((oend - optr) >= 3) {
- int len = kwsysBase64_Decode3(ptr, optr);
- optr += len;
- if (len < 3) {
- return (size_t)(optr - output);
- }
- ptr += 4;
- }
-
- /* Decode the last triplet */
-
- if (oend - optr == 2) {
- unsigned char temp[3];
- int len = kwsysBase64_Decode3(ptr, temp);
- if (len >= 2) {
- optr[0] = temp[0];
- optr[1] = temp[1];
- optr += 2;
- } else if (len > 0) {
- optr[0] = temp[0];
- optr += 1;
- }
- } else if (oend - optr == 1) {
- unsigned char temp[3];
- int len = kwsysBase64_Decode3(ptr, temp);
- if (len > 0) {
- optr[0] = temp[0];
- optr += 1;
- }
- }
- }
-
- return (size_t)(optr - output);
-}
diff --git a/test/API/driver/kwsys/Base64.h.in b/test/API/driver/kwsys/Base64.h.in
deleted file mode 100644
index 729f972..0000000
--- a/test/API/driver/kwsys/Base64.h.in
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_Base64_h
-#define @KWSYS_NAMESPACE@_Base64_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-#include <stddef.h> /* size_t */
-
-/* Redefine all public interface symbol names to be in the proper
- namespace. These macros are used internally to kwsys only, and are
- not visible to user code. Use kwsysHeaderDump.pl to reproduce
- these macros after making changes to the interface. */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
-#endif
-#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsysBase64 kwsys_ns(Base64)
-# define kwsysBase64_Decode kwsys_ns(Base64_Decode)
-# define kwsysBase64_Decode3 kwsys_ns(Base64_Decode3)
-# define kwsysBase64_Encode kwsys_ns(Base64_Encode)
-# define kwsysBase64_Encode1 kwsys_ns(Base64_Encode1)
-# define kwsysBase64_Encode2 kwsys_ns(Base64_Encode2)
-# define kwsysBase64_Encode3 kwsys_ns(Base64_Encode3)
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/**
- * Encode 3 bytes into a 4 byte string.
- */
-kwsysEXPORT void kwsysBase64_Encode3(const unsigned char* src,
- unsigned char* dest);
-
-/**
- * Encode 2 bytes into a 4 byte string.
- */
-kwsysEXPORT void kwsysBase64_Encode2(const unsigned char* src,
- unsigned char* dest);
-
-/**
- * Encode 1 bytes into a 4 byte string.
- */
-kwsysEXPORT void kwsysBase64_Encode1(const unsigned char* src,
- unsigned char* dest);
-
-/**
- * Encode 'length' bytes from the input buffer and store the encoded
- * stream into the output buffer. Return the length of the encoded
- * buffer (output). Note that the output buffer must be allocated by
- * the caller (length * 1.5 should be a safe estimate). If 'mark_end'
- * is true than an extra set of 4 bytes is added to the end of the
- * stream if the input is a multiple of 3 bytes. These bytes are
- * invalid chars and therefore they will stop the decoder thus
- * enabling the caller to decode a stream without actually knowing how
- * much data to expect (if the input is not a multiple of 3 bytes then
- * the extra padding needed to complete the encode 4 bytes will stop
- * the decoding anyway).
- */
-kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char* input,
- size_t length, unsigned char* output,
- int mark_end);
-
-/**
- * Decode 4 bytes into a 3 byte string. Returns the number of bytes
- * actually decoded.
- */
-kwsysEXPORT int kwsysBase64_Decode3(const unsigned char* src,
- unsigned char* dest);
-
-/**
- * Decode bytes from the input buffer and store the decoded stream
- * into the output buffer until 'length' bytes have been decoded.
- * Return the real length of the decoded stream (which should be equal
- * to 'length'). Note that the output buffer must be allocated by the
- * caller. If 'max_input_length' is not null, then it specifies the
- * number of encoded bytes that should be at most read from the input
- * buffer. In that case the 'length' parameter is ignored. This
- * enables the caller to decode a stream without actually knowing how
- * much decoded data to expect (of course, the buffer must be large
- * enough).
- */
-kwsysEXPORT size_t kwsysBase64_Decode(const unsigned char* input,
- size_t length, unsigned char* output,
- size_t max_input_length);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
- Otherwise, undefine them to keep the namespace clean. */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsysBase64
-# undef kwsysBase64_Decode
-# undef kwsysBase64_Decode3
-# undef kwsysBase64_Encode
-# undef kwsysBase64_Encode1
-# undef kwsysBase64_Encode2
-# undef kwsysBase64_Encode3
-# endif
-#endif
-
-#endif
diff --git a/test/API/driver/kwsys/CMakeLists.txt b/test/API/driver/kwsys/CMakeLists.txt
deleted file mode 100644
index 09bcdb9..0000000
--- a/test/API/driver/kwsys/CMakeLists.txt
+++ /dev/null
@@ -1,1260 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing#kwsys for details.
-
-# The Kitware System Library is intended to be included in other
-# projects. It is completely configurable in that the library's
-# namespace can be configured and the components that are included can
-# be selected invididually.
-
-# Typical usage is to import the kwsys directory tree into a
-# subdirectory under a parent project and enable the classes that will
-# be used. All classes are disabled by default. The CMake listfile
-# above this one configures the library as follows:
-#
-# SET(KWSYS_NAMESPACE foosys)
-# SET(KWSYS_USE_Directory 1) # Enable Directory class.
-# SUBDIRS(kwsys)
-#
-# Optional settings are as follows:
-#
-# KWSYS_HEADER_ROOT = The directory into which to generate the kwsys headers.
-# A directory called "${KWSYS_NAMESPACE}" will be
-# created under this root directory to hold the files.
-# KWSYS_SPLIT_OBJECTS_FROM_INTERFACE
-# = Instead of creating a single ${KWSYS_NAMESPACE} library
-# target, create three separate targets:
-# ${KWSYS_NAMESPACE}
-# - An INTERFACE library only containing usage
-# requirements.
-# ${KWSYS_NAMESPACE}_objects
-# - An OBJECT library for the built kwsys objects.
-# Note: This is omitted from the install rules
-# ${KWSYS_NAMESPACE}_private
-# - An INTERFACE library combining both that is
-# appropriate for use with PRIVATE linking in
-# target_link_libraries. Because of how interface
-# properties propagate, this target is not suitable
-# for use with PUBLIC or INTERFACE linking.
-# KWSYS_ALIAS_TARGET = The name of an alias target to create to the actual target.
-#
-# Example:
-#
-# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
-# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
-#
-# KWSYS_CXX_STANDARD = A value for CMAKE_CXX_STANDARD within KWSys.
-# Set to empty string to use no default value.
-# KWSYS_CXX_COMPILE_FEATURES = target_compile_features arguments for KWSys.
-#
-# Optional settings to setup install rules are as follows:
-#
-# KWSYS_INSTALL_BIN_DIR = The installation target directories into
-# KWSYS_INSTALL_LIB_DIR which the libraries and headers from
-# KWSYS_INSTALL_INCLUDE_DIR kwsys should be installed by a "make install".
-# The values should be specified relative to
-# the installation prefix and NOT start with '/'.
-# KWSYS_INSTALL_DOC_DIR = The installation target directory for documentation
-# such as copyright information.
-#
-# KWSYS_INSTALL_COMPONENT_NAME_RUNTIME = Name of runtime and development
-# KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT installation components.
-# If not given the install rules
-# will not be in any component.
-#
-# KWSYS_INSTALL_EXPORT_NAME = The EXPORT option value for install(TARGETS) calls.
-#
-# Example:
-#
-# SET(KWSYS_INSTALL_BIN_DIR bin)
-# SET(KWSYS_INSTALL_LIB_DIR lib)
-# SET(KWSYS_INSTALL_INCLUDE_DIR include)
-# SET(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME Runtime)
-# SET(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT Development)
-
-# Once configured, kwsys should be used as follows from C or C++ code:
-#
-# #include <foosys/Directory.hxx>
-# ...
-# foosys::Directory directory;
-#
-
-# NOTE: This library is intended for internal use by Kitware-driven
-# projects. In order to keep it simple no attempt will be made to
-# maintain backward compatibility when changes are made to KWSys.
-# When an incompatible change is made Kitware's projects that use
-# KWSys will be fixed, but no notification will necessarily be sent to
-# any outside mailing list and no documentation of the change will be
-# written.
-
-CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
-FOREACH(p
- CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature.
- CMP0063 # CMake 3.3, Honor visibility properties for all target types.
- CMP0067 # CMake 3.8, Honor language standard in try_compile source-file signature.
- CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
- )
- IF(POLICY ${p})
- CMAKE_POLICY(SET ${p} NEW)
- ENDIF()
-ENDFOREACH()
-
-#-----------------------------------------------------------------------------
-# If a namespace is not specified, use "kwsys" and enable testing.
-# This should be the case only when kwsys is not included inside
-# another project and is being tested.
-IF(NOT KWSYS_NAMESPACE)
- SET(KWSYS_NAMESPACE "kwsys")
- SET(KWSYS_STANDALONE 1)
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# The project name is that of the specified namespace.
-PROJECT(${KWSYS_NAMESPACE})
-
-# Tell CMake how to follow dependencies of sources in this directory.
-SET_PROPERTY(DIRECTORY
- PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
- "KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>"
- )
-
-if(KWSYS_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD "${KWSYS_CXX_STANDARD}")
-elseif(NOT DEFINED CMAKE_CXX_STANDARD AND NOT DEFINED KWSYS_CXX_STANDARD)
- if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
- AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"
- AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU"
- )
- set(CMAKE_CXX_STANDARD 14)
- else()
- set(CMAKE_CXX_STANDARD 11)
- endif()
-endif()
-
-# Select library components.
-IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
- SET(KWSYS_ENABLE_C 1)
- # Enable all components.
- SET(KWSYS_USE_Base64 1)
- SET(KWSYS_USE_Directory 1)
- SET(KWSYS_USE_DynamicLoader 1)
- SET(KWSYS_USE_Encoding 1)
- SET(KWSYS_USE_Glob 1)
- SET(KWSYS_USE_MD5 1)
- SET(KWSYS_USE_Process 1)
- SET(KWSYS_USE_RegularExpression 1)
- SET(KWSYS_USE_System 1)
- SET(KWSYS_USE_SystemTools 1)
- SET(KWSYS_USE_CommandLineArguments 1)
- SET(KWSYS_USE_Terminal 1)
- SET(KWSYS_USE_IOStream 1)
- SET(KWSYS_USE_FStream 1)
- SET(KWSYS_USE_String 1)
- SET(KWSYS_USE_SystemInformation 1)
- SET(KWSYS_USE_ConsoleBuf 1)
-ENDIF()
-
-# Enforce component dependencies.
-IF(KWSYS_USE_SystemTools)
- SET(KWSYS_USE_Directory 1)
- SET(KWSYS_USE_FStream 1)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_Glob)
- SET(KWSYS_USE_Directory 1)
- SET(KWSYS_USE_SystemTools 1)
- SET(KWSYS_USE_RegularExpression 1)
- SET(KWSYS_USE_FStream 1)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_Process)
- SET(KWSYS_USE_System 1)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_SystemInformation)
- SET(KWSYS_USE_Process 1)
-ENDIF()
-IF(KWSYS_USE_System)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_Directory)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_DynamicLoader)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_FStream)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-IF(KWSYS_USE_ConsoleBuf)
- SET(KWSYS_USE_Encoding 1)
-ENDIF()
-
-# Specify default 8 bit encoding for Windows
-IF(NOT KWSYS_ENCODING_DEFAULT_CODEPAGE)
- SET(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_ACP)
-ENDIF()
-
-# Enable testing if building standalone.
-IF(KWSYS_STANDALONE)
- INCLUDE(Dart)
- MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
- IF(BUILD_TESTING)
- ENABLE_TESTING()
- ENDIF()
-ENDIF()
-
-# Choose default shared/static build if not specified.
-IF(NOT DEFINED KWSYS_BUILD_SHARED)
- SET(KWSYS_BUILD_SHARED ${BUILD_SHARED_LIBS})
-ENDIF()
-
-# Include helper macros.
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformTests.cmake)
-INCLUDE(CheckTypeSize)
-
-# Do full dependency headers.
-INCLUDE_REGULAR_EXPRESSION("^.*$")
-
-# Use new KWSYS_INSTALL_*_DIR variable names to control installation.
-# Take defaults from the old names. Note that there was no old name
-# for the bin dir, so we take the old lib dir name so DLLs will be
-# installed in a compatible way for old code.
-IF(NOT KWSYS_INSTALL_INCLUDE_DIR)
- STRING(REGEX REPLACE "^/" "" KWSYS_INSTALL_INCLUDE_DIR
- "${KWSYS_HEADER_INSTALL_DIR}")
-ENDIF()
-IF(NOT KWSYS_INSTALL_LIB_DIR)
- STRING(REGEX REPLACE "^/" "" KWSYS_INSTALL_LIB_DIR
- "${KWSYS_LIBRARY_INSTALL_DIR}")
-ENDIF()
-IF(NOT KWSYS_INSTALL_BIN_DIR)
- STRING(REGEX REPLACE "^/" "" KWSYS_INSTALL_BIN_DIR
- "${KWSYS_LIBRARY_INSTALL_DIR}")
-ENDIF()
-
-# Setup header install rules.
-SET(KWSYS_INSTALL_INCLUDE_OPTIONS)
-IF(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT)
- SET(KWSYS_INSTALL_INCLUDE_OPTIONS ${KWSYS_INSTALL_INCLUDE_OPTIONS}
- COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT}
- )
-ENDIF()
-
-# Setup library install rules.
-SET(KWSYS_INSTALL_LIBRARY_RULE)
-SET(KWSYS_INSTALL_NAMELINK_RULE)
-IF(KWSYS_INSTALL_LIB_DIR)
- IF(KWSYS_INSTALL_EXPORT_NAME)
- LIST(APPEND KWSYS_INSTALL_LIBRARY_RULE EXPORT ${KWSYS_INSTALL_EXPORT_NAME})
- ENDIF()
- # Install the shared library to the lib directory.
- SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
- LIBRARY DESTINATION ${KWSYS_INSTALL_LIB_DIR} NAMELINK_SKIP
- )
- # Assign the shared library to the runtime component.
- IF(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME)
- SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
- COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_RUNTIME}
- )
- ENDIF()
- IF(KWSYS_BUILD_SHARED)
- SET(KWSYS_INSTALL_NAMELINK_RULE ${KWSYS_INSTALL_NAMELINK_RULE}
- LIBRARY DESTINATION ${KWSYS_INSTALL_LIB_DIR} NAMELINK_ONLY
- )
- # Assign the namelink to the development component.
- IF(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT)
- SET(KWSYS_INSTALL_NAMELINK_RULE ${KWSYS_INSTALL_NAMELINK_RULE}
- COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT}
- )
- ENDIF()
- ENDIF()
-
- # Install the archive to the lib directory.
- SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
- ARCHIVE DESTINATION ${KWSYS_INSTALL_LIB_DIR}
- )
- # Assign the archive to the development component.
- IF(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT)
- SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
- COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT}
- )
- ENDIF()
-ENDIF()
-IF(KWSYS_INSTALL_BIN_DIR)
- # Install the runtime library to the bin directory.
- SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
- RUNTIME DESTINATION ${KWSYS_INSTALL_BIN_DIR}
- )
- # Assign the runtime library to the runtime component.
- IF(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME)
- SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
- COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_RUNTIME}
- )
- ENDIF()
-ENDIF()
-
-# Do not support old KWSYS_*a_INSTALL_DIR variable names.
-SET(KWSYS_HEADER_INSTALL_DIR)
-SET(KWSYS_LIBRARY_INSTALL_DIR)
-
-# Generated source files will need this header.
-STRING(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
- KWSYS_IN_SOURCE_BUILD)
-IF(NOT KWSYS_IN_SOURCE_BUILD)
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
- ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE)
-ENDIF()
-
-# Select plugin module file name convention.
-IF(NOT KWSYS_DynamicLoader_PREFIX)
- SET(KWSYS_DynamicLoader_PREFIX ${CMAKE_SHARED_MODULE_PREFIX})
-ENDIF()
-IF(NOT KWSYS_DynamicLoader_SUFFIX)
- SET(KWSYS_DynamicLoader_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX})
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# We require ANSI support from the C compiler. Add any needed flags.
-IF(CMAKE_ANSI_CFLAGS)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# Adjust compiler flags for some platforms.
-IF(NOT CMAKE_COMPILER_IS_GNUCXX)
- IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
- STRING(REGEX MATCH "-timplicit_local"
- KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL "${CMAKE_CXX_FLAGS}")
- STRING(REGEX MATCH "-no_implicit_include"
- KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE "${CMAKE_CXX_FLAGS}")
- IF(NOT KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local")
- ENDIF()
- IF(NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include")
- ENDIF()
- ENDIF()
- IF(CMAKE_SYSTEM MATCHES "HP-UX")
- SET(KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p")
- IF(CMAKE_CXX_COMPILER_ID MATCHES "HP")
- # it is known that version 3.85 fails and 6.25 works without these flags
- IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4)
- # use new C++ library and improved template support
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98")
- ENDIF()
- ENDIF()
- ENDIF()
-ENDIF()
-IF(KWSYS_STANDALONE)
- IF(CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
- IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
- ELSE()
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
- ENDIF()
- ENDIF()
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# Configure the standard library header wrappers based on compiler's
-# capabilities and parent project's request. Enforce 0/1 as only
-# possible values for configuration into Configure.hxx.
-
-# Check existence and uniqueness of long long and __int64.
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_LONG_LONG
- "Checking whether C++ compiler has 'long long'" DIRECT)
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS___INT64
- "Checking whether C++ compiler has '__int64'" DIRECT)
-IF(KWSYS_CXX_HAS___INT64)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_AND___INT64
- "Checking whether long and __int64 are the same type" DIRECT)
- IF(KWSYS_CXX_HAS_LONG_LONG)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_LONG_AND___INT64
- "Checking whether long long and __int64 are the same type" DIRECT)
- ENDIF()
-ENDIF()
-
-# Enable the "long long" type if it is available. It is standard in
-# C99 and C++03 but not in earlier standards.
-IF(KWSYS_CXX_HAS_LONG_LONG)
- SET(KWSYS_USE_LONG_LONG 1)
-ELSE()
- SET(KWSYS_USE_LONG_LONG 0)
-ENDIF()
-
-# Enable the "__int64" type if it is available and unique. It is not
-# standard.
-SET(KWSYS_USE___INT64 0)
-IF(KWSYS_CXX_HAS___INT64)
- IF(NOT KWSYS_CXX_SAME_LONG_AND___INT64)
- IF(NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64)
- SET(KWSYS_USE___INT64 1)
- ENDIF()
- ENDIF()
-ENDIF()
-
-IF(KWSYS_USE_Encoding)
- # Look for type size helper macros.
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING
- "Checking whether wstring is available" DIRECT)
-ENDIF()
-
-IF(KWSYS_USE_IOStream)
- # Determine whether iostreams support long long.
- IF(KWSYS_CXX_HAS_LONG_LONG)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG
- "Checking if istream supports long long" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM_LONG_LONG
- "Checking if ostream supports long long" DIRECT)
- ELSE()
- SET(KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0)
- SET(KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0)
- ENDIF()
- IF(KWSYS_CXX_HAS___INT64)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM___INT64
- "Checking if istream supports __int64" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM___INT64
- "Checking if ostream supports __int64" DIRECT)
- ELSE()
- SET(KWSYS_IOS_HAS_ISTREAM___INT64 0)
- SET(KWSYS_IOS_HAS_OSTREAM___INT64 0)
- ENDIF()
-ENDIF()
-
-IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
- SET(KWSYS_NAME_IS_KWSYS 1)
-ELSE()
- SET(KWSYS_NAME_IS_KWSYS 0)
-ENDIF()
-
-IF(KWSYS_BUILD_SHARED)
- SET(KWSYS_BUILD_SHARED 1)
- SET(KWSYS_LIBRARY_TYPE SHARED)
-ELSE()
- SET(KWSYS_BUILD_SHARED 0)
- SET(KWSYS_LIBRARY_TYPE STATIC)
-ENDIF()
-
-if(NOT DEFINED KWSYS_BUILD_PIC)
- set(KWSYS_BUILD_PIC 0)
-endif()
-
-#-----------------------------------------------------------------------------
-# Configure some implementation details.
-
-KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_PTRDIFF_T
- "Checking whether C compiler has ptrdiff_t in stddef.h" DIRECT)
-KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_SSIZE_T
- "Checking whether C compiler has ssize_t in unistd.h" DIRECT)
-IF(KWSYS_USE_Process)
- KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_CLOCK_GETTIME_MONOTONIC
- "Checking whether C compiler has clock_gettime" DIRECT)
-ENDIF()
-
-SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c System.c PROPERTIES
- COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T} -DKWSYS_C_HAS_CLOCK_GETTIME_MONOTONIC=${KWSYS_C_HAS_CLOCK_GETTIME_MONOTONIC}"
- )
-
-IF(DEFINED KWSYS_PROCESS_USE_SELECT)
- GET_PROPERTY(ProcessUNIX_FLAGS SOURCE ProcessUNIX.c PROPERTY COMPILE_FLAGS)
- SET_PROPERTY(SOURCE ProcessUNIX.c PROPERTY COMPILE_FLAGS "${ProcessUNIX_FLAGS} -DKWSYSPE_USE_SELECT=${KWSYSPE_USE_SELECT}")
-ENDIF()
-
-IF(KWSYS_USE_DynamicLoader)
- GET_PROPERTY(KWSYS_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
- IF(KWSYS_SUPPORTS_SHARED_LIBS)
- SET(KWSYS_SUPPORTS_SHARED_LIBS 1)
- ELSE()
- SET(KWSYS_SUPPORTS_SHARED_LIBS 0)
- ENDIF()
- SET_PROPERTY(SOURCE DynamicLoader.cxx APPEND PROPERTY COMPILE_DEFINITIONS
- KWSYS_SUPPORTS_SHARED_LIBS=${KWSYS_SUPPORTS_SHARED_LIBS})
-ENDIF()
-
-IF(KWSYS_USE_SystemTools)
- if (NOT DEFINED KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP)
- set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1)
- endif ()
- if (KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP)
- set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1)
- else ()
- set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 0)
- endif ()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV
- "Checking whether CXX compiler has setenv" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV
- "Checking whether CXX compiler has unsetenv" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
- "Checking whether CXX compiler has environ in stdlib.h" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UTIMES
- "Checking whether CXX compiler has utimes" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UTIMENSAT
- "Checking whether CXX compiler has utimensat" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_STAT_HAS_ST_MTIM
- "Checking whether CXX compiler struct stat has st_mtim member" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
- "Checking whether CXX compiler struct stat has st_mtimespec member" DIRECT)
- SET_PROPERTY(SOURCE SystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS
- KWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
- KWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
- KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
- KWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
- KWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
- KWSYS_CXX_STAT_HAS_ST_MTIM=${KWSYS_CXX_STAT_HAS_ST_MTIM}
- KWSYS_CXX_STAT_HAS_ST_MTIMESPEC=${KWSYS_CXX_STAT_HAS_ST_MTIMESPEC}
- )
- IF(NOT WIN32)
- IF(KWSYS_STANDALONE)
- OPTION(KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES "If true, Windows paths will be supported on Unix as well" ON)
- ENDIF()
- IF(KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES)
- SET_PROPERTY(SOURCE SystemTools.cxx testSystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS
- KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES
- )
- ENDIF()
- ENDIF()
-
- # Disable getpwnam for static linux builds since it depends on shared glibc
- GET_PROPERTY(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
- IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT SHARED_LIBS_SUPPORTED)
- SET_PROPERTY(SOURCE SystemTools.cxx APPEND PROPERTY COMPILE_DEFINITIONS
- HAVE_GETPWNAM=0
- )
- ENDIF()
-ENDIF()
-
-IF(KWSYS_USE_SystemInformation)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P})
- IF(NOT CYGWIN)
- INCLUDE(CheckIncludeFiles)
- CHECK_INCLUDE_FILES("sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H)
- IF(KWSYS_SYS_HAS_IFADDRS_H)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYS_HAS_IFADDRS_H=1)
- ENDIF()
- ENDIF()
- IF(WIN32)
- INCLUDE(CheckSymbolExists)
- SET(CMAKE_REQUIRED_LIBRARIES Psapi)
- CHECK_SYMBOL_EXISTS(GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI)
- UNSET(CMAKE_REQUIRED_LIBRARIES)
- IF(KWSYS_SYS_HAS_PSAPI)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYS_HAS_PSAPI=1)
- IF(MSVC70 OR MSVC71)
- # Suppress LNK4089: all references to 'PSAPI.DLL' discarded by /OPT:REF
- SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4089")
- ENDIF()
- ENDIF()
- ENDIF()
- IF(CMAKE_SYSTEM MATCHES "HP-UX")
- CHECK_INCLUDE_FILES("sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H)
- IF(KWSYS_SYS_HAS_MPCTL_H)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYS_HAS_MPCTL_H=1)
- ENDIF()
- ENDIF()
- IF(CMAKE_SYSTEM MATCHES "BSD")
- CHECK_INCLUDE_FILES("machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H)
- IF(KWSYS_SYS_HAS_MACHINE_CPU_H)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1)
- ENDIF()
- ENDIF()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_RLIMIT64
- "Checking whether CXX compiler has rlimit64" DIRECT)
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
- IF(KWSYS_CXX_HAS_RLIMIT64)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS_RLIMIT64=1)
- ENDIF()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOL
- "Checking whether CXX compiler has atol" DIRECT)
- IF(KWSYS_CXX_HAS_ATOL)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOL=1)
- ENDIF()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOLL
- "Checking whether CXX compiler has atoll" DIRECT)
- IF(KWSYS_CXX_HAS_ATOLL)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOLL=1)
- ENDIF()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS__ATOI64
- "Checking whether CXX compiler has _atoi64" DIRECT)
- IF(KWSYS_CXX_HAS__ATOI64)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS__ATOI64=1)
- ENDIF()
- IF(UNIX)
- INCLUDE(CheckIncludeFileCXX)
- # check for simple stack trace
- # usually it's in libc but on FreeBSD
- # it's in libexecinfo
- FIND_LIBRARY(EXECINFO_LIB "execinfo")
- MARK_AS_ADVANCED(EXECINFO_LIB)
- IF (NOT EXECINFO_LIB)
- SET(EXECINFO_LIB "")
- ENDIF()
- CHECK_INCLUDE_FILE_CXX("execinfo.h" KWSYS_CXX_HAS_EXECINFOH)
- IF (KWSYS_CXX_HAS_EXECINFOH)
- # we have the backtrace header check if it
- # can be used with this compiler
- SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${EXECINFO_LIB})
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BACKTRACE
- "Checking whether backtrace works with this C++ compiler" DIRECT)
- SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES)
- IF (KWSYS_CXX_HAS_BACKTRACE)
- # backtrace is supported by this system and compiler.
- # now check for the more advanced capabilities.
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE=1)
- # check for symbol lookup using dladdr
- CHECK_INCLUDE_FILE_CXX("dlfcn.h" KWSYS_CXX_HAS_DLFCNH)
- IF (KWSYS_CXX_HAS_DLFCNH)
- # we have symbol lookup libraries and headers
- # check if they can be used with this compiler
- SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES ${CMAKE_DL_LIBS})
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_DLADDR
- "Checking whether dladdr works with this C++ compiler" DIRECT)
- SET(KWSYS_PLATFORM_CXX_TEST_LINK_LIBRARIES)
- IF (KWSYS_CXX_HAS_DLADDR)
- # symbol lookup is supported by this system
- # and compiler.
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP=1)
- ENDIF()
- ENDIF()
- # c++ demangling support
- # check for cxxabi headers
- CHECK_INCLUDE_FILE_CXX("cxxabi.h" KWSYS_CXX_HAS_CXXABIH)
- IF (KWSYS_CXX_HAS_CXXABIH)
- # check if cxxabi can be used with this
- # system and compiler.
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CXXABI
- "Checking whether cxxabi works with this C++ compiler" DIRECT)
- IF (KWSYS_CXX_HAS_CXXABI)
- # c++ demangle using cxxabi is supported with
- # this system and compiler
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE=1)
- ENDIF()
- ENDIF()
- # basic backtrace works better with release build
- # don't bother with advanced features for release
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS_DEBUG KWSYS_SYSTEMINFORMATION_HAS_DEBUG_BUILD=1)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS_RELWITHDEBINFO KWSYS_SYSTEMINFORMATION_HAS_DEBUG_BUILD=1)
- ENDIF()
- ENDIF()
- ENDIF()
- IF(BORLAND)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM
- "Checking whether Borland CXX compiler supports assembler instructions" DIRECT)
- IF(KWSYS_CXX_HAS_BORLAND_ASM)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM=1)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM_CPUID
- "Checking whether Borland CXX compiler supports CPUID assembler instruction" DIRECT)
- IF(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM_CPUID=1)
- ENDIF()
- ENDIF()
- ENDIF()
- IF(KWSYS_USE___INT64)
- SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_USE___INT64=1)
- ENDIF()
- IF(KWSYS_USE_LONG_LONG)
- SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=1)
- ENDIF()
- IF(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
- SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM_LONG_LONG=1)
- ENDIF()
- IF(KWSYS_IOS_HAS_OSTREAM___INT64)
- SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM___INT64=1)
- ENDIF()
- IF(KWSYS_BUILD_SHARED)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
- ENDIF()
-
- IF(UNIX AND NOT CYGWIN)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_GETLOADAVG
- "Checking whether CXX compiler has getloadavg" DIRECT)
- IF(KWSYS_CXX_HAS_GETLOADAVG)
- SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
- COMPILE_DEFINITIONS KWSYS_CXX_HAS_GETLOADAVG=1)
- ENDIF()
- ENDIF()
-ENDIF()
-
-IF(KWSYS_USE_FStream)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
- "Checking whether <ext/stdio_filebuf.h> is available" DIRECT)
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# Choose a directory for the generated headers.
-IF(NOT KWSYS_HEADER_ROOT)
- SET(KWSYS_HEADER_ROOT "${PROJECT_BINARY_DIR}")
-ENDIF()
-SET(KWSYS_HEADER_DIR "${KWSYS_HEADER_ROOT}/${KWSYS_NAMESPACE}")
-INCLUDE_DIRECTORIES(${KWSYS_HEADER_ROOT})
-
-#-----------------------------------------------------------------------------
-IF(KWSYS_INSTALL_DOC_DIR)
- # Assign the license to the runtime component since it must be
- # distributed with binary forms of this software.
- IF(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME)
- SET(KWSYS_INSTALL_LICENSE_OPTIONS ${KWSYS_INSTALL_LICENSE_OPTIONS}
- COMPONENT ${KWSYS_INSTALL_COMPONENT_NAME_RUNTIME}
- )
- ENDIF()
-
- # Install the license under the documentation directory.
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt
- DESTINATION ${KWSYS_INSTALL_DOC_DIR}/${KWSYS_NAMESPACE}
- ${KWSYS_INSTALL_LICENSE_OPTIONS})
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# Build a list of classes and headers we need to implement the
-# selected components. Initialize with required components.
-SET(KWSYS_CLASSES)
-SET(KWSYS_H_FILES Configure SharedForward)
-SET(KWSYS_HXX_FILES Configure String)
-
-IF(NOT CMake_SOURCE_DIR)
- SET(KWSYS_HXX_FILES ${KWSYS_HXX_FILES}
- hashtable hash_fun hash_map hash_set
- )
-ENDIF()
-
-# Add selected C++ classes.
-SET(cppclasses
- Directory DynamicLoader Encoding Glob RegularExpression SystemTools
- CommandLineArguments IOStream FStream SystemInformation ConsoleBuf
- )
-FOREACH(cpp ${cppclasses})
- IF(KWSYS_USE_${cpp})
- # Use the corresponding class.
- SET(KWSYS_CLASSES ${KWSYS_CLASSES} ${cpp})
-
- # Load component-specific CMake code.
- IF(EXISTS ${PROJECT_SOURCE_DIR}/kwsys${cpp}.cmake)
- INCLUDE(${PROJECT_SOURCE_DIR}/kwsys${cpp}.cmake)
- ENDIF()
- ENDIF()
-ENDFOREACH()
-
-# Add selected C components.
-FOREACH(c
- Process Base64 Encoding MD5 Terminal System String
- )
- IF(KWSYS_USE_${c})
- # Use the corresponding header file.
- SET(KWSYS_H_FILES ${KWSYS_H_FILES} ${c})
-
- # Load component-specific CMake code.
- IF(EXISTS ${PROJECT_SOURCE_DIR}/kwsys${c}.cmake)
- INCLUDE(${PROJECT_SOURCE_DIR}/kwsys${c}.cmake)
- ENDIF()
- ENDIF()
-ENDFOREACH()
-
-#-----------------------------------------------------------------------------
-# Build a list of sources for the library based on components that are
-# included.
-SET(KWSYS_C_SRCS)
-SET(KWSYS_CXX_SRCS)
-
-# Add the proper sources for this platform's Process implementation.
-IF(KWSYS_USE_Process)
- IF(NOT UNIX)
- # Use the Windows implementation.
- SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessWin32.c)
- ELSE()
- # Use the UNIX implementation.
- SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessUNIX.c)
- ENDIF()
-ENDIF()
-
-# Add selected C sources.
-FOREACH(c Base64 Encoding MD5 Terminal System String)
- IF(KWSYS_USE_${c})
- IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}C.c)
- LIST(APPEND KWSYS_C_SRCS ${c}C.c)
- ELSE()
- LIST(APPEND KWSYS_C_SRCS ${c}.c)
- ENDIF()
- ENDIF()
-ENDFOREACH()
-
-# Configure headers of C++ classes and construct the list of sources.
-FOREACH(c ${KWSYS_CLASSES})
- # Add this source to the list of source files for the library.
- IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}CXX.cxx)
- LIST(APPEND KWSYS_CXX_SRCS ${c}CXX.cxx)
- ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}.cxx)
- LIST(APPEND KWSYS_CXX_SRCS ${c}.cxx)
- ENDIF()
-
- # Configure the header for this class.
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${c}.hxx.in ${KWSYS_HEADER_DIR}/${c}.hxx
- @ONLY IMMEDIATE)
- SET(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${KWSYS_HEADER_DIR}/${c}.hxx)
-
- # Create an install target for the header.
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/${c}.hxx
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
- ENDIF()
-ENDFOREACH()
-
-# Configure C headers.
-FOREACH(h ${KWSYS_H_FILES})
- # Configure the header into the given directory.
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.h.in ${KWSYS_HEADER_DIR}/${h}.h
- @ONLY IMMEDIATE)
- SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ${KWSYS_HEADER_DIR}/${h}.h)
-
- # Create an install target for the header.
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/${h}.h
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
- ENDIF()
-ENDFOREACH()
-
-# Configure other C++ headers.
-FOREACH(h ${KWSYS_HXX_FILES})
- # Configure the header into the given directory.
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/${h}.hxx.in ${KWSYS_HEADER_DIR}/${h}.hxx
- @ONLY IMMEDIATE)
- SET(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${KWSYS_HEADER_DIR}/${h}.hxx)
-
- # Create an install target for the header.
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/${h}.hxx
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
- ENDIF()
-ENDFOREACH()
-
-#-----------------------------------------------------------------------------
-# Add the library with the configured name and list of sources.
-IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
- IF(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE)
- SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE})
- SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE}_objects)
- SET(KWSYS_TARGET_LINK ${KWSYS_NAMESPACE}_private)
- SET(KWSYS_TARGET_INSTALL ${KWSYS_TARGET_INTERFACE} ${KWSYS_TARGET_LINK})
- SET(KWSYS_LINK_DEPENDENCY INTERFACE)
- ADD_LIBRARY(${KWSYS_TARGET_OBJECT} OBJECT
- ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
- IF(KWSYS_BUILD_SHARED OR KWSYS_BUILD_PIC)
- SET_PROPERTY(TARGET ${KWSYS_TARGET_OBJECT} PROPERTY
- POSITION_INDEPENDENT_CODE TRUE)
- ENDIF()
- ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} INTERFACE)
- ADD_LIBRARY(${KWSYS_TARGET_LINK} INTERFACE)
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_LINK} INTERFACE
- ${KWSYS_TARGET_INTERFACE})
- TARGET_SOURCES(${KWSYS_TARGET_LINK} INTERFACE
- $<TARGET_OBJECTS:${KWSYS_TARGET_OBJECT}>)
- target_compile_features(${KWSYS_TARGET_OBJECT} PRIVATE ${KWSYS_CXX_COMPILE_FEATURES})
- target_compile_features(${KWSYS_TARGET_INTERFACE} INTERFACE ${KWSYS_CXX_COMPILE_FEATURES})
- ELSE()
- SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE})
- SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE})
- SET(KWSYS_TARGET_LINK ${KWSYS_NAMESPACE})
- set(KWSYS_TARGET_INSTALL ${KWSYS_TARGET_LINK})
- SET(KWSYS_LINK_DEPENDENCY PUBLIC)
- ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} ${KWSYS_LIBRARY_TYPE}
- ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
- target_compile_features(${KWSYS_TARGET_INTERFACE} PUBLIC ${KWSYS_CXX_COMPILE_FEATURES})
- ENDIF()
- if (KWSYS_ALIAS_TARGET)
- add_library(${KWSYS_ALIAS_TARGET} ALIAS ${KWSYS_TARGET_INTERFACE})
- endif ()
- SET_TARGET_PROPERTIES(${KWSYS_TARGET_OBJECT} PROPERTIES
- C_CLANG_TIDY ""
- CXX_CLANG_TIDY ""
- C_INCLUDE_WHAT_YOU_USE ""
- CXX_INCLUDE_WHAT_YOU_USE ""
- LABELS "${KWSYS_LABELS_LIB}")
- IF(KWSYS_USE_DynamicLoader)
- IF(UNIX)
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY}
- ${CMAKE_DL_LIBS})
- ENDIF()
- ENDIF()
-
- IF(KWSYS_USE_SystemInformation)
- IF(WIN32)
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} ws2_32)
- # link in dbghelp.dll for symbol lookup if MSVC 1800 or later
- # Note that the dbghelp runtime is part of MS Windows OS
- IF(MSVC_VERSION AND NOT MSVC_VERSION VERSION_LESS 1800)
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} dbghelp)
- ENDIF()
- IF(KWSYS_SYS_HAS_PSAPI)
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY}
- Psapi)
- ENDIF()
- ELSEIF(UNIX)
- IF (EXECINFO_LIB AND KWSYS_CXX_HAS_BACKTRACE)
- # backtrace on FreeBSD is not in libc
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY}
- ${EXECINFO_LIB})
- ENDIF()
- IF (KWSYS_CXX_HAS_DLADDR)
- # for symbol lookup using dladdr
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY}
- ${CMAKE_DL_LIBS})
- ENDIF()
- IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY}
- socket)
- ENDIF()
- ENDIF()
- ENDIF()
-
- # Apply user-defined target properties to the library.
- IF(KWSYS_PROPERTIES_CXX)
- SET_TARGET_PROPERTIES(${KWSYS_TARGET_INTERFACE} PROPERTIES
- ${KWSYS_PROPERTIES_CXX})
- ENDIF()
-
- # Set up include usage requirement
- IF(COMMAND TARGET_INCLUDE_DIRECTORIES)
- TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE
- $<BUILD_INTERFACE:${KWSYS_HEADER_ROOT}>)
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE
- $<INSTALL_INTERFACE:${KWSYS_INSTALL_INCLUDE_DIR}>)
- ENDIF()
- ENDIF()
-
- # Create an install target for the library.
- IF(KWSYS_INSTALL_LIBRARY_RULE)
- INSTALL(TARGETS ${KWSYS_TARGET_INSTALL} ${KWSYS_INSTALL_LIBRARY_RULE})
- ENDIF()
- IF(KWSYS_INSTALL_NAMELINK_RULE)
- INSTALL(TARGETS ${KWSYS_TARGET_INSTALL} ${KWSYS_INSTALL_NAMELINK_RULE})
- ENDIF()
-ENDIF()
-
-# Add a C-only library if requested.
-IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
- IF(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE)
- SET(KWSYS_TARGET_C_INTERFACE ${KWSYS_NAMESPACE}_c)
- SET(KWSYS_TARGET_C_OBJECT ${KWSYS_NAMESPACE}_c_objects)
- SET(KWSYS_TARGET_C_LINK ${KWSYS_NAMESPACE}_c_private)
- SET(KWSYS_TARGET_C_INSTALL
- ${KWSYS_TARGET_C_INTERFACE} ${KWSYS_TARGET_C_LINK})
- SET(KWSYS_LINK_DEPENDENCY INTERFACE)
- ADD_LIBRARY(${KWSYS_TARGET_C_OBJECT} OBJECT ${KWSYS_C_SRCS})
- IF(KWSYS_BUILD_SHARED OR KWSYS_BUILD_PIC)
- SET_PROPERTY(TARGET ${KWSYS_TARGET_C_OBJECT} PROPERTY
- POSITION_INDEPENDENT_CODE TRUE)
- ENDIF()
- ADD_LIBRARY(${KWSYS_TARGET_C_INTERFACE} INTERFACE)
- ADD_LIBRARY(${KWSYS_TARGET_C_LINK} INTERFACE)
- TARGET_LINK_LIBRARIES(${KWSYS_TARGET_C_LINK} INTERFACE
- ${KWSYS_TARGET_C_INTERFACE})
- TARGET_SOURCES(${KWSYS_TARGET_C_LINK} INTERFACE
- $<TARGET_OBJECTS:${KWSYS_TARGET_C_OBJECT}>)
- ELSE()
- SET(KWSYS_TARGET_C_INTERFACE ${KWSYS_NAMESPACE}_c)
- SET(KWSYS_TARGET_C_OBJECT ${KWSYS_NAMESPACE}_c)
- SET(KWSYS_TARGET_C_LINK ${KWSYS_NAMESPACE}_c)
- SET(KWSYS_TARGET_C_INSTALL ${KWSYS_TARGET_C_LINK})
- SET(KWSYS_LINK_DEPENDENCY PUBLIC)
- ADD_LIBRARY(${KWSYS_TARGET_C_INTERFACE} ${KWSYS_LIBRARY_TYPE}
- ${KWSYS_C_SRCS})
- ENDIF()
- SET_TARGET_PROPERTIES(${KWSYS_TARGET_C_OBJECT} PROPERTIES
- LABELS "${KWSYS_LABELS_LIB}")
-
- # Apply user-defined target properties to the library.
- IF(KWSYS_PROPERTIES_C)
- SET_TARGET_PROPERTIES(${KWSYS_TARGET_C_INTERFACE} PROPERTIES
- ${KWSYS_PROPERTIES_C})
- ENDIF()
-
- # Set up include usage requirement
- IF(COMMAND TARGET_INCLUDE_DIRECTORIES)
- TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_C_INTERFACE} INTERFACE
- $<BUILD_INTERFACE:${KWSYS_HEADER_ROOT}>)
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_C_INTERFACE} INTERFACE
- $<INSTALL_INTERFACE:${KWSYS_INSTALL_INCLUDE_DIR}>)
- ENDIF()
- ENDIF()
-
- # Create an install target for the library.
- IF(KWSYS_INSTALL_LIBRARY_RULE)
- INSTALL(TARGETS ${KWSYS_TARGET_C_INSTALL})
- ENDIF()
-ENDIF()
-
-# For building kwsys itself, we use a macro defined on the command
-# line to configure the namespace in the C and C++ source files.
-ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
-
-# Disable deprecation warnings for standard C functions.
-IF(MSVC OR (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "Intel" OR
- (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))))
- ADD_DEFINITIONS(
- -D_CRT_NONSTDC_NO_DEPRECATE
- -D_CRT_SECURE_NO_DEPRECATE
- -D_CRT_SECURE_NO_WARNINGS
- -D_SCL_SECURE_NO_DEPRECATE
- )
-ENDIF()
-
-IF(WIN32)
- # Help enforce the use of wide Windows apis.
- ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
-ENDIF()
-
-IF(KWSYS_USE_String)
- # Activate code in "String.c". See the comment in the source.
- SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES
- COMPILE_FLAGS "-DKWSYS_STRING_C")
-ENDIF()
-
-IF(KWSYS_USE_Encoding)
- # Set default 8 bit encoding in "EndcodingC.c".
- SET_PROPERTY(SOURCE EncodingC.c EncodingCXX.cxx APPEND PROPERTY COMPILE_DEFINITIONS
- KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# Setup testing if not being built as part of another project.
-IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
- IF(BUILD_TESTING)
- # Compute the location of executables.
- SET(EXEC_DIR "${CMAKE_CURRENT_BINARY_DIR}")
- IF(EXECUTABLE_OUTPUT_PATH)
- SET(EXEC_DIR "${EXECUTABLE_OUTPUT_PATH}")
- ENDIF()
-
- # C tests
- SET(KWSYS_C_TESTS
- testEncode.c
- testTerminal.c
- )
- IF(KWSYS_STANDALONE)
- SET(KWSYS_C_TESTS ${KWSYS_C_TESTS} testFail.c)
- ENDIF()
- CREATE_TEST_SOURCELIST(
- KWSYS_C_TEST_SRCS ${KWSYS_NAMESPACE}TestsC.c
- ${KWSYS_C_TESTS}
- )
- ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsC ${KWSYS_C_TEST_SRCS})
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsC PROPERTY LABELS ${KWSYS_LABELS_EXE})
- TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsC ${KWSYS_TARGET_C_LINK})
- FOREACH(testfile ${KWSYS_C_TESTS})
- get_filename_component(test "${testfile}" NAME_WE)
- ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsC ${test} ${KWSYS_TEST_ARGS_${test}})
- SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST})
- ENDFOREACH()
-
- # C++ tests
- IF(NOT WATCOM AND NOT CMake_SOURCE_DIR)
- SET(KWSYS_CXX_TESTS
- testHashSTL.cxx
- )
- ENDIF()
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testConfigure.cxx
- testSystemTools.cxx
- testCommandLineArguments.cxx
- testCommandLineArguments1.cxx
- testDirectory.cxx
- )
- IF(KWSYS_STL_HAS_WSTRING)
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testEncoding.cxx
- )
- ENDIF()
- IF(KWSYS_USE_FStream)
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testFStream.cxx
- )
- ENDIF()
- IF(KWSYS_USE_ConsoleBuf)
- ADD_EXECUTABLE(testConsoleBufChild testConsoleBufChild.cxx)
- SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_CLANG_TIDY "")
- SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_CLANG_TIDY "")
- SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_INCLUDE_WHAT_YOU_USE "")
- SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
- SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE})
- TARGET_LINK_LIBRARIES(testConsoleBufChild ${KWSYS_TARGET_LINK})
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testConsoleBuf.cxx
- )
- IF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
- CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "19.0.23506")
- set_property(SOURCE testConsoleBuf.cxx testConsoleBufChild.cxx PROPERTY COMPILE_FLAGS /utf-8)
- ENDIF()
- SET_PROPERTY(SOURCE testConsoleBuf.cxx APPEND PROPERTY COMPILE_DEFINITIONS
- KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})
- ENDIF()
- IF(KWSYS_USE_SystemInformation)
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation.cxx)
- ENDIF()
- IF(KWSYS_USE_DynamicLoader)
- SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testDynamicLoader.cxx)
- # If kwsys contains the DynamicLoader, need extra library
- ADD_LIBRARY(${KWSYS_NAMESPACE}TestDynload MODULE testDynload.c)
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestDynload PROPERTY LABELS ${KWSYS_LABELS_LIB})
- ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestDynload ${KWSYS_TARGET_INTERFACE})
-
- if (WIN32)
- # Windows tests supported flags.
- add_library(${KWSYS_NAMESPACE}TestDynloadImpl SHARED testDynloadImpl.c)
- set_property(TARGET ${KWSYS_NAMESPACE}TestDynloadImpl PROPERTY LABELS ${KWSYS_LABELS_LIB})
- set_property(TARGET ${KWSYS_NAMESPACE}TestDynloadImpl PROPERTY DEFINE_SYMBOL BUILDING_TestDynloadImpl)
- set_property(TARGET ${KWSYS_NAMESPACE}TestDynloadImpl PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynloaddir")
- add_dependencies(${KWSYS_NAMESPACE}TestDynloadImpl ${KWSYS_TARGET_INTERFACE})
- add_library(${KWSYS_NAMESPACE}TestDynloadUse MODULE testDynloadUse.c)
- set_property(TARGET ${KWSYS_NAMESPACE}TestDynloadUse PROPERTY LABELS ${KWSYS_LABELS_LIB})
- set_property(TARGET ${KWSYS_NAMESPACE}TestDynloadUse PROPERTY LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynloaddir")
- add_dependencies(${KWSYS_NAMESPACE}TestDynloadUse ${KWSYS_TARGET_INTERFACE})
- target_link_libraries(${KWSYS_NAMESPACE}TestDynloadUse PRIVATE ${KWSYS_NAMESPACE}TestDynloadImpl)
- endif ()
- ENDIF()
- CREATE_TEST_SOURCELIST(
- KWSYS_CXX_TEST_SRCS ${KWSYS_NAMESPACE}TestsCxx.cxx
- ${KWSYS_CXX_TESTS}
- )
- ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS})
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_CLANG_TIDY "")
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_CLANG_TIDY "")
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_INCLUDE_WHAT_YOU_USE "")
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE})
- TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_TARGET_LINK})
-
- SET(TEST_SYSTEMTOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
- SET(TEST_SYSTEMTOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
- CONFIGURE_FILE(
- ${PROJECT_SOURCE_DIR}/testSystemTools.h.in
- ${PROJECT_BINARY_DIR}/testSystemTools.h)
- INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
-
- IF(CTEST_TEST_KWSYS)
- CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ExtraTest.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
- SET_DIRECTORY_PROPERTIES(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
- ENDIF()
-
- SET(KWSYS_TEST_ARGS_testCommandLineArguments
- --another-bool-variable
- --long3=opt
- --set-bool-arg1
- -SSS ken brad bill andy
- --some-bool-variable=true
- --some-double-variable12.5
- --some-int-variable 14
- "--some-string-variable=test string with space"
- --some-multi-argument 5 1 8 3 7 1 3 9 7 1
- -N 12.5 -SS=andy -N 1.31 -N 22
- -SS=bill -BBtrue -SS=brad
- -BBtrue
- -BBfalse
- -SS=ken
- -A
- -C=test
- --long2 hello
- )
- SET(KWSYS_TEST_ARGS_testCommandLineArguments1
- --ignored
- -n 24
- --second-ignored
- "-m=test value"
- third-ignored
- -p
- some junk at the end
- )
- FOREACH(testfile ${KWSYS_CXX_TESTS})
- get_filename_component(test "${testfile}" NAME_WE)
- ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsCxx ${test} ${KWSYS_TEST_ARGS_${test}})
- SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST})
- ENDFOREACH()
-
- # Process tests.
- ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestProcess testProcess.c)
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestProcess PROPERTY LABELS ${KWSYS_LABELS_EXE})
- TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestProcess ${KWSYS_TARGET_C_LINK})
- IF(NOT CYGWIN)
- SET(KWSYS_TEST_PROCESS_7 7)
- ENDIF()
- FOREACH(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10)
- ADD_TEST(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n})
- SET_PROPERTY(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST})
- SET_TESTS_PROPERTIES(kwsys.testProcess-${n} PROPERTIES TIMEOUT 120)
- ENDFOREACH()
-
- SET(testProcess_COMPILE_FLAGS "")
- # Some Apple compilers produce bad optimizations in this source.
- IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$")
- SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -O0")
- ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL")
- # Tell IBM XL not to warn about our test infinite loop
- IF(CMAKE_SYSTEM MATCHES "Linux.*ppc64le"
- AND CMAKE_C_COMPILER_VERSION VERSION_LESS "16.1.0"
- AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1")
- # v13.1.[1-6] on Linux ppc64le is clang based and does not accept
- # the -qsuppress option, so just suppress all warnings.
- SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -w")
- ELSE()
- SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010")
- ENDIF()
- ENDIF()
- IF(CMAKE_C_FLAGS MATCHES "-fsanitize=")
- SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -DCRASH_USING_ABORT")
- ENDIF()
- SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS "${testProcess_COMPILE_FLAGS}")
-
- # Test SharedForward
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/testSharedForward.c.in
- ${PROJECT_BINARY_DIR}/testSharedForward.c @ONLY IMMEDIATE)
- ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestSharedForward
- ${PROJECT_BINARY_DIR}/testSharedForward.c)
- SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestSharedForward PROPERTY LABELS ${KWSYS_LABELS_EXE})
- ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestSharedForward ${KWSYS_TARGET_C_LINK})
- ADD_TEST(kwsys.testSharedForward ${EXEC_DIR}/${KWSYS_NAMESPACE}TestSharedForward 1)
- SET_PROPERTY(TEST kwsys.testSharedForward PROPERTY LABELS ${KWSYS_LABELS_TEST})
-
- # Configure some test properties.
- IF(KWSYS_STANDALONE)
- # We expect test to fail
- SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES WILL_FAIL ON)
- GET_TEST_PROPERTY(kwsys.testFail WILL_FAIL wfv)
- SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value")
- MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}")
- ENDIF()
-
- # Set up ctest custom configuration file.
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/CTestCustom.cmake.in
- ${PROJECT_BINARY_DIR}/CTestCustom.cmake @ONLY)
-
- # Suppress known consistent failures on buggy systems.
- IF(KWSYS_TEST_BOGUS_FAILURES)
- SET_TESTS_PROPERTIES(${KWSYS_TEST_BOGUS_FAILURES} PROPERTIES WILL_FAIL ON)
- ENDIF()
-
- ENDIF()
-ENDIF()
diff --git a/test/API/driver/kwsys/CONTRIBUTING.rst b/test/API/driver/kwsys/CONTRIBUTING.rst
deleted file mode 100644
index 32e7b83..0000000
--- a/test/API/driver/kwsys/CONTRIBUTING.rst
+++ /dev/null
@@ -1,49 +0,0 @@
-Contributing to KWSys
-*********************
-
-Patches
-=======
-
-KWSys is kept in its own Git repository and shared by several projects
-via copies in their source trees. Changes to KWSys should not be made
-directly in a host project, except perhaps in maintenance branches.
-
-KWSys uses `Kitware's GitLab Instance`_ to manage development and code review.
-To contribute patches:
-
-#. Fork the upstream `KWSys Repository`_ into a personal account.
-#. Base all new work on the upstream ``master`` branch.
-#. Run ``./SetupForDevelopment.sh`` in new local work trees.
-#. Create commits making incremental, distinct, logically complete changes.
-#. Push a topic branch to a personal repository fork on GitLab.
-#. Create a GitLab Merge Request targeting the upstream ``master`` branch.
-
-Once changes are reviewed, tested, and integrated to KWSys upstream then
-copies of KWSys within dependent projects can be updated to get the changes.
-
-.. _`Kitware's GitLab Instance`: https://gitlab.kitware.com
-.. _`KWSys Repository`: https://gitlab.kitware.com/utils/kwsys
-
-Code Style
-==========
-
-We use `clang-format`_ version **6.0** to define our style for C++ code in
-the KWSys source tree. See the `.clang-format`_ configuration file for
-our style settings. Use the `clang-format.bash`_ script to format source
-code. It automatically runs ``clang-format`` on the set of source files
-for which we enforce style. The script also has options to format only
-a subset of files, such as those that are locally modified.
-
-.. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html
-.. _`.clang-format`: .clang-format
-.. _`clang-format.bash`: clang-format.bash
-
-License
-=======
-
-We do not require any formal copyright assignment or contributor license
-agreement. Any contributions intentionally sent upstream are presumed
-to be offered under terms of the OSI-approved BSD 3-clause License.
-See `Copyright.txt`_ for details.
-
-.. _`Copyright.txt`: Copyright.txt
diff --git a/test/API/driver/kwsys/CTestConfig.cmake b/test/API/driver/kwsys/CTestConfig.cmake
deleted file mode 100644
index 1339ffc..0000000
--- a/test/API/driver/kwsys/CTestConfig.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing#kwsys for details.
-
-set(CTEST_PROJECT_NAME "KWSys")
-set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
-set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "open.cdash.org")
-set(CTEST_DROP_LOCATION "/submit.php?project=KWSys")
-set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/test/API/driver/kwsys/CTestCustom.cmake.in b/test/API/driver/kwsys/CTestCustom.cmake.in
deleted file mode 100644
index 760221b..0000000
--- a/test/API/driver/kwsys/CTestCustom.cmake.in
+++ /dev/null
@@ -1,14 +0,0 @@
-# kwsys.testProcess-10 involves sending SIGINT to a child process, which then
-# exits abnormally via a call to _exit(). (On Windows, a call to ExitProcess).
-# Naturally, this results in plenty of memory being "leaked" by this child
-# process - the memory check results are not meaningful in this case.
-#
-# kwsys.testProcess-9 also tests sending SIGINT to a child process. However,
-# normal operation of that test involves the child process timing out, and the
-# host process kills (SIGKILL) it as a result. Since it was SIGKILL'ed, the
-# resulting memory leaks are not logged by valgrind anyway. Therefore, we
-# don't have to exclude it.
-
-list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
- kwsys.testProcess-10
- )
diff --git a/test/API/driver/kwsys/CommandLineArguments.cxx b/test/API/driver/kwsys/CommandLineArguments.cxx
deleted file mode 100644
index 3fd1955..0000000
--- a/test/API/driver/kwsys/CommandLineArguments.cxx
+++ /dev/null
@@ -1,768 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(CommandLineArguments.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-#include KWSYS_HEADER(String.hxx)
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "CommandLineArguments.hxx.in"
-# include "Configure.hxx.in"
-# include "String.hxx.in"
-#endif
-
-#include <iostream>
-#include <map>
-#include <set>
-#include <sstream>
-#include <vector>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef _MSC_VER
-# pragma warning(disable : 4786)
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
-#if 0
-# define CommandLineArguments_DEBUG(x) \
- std::cout << __LINE__ << " CLA: " << x << std::endl
-#else
-# define CommandLineArguments_DEBUG(x)
-#endif
-
-namespace KWSYS_NAMESPACE {
-
-struct CommandLineArgumentsCallbackStructure
-{
- const char* Argument;
- int ArgumentType;
- CommandLineArguments::CallbackType Callback;
- void* CallData;
- void* Variable;
- int VariableType;
- const char* Help;
-};
-
-class CommandLineArgumentsVectorOfStrings : public std::vector<kwsys::String>
-{
-};
-class CommandLineArgumentsSetOfStrings : public std::set<kwsys::String>
-{
-};
-class CommandLineArgumentsMapOfStrucs
- : public std::map<kwsys::String, CommandLineArgumentsCallbackStructure>
-{
-};
-
-class CommandLineArgumentsInternal
-{
-public:
- CommandLineArgumentsInternal()
- : UnknownArgumentCallback{ nullptr }
- , ClientData{ nullptr }
- , LastArgument{ 0 }
- {
- }
-
- typedef CommandLineArgumentsVectorOfStrings VectorOfStrings;
- typedef CommandLineArgumentsMapOfStrucs CallbacksMap;
- typedef kwsys::String String;
- typedef CommandLineArgumentsSetOfStrings SetOfStrings;
-
- VectorOfStrings Argv;
- String Argv0;
- CallbacksMap Callbacks;
-
- CommandLineArguments::ErrorCallbackType UnknownArgumentCallback;
- void* ClientData;
-
- VectorOfStrings::size_type LastArgument;
-
- VectorOfStrings UnusedArguments;
-};
-
-CommandLineArguments::CommandLineArguments()
-{
- this->Internals = new CommandLineArguments::Internal;
- this->Help = "";
- this->LineLength = 80;
- this->StoreUnusedArgumentsFlag = false;
-}
-
-CommandLineArguments::~CommandLineArguments()
-{
- delete this->Internals;
-}
-
-void CommandLineArguments::Initialize(int argc, const char* const argv[])
-{
- int cc;
-
- this->Initialize();
- this->Internals->Argv0 = argv[0];
- for (cc = 1; cc < argc; cc++) {
- this->ProcessArgument(argv[cc]);
- }
-}
-
-void CommandLineArguments::Initialize(int argc, char* argv[])
-{
- this->Initialize(argc, static_cast<const char* const*>(argv));
-}
-
-void CommandLineArguments::Initialize()
-{
- this->Internals->Argv.clear();
- this->Internals->LastArgument = 0;
-}
-
-void CommandLineArguments::ProcessArgument(const char* arg)
-{
- this->Internals->Argv.push_back(arg);
-}
-
-bool CommandLineArguments::GetMatchedArguments(
- std::vector<std::string>* matches, const std::string& arg)
-{
- matches->clear();
- CommandLineArguments::Internal::CallbacksMap::iterator it;
-
- // Does the argument match to any we know about?
- for (it = this->Internals->Callbacks.begin();
- it != this->Internals->Callbacks.end(); it++) {
- const CommandLineArguments::Internal::String& parg = it->first;
- CommandLineArgumentsCallbackStructure* cs = &it->second;
- if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT ||
- cs->ArgumentType == CommandLineArguments::SPACE_ARGUMENT) {
- if (arg == parg) {
- matches->push_back(parg);
- }
- } else if (arg.find(parg) == 0) {
- matches->push_back(parg);
- }
- }
- return !matches->empty();
-}
-
-int CommandLineArguments::Parse()
-{
- std::vector<std::string>::size_type cc;
- std::vector<std::string> matches;
- if (this->StoreUnusedArgumentsFlag) {
- this->Internals->UnusedArguments.clear();
- }
- for (cc = 0; cc < this->Internals->Argv.size(); cc++) {
- const std::string& arg = this->Internals->Argv[cc];
- CommandLineArguments_DEBUG("Process argument: " << arg);
- this->Internals->LastArgument = cc;
- if (this->GetMatchedArguments(&matches, arg)) {
- // Ok, we found one or more arguments that match what user specified.
- // Let's find the longest one.
- CommandLineArguments::Internal::VectorOfStrings::size_type kk;
- CommandLineArguments::Internal::VectorOfStrings::size_type maxidx = 0;
- CommandLineArguments::Internal::String::size_type maxlen = 0;
- for (kk = 0; kk < matches.size(); kk++) {
- if (matches[kk].size() > maxlen) {
- maxlen = matches[kk].size();
- maxidx = kk;
- }
- }
- // So, the longest one is probably the right one. Now see if it has any
- // additional value
- CommandLineArgumentsCallbackStructure* cs =
- &this->Internals->Callbacks[matches[maxidx]];
- const std::string& sarg = matches[maxidx];
- if (cs->Argument != sarg) {
- abort();
- }
- switch (cs->ArgumentType) {
- case NO_ARGUMENT:
- // No value
- if (!this->PopulateVariable(cs, nullptr)) {
- return 0;
- }
- break;
- case SPACE_ARGUMENT:
- if (cc == this->Internals->Argv.size() - 1) {
- this->Internals->LastArgument--;
- return 0;
- }
- CommandLineArguments_DEBUG("This is a space argument: "
- << arg << " value: "
- << this->Internals->Argv[cc + 1]);
- // Value is the next argument
- if (!this->PopulateVariable(cs,
- this->Internals->Argv[cc + 1].c_str())) {
- return 0;
- }
- cc++;
- break;
- case EQUAL_ARGUMENT:
- if (arg.size() == sarg.size() || arg.at(sarg.size()) != '=') {
- this->Internals->LastArgument--;
- return 0;
- }
- // Value is everythng followed the '=' sign
- if (!this->PopulateVariable(cs, arg.c_str() + sarg.size() + 1)) {
- return 0;
- }
- break;
- case CONCAT_ARGUMENT:
- // Value is whatever follows the argument
- if (!this->PopulateVariable(cs, arg.c_str() + sarg.size())) {
- return 0;
- }
- break;
- case MULTI_ARGUMENT:
- // Suck in all the rest of the arguments
- CommandLineArguments_DEBUG("This is a multi argument: " << arg);
- for (cc++; cc < this->Internals->Argv.size(); ++cc) {
- const std::string& marg = this->Internals->Argv[cc];
- CommandLineArguments_DEBUG(
- " check multi argument value: " << marg);
- if (this->GetMatchedArguments(&matches, marg)) {
- CommandLineArguments_DEBUG("End of multi argument "
- << arg << " with value: " << marg);
- break;
- }
- CommandLineArguments_DEBUG(
- " populate multi argument value: " << marg);
- if (!this->PopulateVariable(cs, marg.c_str())) {
- return 0;
- }
- }
- if (cc != this->Internals->Argv.size()) {
- CommandLineArguments_DEBUG("Again End of multi argument " << arg);
- cc--;
- continue;
- }
- break;
- default:
- std::cerr << "Got unknown argument type: \"" << cs->ArgumentType
- << "\"" << std::endl;
- this->Internals->LastArgument--;
- return 0;
- }
- } else {
- // Handle unknown arguments
- if (this->Internals->UnknownArgumentCallback) {
- if (!this->Internals->UnknownArgumentCallback(
- arg.c_str(), this->Internals->ClientData)) {
- this->Internals->LastArgument--;
- return 0;
- }
- return 1;
- } else if (this->StoreUnusedArgumentsFlag) {
- CommandLineArguments_DEBUG("Store unused argument " << arg);
- this->Internals->UnusedArguments.push_back(arg);
- } else {
- std::cerr << "Got unknown argument: \"" << arg << "\"" << std::endl;
- this->Internals->LastArgument--;
- return 0;
- }
- }
- }
- return 1;
-}
-
-void CommandLineArguments::GetRemainingArguments(int* argc, char*** argv)
-{
- CommandLineArguments::Internal::VectorOfStrings::size_type size =
- this->Internals->Argv.size() - this->Internals->LastArgument + 1;
- CommandLineArguments::Internal::VectorOfStrings::size_type cc;
-
- // Copy Argv0 as the first argument
- char** args = new char*[size];
- args[0] = new char[this->Internals->Argv0.size() + 1];
- strcpy(args[0], this->Internals->Argv0.c_str());
- int cnt = 1;
-
- // Copy everything after the LastArgument, since that was not parsed.
- for (cc = this->Internals->LastArgument + 1;
- cc < this->Internals->Argv.size(); cc++) {
- args[cnt] = new char[this->Internals->Argv[cc].size() + 1];
- strcpy(args[cnt], this->Internals->Argv[cc].c_str());
- cnt++;
- }
- *argc = cnt;
- *argv = args;
-}
-
-void CommandLineArguments::GetUnusedArguments(int* argc, char*** argv)
-{
- CommandLineArguments::Internal::VectorOfStrings::size_type size =
- this->Internals->UnusedArguments.size() + 1;
- CommandLineArguments::Internal::VectorOfStrings::size_type cc;
-
- // Copy Argv0 as the first argument
- char** args = new char*[size];
- args[0] = new char[this->Internals->Argv0.size() + 1];
- strcpy(args[0], this->Internals->Argv0.c_str());
- int cnt = 1;
-
- // Copy everything after the LastArgument, since that was not parsed.
- for (cc = 0; cc < this->Internals->UnusedArguments.size(); cc++) {
- kwsys::String& str = this->Internals->UnusedArguments[cc];
- args[cnt] = new char[str.size() + 1];
- strcpy(args[cnt], str.c_str());
- cnt++;
- }
- *argc = cnt;
- *argv = args;
-}
-
-void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv)
-{
- int cc;
- for (cc = 0; cc < argc; ++cc) {
- delete[](*argv)[cc];
- }
- delete[] * argv;
-}
-
-void CommandLineArguments::AddCallback(const char* argument,
- ArgumentTypeEnum type,
- CallbackType callback, void* call_data,
- const char* help)
-{
- CommandLineArgumentsCallbackStructure s;
- s.Argument = argument;
- s.ArgumentType = type;
- s.Callback = callback;
- s.CallData = call_data;
- s.VariableType = CommandLineArguments::NO_VARIABLE_TYPE;
- s.Variable = nullptr;
- s.Help = help;
-
- this->Internals->Callbacks[argument] = s;
- this->GenerateHelp();
-}
-
-void CommandLineArguments::AddArgument(const char* argument,
- ArgumentTypeEnum type,
- VariableTypeEnum vtype, void* variable,
- const char* help)
-{
- CommandLineArgumentsCallbackStructure s;
- s.Argument = argument;
- s.ArgumentType = type;
- s.Callback = nullptr;
- s.CallData = nullptr;
- s.VariableType = vtype;
- s.Variable = variable;
- s.Help = help;
-
- this->Internals->Callbacks[argument] = s;
- this->GenerateHelp();
-}
-
-#define CommandLineArgumentsAddArgumentMacro(type, ctype) \
- void CommandLineArguments::AddArgument(const char* argument, \
- ArgumentTypeEnum type, \
- ctype* variable, const char* help) \
- { \
- this->AddArgument(argument, type, CommandLineArguments::type##_TYPE, \
- variable, help); \
- }
-
-/* clang-format off */
-CommandLineArgumentsAddArgumentMacro(BOOL, bool)
-CommandLineArgumentsAddArgumentMacro(INT, int)
-CommandLineArgumentsAddArgumentMacro(DOUBLE, double)
-CommandLineArgumentsAddArgumentMacro(STRING, char*)
-CommandLineArgumentsAddArgumentMacro(STL_STRING, std::string)
-
-CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector<bool>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector<int>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, std::vector<double>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, std::vector<char*>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING,
- std::vector<std::string>)
-#ifdef HELP_CLANG_FORMAT
-;
-#endif
-/* clang-format on */
-
-#define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \
- void CommandLineArguments::AddBooleanArgument( \
- const char* argument, ctype* variable, const char* help) \
- { \
- this->AddArgument(argument, CommandLineArguments::NO_ARGUMENT, \
- CommandLineArguments::type##_TYPE, variable, help); \
- }
-
-/* clang-format off */
-CommandLineArgumentsAddBooleanArgumentMacro(BOOL, bool)
-CommandLineArgumentsAddBooleanArgumentMacro(INT, int)
-CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE, double)
-CommandLineArgumentsAddBooleanArgumentMacro(STRING, char*)
-CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, std::string)
-#ifdef HELP_CLANG_FORMAT
-;
-#endif
-/* clang-format on */
-
-void CommandLineArguments::SetClientData(void* client_data)
-{
- this->Internals->ClientData = client_data;
-}
-
-void CommandLineArguments::SetUnknownArgumentCallback(
- CommandLineArguments::ErrorCallbackType callback)
-{
- this->Internals->UnknownArgumentCallback = callback;
-}
-
-const char* CommandLineArguments::GetHelp(const char* arg)
-{
- CommandLineArguments::Internal::CallbacksMap::iterator it =
- this->Internals->Callbacks.find(arg);
- if (it == this->Internals->Callbacks.end()) {
- return nullptr;
- }
-
- // Since several arguments may point to the same argument, find the one this
- // one point to if this one is pointing to another argument.
- CommandLineArgumentsCallbackStructure* cs = &(it->second);
- for (;;) {
- CommandLineArguments::Internal::CallbacksMap::iterator hit =
- this->Internals->Callbacks.find(cs->Help);
- if (hit == this->Internals->Callbacks.end()) {
- break;
- }
- cs = &(hit->second);
- }
- return cs->Help;
-}
-
-void CommandLineArguments::SetLineLength(unsigned int ll)
-{
- if (ll < 9 || ll > 1000) {
- return;
- }
- this->LineLength = ll;
- this->GenerateHelp();
-}
-
-const char* CommandLineArguments::GetArgv0()
-{
- return this->Internals->Argv0.c_str();
-}
-
-unsigned int CommandLineArguments::GetLastArgument()
-{
- return static_cast<unsigned int>(this->Internals->LastArgument + 1);
-}
-
-void CommandLineArguments::GenerateHelp()
-{
- std::ostringstream str;
-
- // Collapse all arguments into the map of vectors of all arguments that do
- // the same thing.
- CommandLineArguments::Internal::CallbacksMap::iterator it;
- typedef std::map<CommandLineArguments::Internal::String,
- CommandLineArguments::Internal::SetOfStrings>
- MapArgs;
- MapArgs mp;
- MapArgs::iterator mpit, smpit;
- for (it = this->Internals->Callbacks.begin();
- it != this->Internals->Callbacks.end(); it++) {
- CommandLineArgumentsCallbackStructure* cs = &(it->second);
- mpit = mp.find(cs->Help);
- if (mpit != mp.end()) {
- mpit->second.insert(it->first);
- mp[it->first].insert(it->first);
- } else {
- mp[it->first].insert(it->first);
- }
- }
- for (it = this->Internals->Callbacks.begin();
- it != this->Internals->Callbacks.end(); it++) {
- CommandLineArgumentsCallbackStructure* cs = &(it->second);
- mpit = mp.find(cs->Help);
- if (mpit != mp.end()) {
- mpit->second.insert(it->first);
- smpit = mp.find(it->first);
- CommandLineArguments::Internal::SetOfStrings::iterator sit;
- for (sit = smpit->second.begin(); sit != smpit->second.end(); sit++) {
- mpit->second.insert(*sit);
- }
- mp.erase(smpit);
- } else {
- mp[it->first].insert(it->first);
- }
- }
-
- // Find the length of the longest string
- CommandLineArguments::Internal::String::size_type maxlen = 0;
- for (mpit = mp.begin(); mpit != mp.end(); mpit++) {
- CommandLineArguments::Internal::SetOfStrings::iterator sit;
- for (sit = mpit->second.begin(); sit != mpit->second.end(); sit++) {
- CommandLineArguments::Internal::String::size_type clen = sit->size();
- switch (this->Internals->Callbacks[*sit].ArgumentType) {
- case CommandLineArguments::NO_ARGUMENT:
- clen += 0;
- break;
- case CommandLineArguments::CONCAT_ARGUMENT:
- clen += 3;
- break;
- case CommandLineArguments::SPACE_ARGUMENT:
- clen += 4;
- break;
- case CommandLineArguments::EQUAL_ARGUMENT:
- clen += 4;
- break;
- }
- if (clen > maxlen) {
- maxlen = clen;
- }
- }
- }
-
- CommandLineArguments::Internal::String::size_type maxstrlen = maxlen;
- maxlen += 4; // For the space before and after the option
-
- // Print help for each option
- for (mpit = mp.begin(); mpit != mp.end(); mpit++) {
- CommandLineArguments::Internal::SetOfStrings::iterator sit;
- for (sit = mpit->second.begin(); sit != mpit->second.end(); sit++) {
- str << std::endl;
- std::string argument = *sit;
- switch (this->Internals->Callbacks[*sit].ArgumentType) {
- case CommandLineArguments::NO_ARGUMENT:
- break;
- case CommandLineArguments::CONCAT_ARGUMENT:
- argument += "opt";
- break;
- case CommandLineArguments::SPACE_ARGUMENT:
- argument += " opt";
- break;
- case CommandLineArguments::EQUAL_ARGUMENT:
- argument += "=opt";
- break;
- case CommandLineArguments::MULTI_ARGUMENT:
- argument += " opt opt ...";
- break;
- }
- str << " " << argument.substr(0, maxstrlen) << " ";
- }
- const char* ptr = this->Internals->Callbacks[mpit->first].Help;
- size_t len = strlen(ptr);
- int cnt = 0;
- while (len > 0) {
- // If argument with help is longer than line length, split it on previous
- // space (or tab) and continue on the next line
- CommandLineArguments::Internal::String::size_type cc;
- for (cc = 0; ptr[cc]; cc++) {
- if (*ptr == ' ' || *ptr == '\t') {
- ptr++;
- len--;
- }
- }
- if (cnt > 0) {
- for (cc = 0; cc < maxlen; cc++) {
- str << " ";
- }
- }
- CommandLineArguments::Internal::String::size_type skip = len;
- if (skip > this->LineLength - maxlen) {
- skip = this->LineLength - maxlen;
- for (cc = skip - 1; cc > 0; cc--) {
- if (ptr[cc] == ' ' || ptr[cc] == '\t') {
- break;
- }
- }
- if (cc != 0) {
- skip = cc;
- }
- }
- str.write(ptr, static_cast<std::streamsize>(skip));
- str << std::endl;
- ptr += skip;
- len -= skip;
- cnt++;
- }
- }
- /*
- // This can help debugging help string
- str << endl;
- unsigned int cc;
- for ( cc = 0; cc < this->LineLength; cc ++ )
- {
- str << cc % 10;
- }
- str << endl;
- */
- this->Help = str.str();
-}
-
-void CommandLineArguments::PopulateVariable(bool* variable,
- const std::string& value)
-{
- if (value == "1" || value == "ON" || value == "on" || value == "On" ||
- value == "TRUE" || value == "true" || value == "True" ||
- value == "yes" || value == "Yes" || value == "YES") {
- *variable = true;
- } else {
- *variable = false;
- }
-}
-
-void CommandLineArguments::PopulateVariable(int* variable,
- const std::string& value)
-{
- char* res = nullptr;
- *variable = static_cast<int>(strtol(value.c_str(), &res, 10));
- // if ( res && *res )
- // {
- // Can handle non-int
- // }
-}
-
-void CommandLineArguments::PopulateVariable(double* variable,
- const std::string& value)
-{
- char* res = nullptr;
- *variable = strtod(value.c_str(), &res);
- // if ( res && *res )
- // {
- // Can handle non-double
- // }
-}
-
-void CommandLineArguments::PopulateVariable(char** variable,
- const std::string& value)
-{
- delete[] * variable;
- *variable = new char[value.size() + 1];
- strcpy(*variable, value.c_str());
-}
-
-void CommandLineArguments::PopulateVariable(std::string* variable,
- const std::string& value)
-{
- *variable = value;
-}
-
-void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
- const std::string& value)
-{
- bool val = false;
- if (value == "1" || value == "ON" || value == "on" || value == "On" ||
- value == "TRUE" || value == "true" || value == "True" ||
- value == "yes" || value == "Yes" || value == "YES") {
- val = true;
- }
- variable->push_back(val);
-}
-
-void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
- const std::string& value)
-{
- char* res = nullptr;
- variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
- // if ( res && *res )
- // {
- // Can handle non-int
- // }
-}
-
-void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
- const std::string& value)
-{
- char* res = nullptr;
- variable->push_back(strtod(value.c_str(), &res));
- // if ( res && *res )
- // {
- // Can handle non-int
- // }
-}
-
-void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
- const std::string& value)
-{
- char* var = new char[value.size() + 1];
- strcpy(var, value.c_str());
- variable->push_back(var);
-}
-
-void CommandLineArguments::PopulateVariable(std::vector<std::string>* variable,
- const std::string& value)
-{
- variable->push_back(value);
-}
-
-bool CommandLineArguments::PopulateVariable(
- CommandLineArgumentsCallbackStructure* cs, const char* value)
-{
- // Call the callback
- if (cs->Callback) {
- if (!cs->Callback(cs->Argument, value, cs->CallData)) {
- this->Internals->LastArgument--;
- return 0;
- }
- }
- CommandLineArguments_DEBUG("Set argument: " << cs->Argument << " to "
- << value);
- if (cs->Variable) {
- std::string var = "1";
- if (value) {
- var = value;
- }
- switch (cs->VariableType) {
- case CommandLineArguments::INT_TYPE:
- this->PopulateVariable(static_cast<int*>(cs->Variable), var);
- break;
- case CommandLineArguments::DOUBLE_TYPE:
- this->PopulateVariable(static_cast<double*>(cs->Variable), var);
- break;
- case CommandLineArguments::STRING_TYPE:
- this->PopulateVariable(static_cast<char**>(cs->Variable), var);
- break;
- case CommandLineArguments::STL_STRING_TYPE:
- this->PopulateVariable(static_cast<std::string*>(cs->Variable), var);
- break;
- case CommandLineArguments::BOOL_TYPE:
- this->PopulateVariable(static_cast<bool*>(cs->Variable), var);
- break;
- case CommandLineArguments::VECTOR_BOOL_TYPE:
- this->PopulateVariable(static_cast<std::vector<bool>*>(cs->Variable),
- var);
- break;
- case CommandLineArguments::VECTOR_INT_TYPE:
- this->PopulateVariable(static_cast<std::vector<int>*>(cs->Variable),
- var);
- break;
- case CommandLineArguments::VECTOR_DOUBLE_TYPE:
- this->PopulateVariable(static_cast<std::vector<double>*>(cs->Variable),
- var);
- break;
- case CommandLineArguments::VECTOR_STRING_TYPE:
- this->PopulateVariable(static_cast<std::vector<char*>*>(cs->Variable),
- var);
- break;
- case CommandLineArguments::VECTOR_STL_STRING_TYPE:
- this->PopulateVariable(
- static_cast<std::vector<std::string>*>(cs->Variable), var);
- break;
- default:
- std::cerr << "Got unknown variable type: \"" << cs->VariableType
- << "\"" << std::endl;
- this->Internals->LastArgument--;
- return 0;
- }
- }
- return 1;
-}
-
-} // namespace KWSYS_NAMESPACE
diff --git a/test/API/driver/kwsys/CommandLineArguments.hxx.in b/test/API/driver/kwsys/CommandLineArguments.hxx.in
deleted file mode 100644
index 7db9015..0000000
--- a/test/API/driver/kwsys/CommandLineArguments.hxx.in
+++ /dev/null
@@ -1,270 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_CommandLineArguments_hxx
-#define @KWSYS_NAMESPACE@_CommandLineArguments_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <string>
-#include <vector>
-
-namespace @KWSYS_NAMESPACE@ {
-
-class CommandLineArgumentsInternal;
-struct CommandLineArgumentsCallbackStructure;
-
-/** \class CommandLineArguments
- * \brief Command line arguments processing code.
- *
- * Find specified arguments with optional options and execute specified methods
- * or set given variables.
- *
- * The two interfaces it knows are callback based and variable based. For
- * callback based, you have to register callback for particular argument using
- * AddCallback method. When that argument is passed, the callback will be
- * called with argument, value, and call data. For boolean (NO_ARGUMENT)
- * arguments, the value is "1". If the callback returns 0 the argument parsing
- * will stop with an error.
- *
- * For the variable interface you associate variable with each argument. When
- * the argument is specified, the variable is set to the specified value casted
- * to the appropriate type. For boolean (NO_ARGUMENT), the value is "1".
- *
- * Both interfaces can be used at the same time.
- *
- * Possible argument types are:
- * NO_ARGUMENT - The argument takes no value : --A
- * CONCAT_ARGUMENT - The argument takes value after no space : --Aval
- * SPACE_ARGUMENT - The argument takes value after space : --A val
- * EQUAL_ARGUMENT - The argument takes value after equal : --A=val
- * MULTI_ARGUMENT - The argument takes values after space : --A val1 val2
- * val3 ...
- *
- * Example use:
- *
- * kwsys::CommandLineArguments arg;
- * arg.Initialize(argc, argv);
- * typedef kwsys::CommandLineArguments argT;
- * arg.AddArgument("--something", argT::EQUAL_ARGUMENT, &some_variable,
- * "This is help string for --something");
- * if ( !arg.Parse() )
- * {
- * std::cerr << "Problem parsing arguments" << std::endl;
- * res = 1;
- * }
- *
- */
-
-class @KWSYS_NAMESPACE@_EXPORT CommandLineArguments
-{
-public:
- CommandLineArguments();
- ~CommandLineArguments();
-
- CommandLineArguments(const CommandLineArguments&) = delete;
- CommandLineArguments& operator=(const CommandLineArguments&) = delete;
-
- /**
- * Various argument types.
- */
- enum ArgumentTypeEnum
- {
- NO_ARGUMENT,
- CONCAT_ARGUMENT,
- SPACE_ARGUMENT,
- EQUAL_ARGUMENT,
- MULTI_ARGUMENT
- };
-
- /**
- * Various variable types. When using the variable interface, this specifies
- * what type the variable is.
- */
- enum VariableTypeEnum
- {
- NO_VARIABLE_TYPE = 0, // The variable is not specified
- INT_TYPE, // The variable is integer (int)
- BOOL_TYPE, // The variable is boolean (bool)
- DOUBLE_TYPE, // The variable is float (double)
- STRING_TYPE, // The variable is string (char*)
- STL_STRING_TYPE, // The variable is string (char*)
- VECTOR_INT_TYPE, // The variable is integer (int)
- VECTOR_BOOL_TYPE, // The variable is boolean (bool)
- VECTOR_DOUBLE_TYPE, // The variable is float (double)
- VECTOR_STRING_TYPE, // The variable is string (char*)
- VECTOR_STL_STRING_TYPE, // The variable is string (char*)
- LAST_VARIABLE_TYPE
- };
-
- /**
- * Prototypes for callbacks for callback interface.
- */
- typedef int (*CallbackType)(const char* argument, const char* value,
- void* call_data);
- typedef int (*ErrorCallbackType)(const char* argument, void* client_data);
-
- /**
- * Initialize internal data structures. This should be called before parsing.
- */
- void Initialize(int argc, const char* const argv[]);
- void Initialize(int argc, char* argv[]);
-
- /**
- * Initialize internal data structure and pass arguments one by one. This is
- * convenience method for use from scripting languages where argc and argv
- * are not available.
- */
- void Initialize();
- void ProcessArgument(const char* arg);
-
- /**
- * This method will parse arguments and call appropriate methods.
- */
- int Parse();
-
- /**
- * This method will add a callback for a specific argument. The arguments to
- * it are argument, argument type, callback method, and call data. The
- * argument help specifies the help string used with this option. The
- * callback and call_data can be skipped.
- */
- void AddCallback(const char* argument, ArgumentTypeEnum type,
- CallbackType callback, void* call_data, const char* help);
-
- /**
- * Add handler for argument which is going to set the variable to the
- * specified value. If the argument is specified, the option is casted to the
- * appropriate type.
- */
- void AddArgument(const char* argument, ArgumentTypeEnum type, bool* variable,
- const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type, int* variable,
- const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- double* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- char** variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::string* variable, const char* help);
-
- /**
- * Add handler for argument which is going to set the variable to the
- * specified value. If the argument is specified, the option is casted to the
- * appropriate type. This will handle the multi argument values.
- */
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<bool>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<int>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<double>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<char*>* variable, const char* help);
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- std::vector<std::string>* variable, const char* help);
-
- /**
- * Add handler for boolean argument. The argument does not take any option
- * and if it is specified, the value of the variable is true/1, otherwise it
- * is false/0.
- */
- void AddBooleanArgument(const char* argument, bool* variable,
- const char* help);
- void AddBooleanArgument(const char* argument, int* variable,
- const char* help);
- void AddBooleanArgument(const char* argument, double* variable,
- const char* help);
- void AddBooleanArgument(const char* argument, char** variable,
- const char* help);
- void AddBooleanArgument(const char* argument, std::string* variable,
- const char* help);
-
- /**
- * Set the callbacks for error handling.
- */
- void SetClientData(void* client_data);
- void SetUnknownArgumentCallback(ErrorCallbackType callback);
-
- /**
- * Get remaining arguments. It allocates space for argv, so you have to call
- * delete[] on it.
- */
- void GetRemainingArguments(int* argc, char*** argv);
- void DeleteRemainingArguments(int argc, char*** argv);
-
- /**
- * If StoreUnusedArguments is set to true, then all unknown arguments will be
- * stored and the user can access the modified argc, argv without known
- * arguments.
- */
- void StoreUnusedArguments(bool val) { this->StoreUnusedArgumentsFlag = val; }
- void GetUnusedArguments(int* argc, char*** argv);
-
- /**
- * Return string containing help. If the argument is specified, only return
- * help for that argument.
- */
- const char* GetHelp() { return this->Help.c_str(); }
- const char* GetHelp(const char* arg);
-
- /**
- * Get / Set the help line length. This length is used when generating the
- * help page. Default length is 80.
- */
- void SetLineLength(unsigned int);
- unsigned int GetLineLength();
-
- /**
- * Get the executable name (argv0). This is only available when using
- * Initialize with argc/argv.
- */
- const char* GetArgv0();
-
- /**
- * Get index of the last argument parsed. This is the last argument that was
- * parsed ok in the original argc/argv list.
- */
- unsigned int GetLastArgument();
-
-protected:
- void GenerateHelp();
-
- //! This is internal method that registers variable with argument
- void AddArgument(const char* argument, ArgumentTypeEnum type,
- VariableTypeEnum vtype, void* variable, const char* help);
-
- bool GetMatchedArguments(std::vector<std::string>* matches,
- const std::string& arg);
-
- //! Populate individual variables
- bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
- const char* value);
-
- //! Populate individual variables of type ...
- void PopulateVariable(bool* variable, const std::string& value);
- void PopulateVariable(int* variable, const std::string& value);
- void PopulateVariable(double* variable, const std::string& value);
- void PopulateVariable(char** variable, const std::string& value);
- void PopulateVariable(std::string* variable, const std::string& value);
- void PopulateVariable(std::vector<bool>* variable, const std::string& value);
- void PopulateVariable(std::vector<int>* variable, const std::string& value);
- void PopulateVariable(std::vector<double>* variable,
- const std::string& value);
- void PopulateVariable(std::vector<char*>* variable,
- const std::string& value);
- void PopulateVariable(std::vector<std::string>* variable,
- const std::string& value);
-
- typedef CommandLineArgumentsInternal Internal;
- Internal* Internals;
- std::string Help;
-
- unsigned int LineLength;
-
- bool StoreUnusedArgumentsFlag;
-};
-
-} // namespace @KWSYS_NAMESPACE@
-
-#endif
diff --git a/test/API/driver/kwsys/Configure.h.in b/test/API/driver/kwsys/Configure.h.in
deleted file mode 100644
index 5323c57..0000000
--- a/test/API/driver/kwsys/Configure.h.in
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_Configure_h
-#define @KWSYS_NAMESPACE@_Configure_h
-
-/* If we are building a kwsys .c or .cxx file, let it use the kwsys
- namespace. When not building a kwsys source file these macros are
- temporarily defined inside the headers that use them. */
-#if defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
-#endif
-
-/* Disable some warnings inside kwsys source files. */
-#if defined(KWSYS_NAMESPACE)
-# if defined(__BORLANDC__)
-# pragma warn - 8027 /* function not inlined. */
-# endif
-# if defined(__INTEL_COMPILER)
-# pragma warning(disable : 1572) /* floating-point equality test */
-# endif
-# if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 3970 /* pointer to int conversion */
-# pragma set woff 3968 /* 64 bit conversion */
-# endif
-#endif
-
-/* Whether kwsys namespace is "kwsys". */
-#define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
-
-/* Setup the export macro. */
-#if @KWSYS_BUILD_SHARED@
-# if defined(_WIN32) || defined(__CYGWIN__)
-# if defined(@KWSYS_NAMESPACE@_EXPORTS)
-# define @KWSYS_NAMESPACE@_EXPORT __declspec(dllexport)
-# else
-# define @KWSYS_NAMESPACE@_EXPORT __declspec(dllimport)
-# endif
-# elif __GNUC__ >= 4
-# define @KWSYS_NAMESPACE@_EXPORT __attribute__((visibility("default")))
-# else
-# define @KWSYS_NAMESPACE@_EXPORT
-# endif
-#else
-# define @KWSYS_NAMESPACE@_EXPORT
-#endif
-
-/* Enable warnings that are off by default but are useful. */
-#if !defined(@KWSYS_NAMESPACE@_NO_WARNING_ENABLE)
-# if defined(_MSC_VER)
-# pragma warning(default : 4263) /* no override, call convention differs \
- */
-# endif
-#endif
-
-/* Disable warnings that are on by default but occur in valid code. */
-#if !defined(@KWSYS_NAMESPACE@_NO_WARNING_DISABLE)
-# if defined(_MSC_VER)
-# pragma warning(disable : 4097) /* typedef is synonym for class */
-# pragma warning(disable : 4127) /* conditional expression is constant */
-# pragma warning(disable : 4244) /* possible loss in conversion */
-# pragma warning(disable : 4251) /* missing DLL-interface */
-# pragma warning(disable : 4305) /* truncation from type1 to type2 */
-# pragma warning(disable : 4309) /* truncation of constant value */
-# pragma warning(disable : 4514) /* unreferenced inline function */
-# pragma warning(disable : 4706) /* assignment in conditional expression \
- */
-# pragma warning(disable : 4710) /* function not inlined */
-# pragma warning(disable : 4786) /* identifier truncated in debug info */
-# endif
-# if defined(__BORLANDC__) && !defined(__cplusplus)
-/* Code has no effect; raised by winnt.h in C (not C++) when ignoring an
- unused parameter using "(param)" syntax (i.e. no cast to void). */
-# pragma warn - 8019
-# endif
-#endif
-
-/* MSVC 6.0 in release mode will warn about code it produces with its
- optimizer. Disable the warnings specifically for this
- configuration. Real warnings will be revealed by a debug build or
- by other compilers. */
-#if !defined(@KWSYS_NAMESPACE@_NO_WARNING_DISABLE_BOGUS)
-# if defined(_MSC_VER) && (_MSC_VER < 1300) && defined(NDEBUG)
-# pragma warning(disable : 4701) /* Variable may be used uninitialized. */
-# pragma warning(disable : 4702) /* Unreachable code. */
-# endif
-#endif
-
-#endif
diff --git a/test/API/driver/kwsys/Configure.hxx.in b/test/API/driver/kwsys/Configure.hxx.in
deleted file mode 100644
index 29a2dd1..0000000
--- a/test/API/driver/kwsys/Configure.hxx.in
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_Configure_hxx
-#define @KWSYS_NAMESPACE@_Configure_hxx
-
-/* Include C configuration. */
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-/* Whether wstring is available. */
-#define @KWSYS_NAMESPACE@_STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@
-/* Whether <ext/stdio_filebuf.h> is available. */
-#define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H \
- @KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@
-/* Whether the translation map is available or not. */
-#define @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP \
- @KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@
-
-#if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute)
-# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_attribute(x)
-#elif defined(__has_cpp_attribute)
-# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_cpp_attribute(x)
-#else
-# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) 0
-#endif
-
-#if __cplusplus >= 201103L
-# define @KWSYS_NAMESPACE@_NULLPTR nullptr
-#else
-# define @KWSYS_NAMESPACE@_NULLPTR 0
-#endif
-
-#ifndef @KWSYS_NAMESPACE@_FALLTHROUGH
-# if __cplusplus >= 201703L && \
- @KWSYS_NAMESPACE@__has_cpp_attribute(fallthrough)
-# define @KWSYS_NAMESPACE@_FALLTHROUGH [[fallthrough]]
-# elif __cplusplus >= 201103L && \
- @KWSYS_NAMESPACE@__has_cpp_attribute(gnu::fallthrough)
-# define @KWSYS_NAMESPACE@_FALLTHROUGH [[gnu::fallthrough]]
-# elif __cplusplus >= 201103L && \
- @KWSYS_NAMESPACE@__has_cpp_attribute(clang::fallthrough)
-# define @KWSYS_NAMESPACE@_FALLTHROUGH [[clang::fallthrough]]
-# endif
-#endif
-#ifndef @KWSYS_NAMESPACE@_FALLTHROUGH
-# define @KWSYS_NAMESPACE@_FALLTHROUGH static_cast<void>(0)
-#endif
-
-#undef @KWSYS_NAMESPACE@__has_cpp_attribute
-
-/* If building a C++ file in kwsys itself, give the source file
- access to the macros without a configured namespace. */
-#if defined(KWSYS_NAMESPACE)
-# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys @KWSYS_NAMESPACE@
-# endif
-# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING
-# define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \
- @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
-# define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH
-# define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP \
- @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP
-#endif
-
-#endif
diff --git a/test/API/driver/kwsys/ConsoleBuf.hxx.in b/test/API/driver/kwsys/ConsoleBuf.hxx.in
deleted file mode 100644
index 49dbdf7..0000000
--- a/test/API/driver/kwsys/ConsoleBuf.hxx.in
+++ /dev/null
@@ -1,398 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_ConsoleBuf_hxx
-#define @KWSYS_NAMESPACE@_ConsoleBuf_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <@KWSYS_NAMESPACE@/Encoding.hxx>
-
-#include <cstring>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-
-#if defined(_WIN32)
-# include <windows.h>
-# if __cplusplus >= 201103L
-# include <system_error>
-# endif
-#endif
-
-namespace @KWSYS_NAMESPACE@ {
-#if defined(_WIN32)
-
-template <class CharT, class Traits = std::char_traits<CharT> >
-class BasicConsoleBuf : public std::basic_streambuf<CharT, Traits>
-{
-public:
- typedef typename Traits::int_type int_type;
- typedef typename Traits::char_type char_type;
-
- class Manager
- {
- public:
- Manager(std::basic_ios<CharT, Traits>& ios, const bool err = false)
- : m_consolebuf(0)
- {
- m_ios = &ios;
- try {
- m_consolebuf = new BasicConsoleBuf<CharT, Traits>(err);
- m_streambuf = m_ios->rdbuf(m_consolebuf);
- } catch (const std::runtime_error& ex) {
- std::cerr << "Failed to create ConsoleBuf!" << std::endl
- << ex.what() << std::endl;
- };
- }
-
- BasicConsoleBuf<CharT, Traits>* GetConsoleBuf() { return m_consolebuf; }
-
- void SetUTF8Pipes()
- {
- if (m_consolebuf) {
- m_consolebuf->input_pipe_codepage = CP_UTF8;
- m_consolebuf->output_pipe_codepage = CP_UTF8;
- m_consolebuf->activateCodepageChange();
- }
- }
-
- ~Manager()
- {
- if (m_consolebuf) {
- delete m_consolebuf;
- m_ios->rdbuf(m_streambuf);
- }
- }
-
- private:
- std::basic_ios<CharT, Traits>* m_ios;
- std::basic_streambuf<CharT, Traits>* m_streambuf;
- BasicConsoleBuf<CharT, Traits>* m_consolebuf;
- };
-
- BasicConsoleBuf(const bool err = false)
- : flush_on_newline(true)
- , input_pipe_codepage(0)
- , output_pipe_codepage(0)
- , input_file_codepage(CP_UTF8)
- , output_file_codepage(CP_UTF8)
- , m_consolesCodepage(0)
- {
- m_hInput = ::GetStdHandle(STD_INPUT_HANDLE);
- checkHandle(true, "STD_INPUT_HANDLE");
- if (!setActiveInputCodepage()) {
- throw std::runtime_error("setActiveInputCodepage failed!");
- }
- m_hOutput = err ? ::GetStdHandle(STD_ERROR_HANDLE)
- : ::GetStdHandle(STD_OUTPUT_HANDLE);
- checkHandle(false, err ? "STD_ERROR_HANDLE" : "STD_OUTPUT_HANDLE");
- if (!setActiveOutputCodepage()) {
- throw std::runtime_error("setActiveOutputCodepage failed!");
- }
- _setg();
- _setp();
- }
-
- ~BasicConsoleBuf() throw() { sync(); }
-
- bool activateCodepageChange()
- {
- return setActiveInputCodepage() && setActiveOutputCodepage();
- }
-
-protected:
- virtual int sync()
- {
- bool success = true;
- if (m_hInput && m_isConsoleInput &&
- ::FlushConsoleInputBuffer(m_hInput) == 0) {
- success = false;
- }
- if (m_hOutput && !m_obuffer.empty()) {
- const std::wstring wbuffer = getBuffer(m_obuffer);
- if (m_isConsoleOutput) {
- DWORD charsWritten;
- success =
- ::WriteConsoleW(m_hOutput, wbuffer.c_str(), (DWORD)wbuffer.size(),
- &charsWritten, nullptr) == 0
- ? false
- : true;
- } else {
- DWORD bytesWritten;
- std::string buffer;
- success = encodeOutputBuffer(wbuffer, buffer);
- if (success) {
- success =
- ::WriteFile(m_hOutput, buffer.c_str(), (DWORD)buffer.size(),
- &bytesWritten, nullptr) == 0
- ? false
- : true;
- }
- }
- }
- m_ibuffer.clear();
- m_obuffer.clear();
- _setg();
- _setp();
- return success ? 0 : -1;
- }
-
- virtual int_type underflow()
- {
- if (this->gptr() >= this->egptr()) {
- if (!m_hInput) {
- _setg(true);
- return Traits::eof();
- }
- if (m_isConsoleInput) {
- // ReadConsole doesn't tell if there's more input available
- // don't support reading more characters than this
- wchar_t wbuffer[8192];
- DWORD charsRead;
- if (ReadConsoleW(m_hInput, wbuffer,
- (sizeof(wbuffer) / sizeof(wbuffer[0])), &charsRead,
- nullptr) == 0 ||
- charsRead == 0) {
- _setg(true);
- return Traits::eof();
- }
- setBuffer(std::wstring(wbuffer, charsRead), m_ibuffer);
- } else {
- std::wstring wbuffer;
- std::string strbuffer;
- DWORD bytesRead;
- LARGE_INTEGER size;
- if (GetFileSizeEx(m_hInput, &size) == 0) {
- _setg(true);
- return Traits::eof();
- }
- char* buffer = new char[size.LowPart];
- while (ReadFile(m_hInput, buffer, size.LowPart, &bytesRead, nullptr) ==
- 0) {
- if (GetLastError() == ERROR_MORE_DATA) {
- strbuffer += std::string(buffer, bytesRead);
- continue;
- }
- _setg(true);
- delete[] buffer;
- return Traits::eof();
- }
- if (bytesRead > 0) {
- strbuffer += std::string(buffer, bytesRead);
- }
- delete[] buffer;
- if (!decodeInputBuffer(strbuffer, wbuffer)) {
- _setg(true);
- return Traits::eof();
- }
- setBuffer(wbuffer, m_ibuffer);
- }
- _setg();
- }
- return Traits::to_int_type(*this->gptr());
- }
-
- virtual int_type overflow(int_type ch = Traits::eof())
- {
- if (!Traits::eq_int_type(ch, Traits::eof())) {
- char_type chr = Traits::to_char_type(ch);
- m_obuffer += chr;
- if ((flush_on_newline && Traits::eq(chr, '\n')) ||
- Traits::eq_int_type(ch, 0x00)) {
- sync();
- }
- return ch;
- }
- sync();
- return Traits::eof();
- }
-
-public:
- bool flush_on_newline;
- UINT input_pipe_codepage;
- UINT output_pipe_codepage;
- UINT input_file_codepage;
- UINT output_file_codepage;
-
-private:
- HANDLE m_hInput;
- HANDLE m_hOutput;
- std::basic_string<char_type> m_ibuffer;
- std::basic_string<char_type> m_obuffer;
- bool m_isConsoleInput;
- bool m_isConsoleOutput;
- UINT m_activeInputCodepage;
- UINT m_activeOutputCodepage;
- UINT m_consolesCodepage;
- void checkHandle(bool input, std::string handleName)
- {
- if ((input && m_hInput == INVALID_HANDLE_VALUE) ||
- (!input && m_hOutput == INVALID_HANDLE_VALUE)) {
- std::string errmsg =
- "GetStdHandle(" + handleName + ") returned INVALID_HANDLE_VALUE";
-# if __cplusplus >= 201103L
- throw std::system_error(::GetLastError(), std::system_category(),
- errmsg);
-# else
- throw std::runtime_error(errmsg);
-# endif
- }
- }
- UINT getConsolesCodepage()
- {
- if (!m_consolesCodepage) {
- m_consolesCodepage = GetConsoleCP();
- if (!m_consolesCodepage) {
- m_consolesCodepage = GetACP();
- }
- }
- return m_consolesCodepage;
- }
- bool setActiveInputCodepage()
- {
- m_isConsoleInput = false;
- switch (GetFileType(m_hInput)) {
- case FILE_TYPE_DISK:
- m_activeInputCodepage = input_file_codepage;
- break;
- case FILE_TYPE_CHAR:
- // Check for actual console.
- DWORD consoleMode;
- m_isConsoleInput =
- GetConsoleMode(m_hInput, &consoleMode) == 0 ? false : true;
- if (m_isConsoleInput) {
- break;
- }
- @KWSYS_NAMESPACE@_FALLTHROUGH;
- case FILE_TYPE_PIPE:
- m_activeInputCodepage = input_pipe_codepage;
- break;
- default:
- return false;
- }
- if (!m_isConsoleInput && m_activeInputCodepage == 0) {
- m_activeInputCodepage = getConsolesCodepage();
- }
- return true;
- }
- bool setActiveOutputCodepage()
- {
- m_isConsoleOutput = false;
- switch (GetFileType(m_hOutput)) {
- case FILE_TYPE_DISK:
- m_activeOutputCodepage = output_file_codepage;
- break;
- case FILE_TYPE_CHAR:
- // Check for actual console.
- DWORD consoleMode;
- m_isConsoleOutput =
- GetConsoleMode(m_hOutput, &consoleMode) == 0 ? false : true;
- if (m_isConsoleOutput) {
- break;
- }
- @KWSYS_NAMESPACE@_FALLTHROUGH;
- case FILE_TYPE_PIPE:
- m_activeOutputCodepage = output_pipe_codepage;
- break;
- default:
- return false;
- }
- if (!m_isConsoleOutput && m_activeOutputCodepage == 0) {
- m_activeOutputCodepage = getConsolesCodepage();
- }
- return true;
- }
- void _setg(bool empty = false)
- {
- if (!empty) {
- this->setg((char_type*)m_ibuffer.data(), (char_type*)m_ibuffer.data(),
- (char_type*)m_ibuffer.data() + m_ibuffer.size());
- } else {
- this->setg((char_type*)m_ibuffer.data(),
- (char_type*)m_ibuffer.data() + m_ibuffer.size(),
- (char_type*)m_ibuffer.data() + m_ibuffer.size());
- }
- }
- void _setp()
- {
- this->setp((char_type*)m_obuffer.data(),
- (char_type*)m_obuffer.data() + m_obuffer.size());
- }
- bool encodeOutputBuffer(const std::wstring wbuffer, std::string& buffer)
- {
- if (wbuffer.size() == 0) {
- buffer = std::string();
- return true;
- }
- const int length =
- WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
- (int)wbuffer.size(), nullptr, 0, nullptr, nullptr);
- char* buf = new char[length];
- const bool success =
- WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
- (int)wbuffer.size(), buf, length, nullptr,
- nullptr) > 0
- ? true
- : false;
- buffer = std::string(buf, length);
- delete[] buf;
- return success;
- }
- bool decodeInputBuffer(const std::string buffer, std::wstring& wbuffer)
- {
- size_t length = buffer.length();
- if (length == 0) {
- wbuffer = std::wstring();
- return true;
- }
- int actualCodepage = m_activeInputCodepage;
- const char BOM_UTF8[] = { char(0xEF), char(0xBB), char(0xBF) };
- const char* data = buffer.data();
- const size_t BOMsize = sizeof(BOM_UTF8);
- if (length >= BOMsize && std::memcmp(data, BOM_UTF8, BOMsize) == 0) {
- // PowerShell uses UTF-8 with BOM for pipes
- actualCodepage = CP_UTF8;
- data += BOMsize;
- length -= BOMsize;
- }
- const size_t wlength = static_cast<size_t>(MultiByteToWideChar(
- actualCodepage, 0, data, static_cast<int>(length), nullptr, 0));
- wchar_t* wbuf = new wchar_t[wlength];
- const bool success =
- MultiByteToWideChar(actualCodepage, 0, data, static_cast<int>(length),
- wbuf, static_cast<int>(wlength)) > 0
- ? true
- : false;
- wbuffer = std::wstring(wbuf, wlength);
- delete[] wbuf;
- return success;
- }
- std::wstring getBuffer(const std::basic_string<char> buffer)
- {
- return Encoding::ToWide(buffer);
- }
- std::wstring getBuffer(const std::basic_string<wchar_t> buffer)
- {
- return buffer;
- }
- void setBuffer(const std::wstring wbuffer, std::basic_string<char>& target)
- {
- target = Encoding::ToNarrow(wbuffer);
- }
- void setBuffer(const std::wstring wbuffer,
- std::basic_string<wchar_t>& target)
- {
- target = wbuffer;
- }
-
-}; // BasicConsoleBuf class
-
-typedef BasicConsoleBuf<char> ConsoleBuf;
-typedef BasicConsoleBuf<wchar_t> WConsoleBuf;
-
-#endif
-} // KWSYS_NAMESPACE
-
-#endif
diff --git a/test/API/driver/kwsys/Copyright.txt b/test/API/driver/kwsys/Copyright.txt
deleted file mode 100644
index 33d7fb4..0000000
--- a/test/API/driver/kwsys/Copyright.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-KWSys - Kitware System Library
-Copyright 2000-2016 Kitware, Inc. and Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* 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.
-
-* Neither the name of Kitware, Inc. nor the names of 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.
-
-------------------------------------------------------------------------------
-
-The following individuals and institutions are among the Contributors:
-
-* Insight Software Consortium <insightsoftwareconsortium.org>
-
-See version control history for details of individual contributions.
diff --git a/test/API/driver/kwsys/Directory.cxx b/test/API/driver/kwsys/Directory.cxx
deleted file mode 100644
index e379182..0000000
--- a/test/API/driver/kwsys/Directory.cxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Directory.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-
-#include KWSYS_HEADER(Encoding.hxx)
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "Configure.hxx.in"
-# include "Directory.hxx.in"
-# include "Encoding.hxx.in"
-#endif
-
-#include <string>
-#include <vector>
-
-namespace KWSYS_NAMESPACE {
-
-class DirectoryInternals
-{
-public:
- // Array of Files
- std::vector<std::string> Files;
-
- // Path to Open'ed directory
- std::string Path;
-};
-
-Directory::Directory()
-{
- this->Internal = new DirectoryInternals;
-}
-
-Directory::~Directory()
-{
- delete this->Internal;
-}
-
-unsigned long Directory::GetNumberOfFiles() const
-{
- return static_cast<unsigned long>(this->Internal->Files.size());
-}
-
-const char* Directory::GetFile(unsigned long dindex) const
-{
- if (dindex >= this->Internal->Files.size()) {
- return nullptr;
- }
- return this->Internal->Files[dindex].c_str();
-}
-
-const char* Directory::GetPath() const
-{
- return this->Internal->Path.c_str();
-}
-
-void Directory::Clear()
-{
- this->Internal->Path.resize(0);
- this->Internal->Files.clear();
-}
-
-} // namespace KWSYS_NAMESPACE
-
-// First Windows platforms
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# include <windows.h>
-
-# include <ctype.h>
-# include <fcntl.h>
-# include <io.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
-# include <sys/stat.h>
-# include <sys/types.h>
-
-// Wide function names can vary depending on compiler:
-# ifdef __BORLANDC__
-# define _wfindfirst_func __wfindfirst
-# define _wfindnext_func __wfindnext
-# else
-# define _wfindfirst_func _wfindfirst
-# define _wfindnext_func _wfindnext
-# endif
-
-namespace KWSYS_NAMESPACE {
-
-bool Directory::Load(const std::string& name)
-{
- this->Clear();
-# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
- // Older Visual C++ and Embarcadero compilers.
- long srchHandle;
-# else // Newer Visual C++
- intptr_t srchHandle;
-# endif
- char* buf;
- size_t n = name.size();
- if (name.back() == '/' || name.back() == '\\') {
- buf = new char[n + 1 + 1];
- sprintf(buf, "%s*", name.c_str());
- } else {
- // Make sure the slashes in the wildcard suffix are consistent with the
- // rest of the path
- buf = new char[n + 2 + 1];
- if (name.find('\\') != std::string::npos) {
- sprintf(buf, "%s\\*", name.c_str());
- } else {
- sprintf(buf, "%s/*", name.c_str());
- }
- }
- struct _wfinddata_t data; // data of current file
-
- // Now put them into the file array
- srchHandle = _wfindfirst_func(
- (wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
- delete[] buf;
-
- if (srchHandle == -1) {
- return 0;
- }
-
- // Loop through names
- do {
- this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
- } while (_wfindnext_func(srchHandle, &data) != -1);
- this->Internal->Path = name;
- return _findclose(srchHandle) != -1;
-}
-
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
-{
-# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
- // Older Visual C++ and Embarcadero compilers.
- long srchHandle;
-# else // Newer Visual C++
- intptr_t srchHandle;
-# endif
- char* buf;
- size_t n = name.size();
- if (name.back() == '/') {
- buf = new char[n + 1 + 1];
- sprintf(buf, "%s*", name.c_str());
- } else {
- buf = new char[n + 2 + 1];
- sprintf(buf, "%s/*", name.c_str());
- }
- struct _wfinddata_t data; // data of current file
-
- // Now put them into the file array
- srchHandle =
- _wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
- delete[] buf;
-
- if (srchHandle == -1) {
- return 0;
- }
-
- // Loop through names
- unsigned long count = 0;
- do {
- count++;
- } while (_wfindnext_func(srchHandle, &data) != -1);
- _findclose(srchHandle);
- return count;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#else
-
-// Now the POSIX style directory access
-
-# include <sys/types.h>
-
-# include <dirent.h>
-
-// PGI with glibc has trouble with dirent and large file support:
-// http://www.pgroup.com/userforum/viewtopic.php?
-// p=1992&sid=f16167f51964f1a68fe5041b8eb213b6
-// Work around the problem by mapping dirent the same way as readdir.
-# if defined(__PGI) && defined(__GLIBC__)
-# define kwsys_dirent_readdir dirent
-# define kwsys_dirent_readdir64 dirent64
-# define kwsys_dirent kwsys_dirent_lookup(readdir)
-# define kwsys_dirent_lookup(x) kwsys_dirent_lookup_delay(x)
-# define kwsys_dirent_lookup_delay(x) kwsys_dirent_##x
-# else
-# define kwsys_dirent dirent
-# endif
-
-namespace KWSYS_NAMESPACE {
-
-bool Directory::Load(const std::string& name)
-{
- this->Clear();
-
- DIR* dir = opendir(name.c_str());
-
- if (!dir) {
- return 0;
- }
-
- for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir)) {
- this->Internal->Files.push_back(d->d_name);
- }
- this->Internal->Path = name;
- closedir(dir);
- return 1;
-}
-
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
-{
- DIR* dir = opendir(name.c_str());
-
- if (!dir) {
- return 0;
- }
-
- unsigned long count = 0;
- for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir)) {
- count++;
- }
- closedir(dir);
- return count;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif
diff --git a/test/API/driver/kwsys/Directory.hxx.in b/test/API/driver/kwsys/Directory.hxx.in
deleted file mode 100644
index ad8c51b..0000000
--- a/test/API/driver/kwsys/Directory.hxx.in
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_Directory_hxx
-#define @KWSYS_NAMESPACE@_Directory_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-#include <string>
-
-namespace @KWSYS_NAMESPACE@ {
-
-class DirectoryInternals;
-
-/** \class Directory
- * \brief Portable directory/filename traversal.
- *
- * Directory provides a portable way of finding the names of the files
- * in a system directory.
- *
- * Directory currently works with Windows and Unix operating systems.
- */
-class @KWSYS_NAMESPACE@_EXPORT Directory
-{
-public:
- Directory();
- ~Directory();
-
- /**
- * Load the specified directory and load the names of the files
- * in that directory. 0 is returned if the directory can not be
- * opened, 1 if it is opened.
- */
- bool Load(const std::string&);
-
- /**
- * Return the number of files in the current directory.
- */
- unsigned long GetNumberOfFiles() const;
-
- /**
- * Return the number of files in the specified directory.
- * A higher performance static method.
- */
- static unsigned long GetNumberOfFilesInDirectory(const std::string&);
-
- /**
- * Return the file at the given index, the indexing is 0 based
- */
- const char* GetFile(unsigned long) const;
-
- /**
- * Return the path to Open'ed directory
- */
- const char* GetPath() const;
-
- /**
- * Clear the internal structure. Used internally at beginning of Load(...)
- * to clear the cache.
- */
- void Clear();
-
-private:
- // Private implementation details.
- DirectoryInternals* Internal;
-
- Directory(const Directory&); // Not implemented.
- void operator=(const Directory&); // Not implemented.
-}; // End Class: Directory
-
-} // namespace @KWSYS_NAMESPACE@
-
-#endif
diff --git a/test/API/driver/kwsys/DynamicLoader.cxx b/test/API/driver/kwsys/DynamicLoader.cxx
deleted file mode 100644
index a4b8641..0000000
--- a/test/API/driver/kwsys/DynamicLoader.cxx
+++ /dev/null
@@ -1,495 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#if defined(_WIN32)
-# define NOMINMAX // hide min,max to not conflict with <limits>
-#endif
-
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(DynamicLoader.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-#include KWSYS_HEADER(Encoding.hxx)
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "Configure.hxx.in"
-# include "DynamicLoader.hxx.in"
-#endif
-
-// This file actually contains several different implementations:
-// * NOOP for environments without dynamic libs
-// * HP machines which uses shl_load
-// * Mac OS X 10.2.x and earlier which uses NSLinkModule
-// * Windows which uses LoadLibrary
-// * BeOS / Haiku
-// * FreeMiNT for Atari
-// * Default implementation for *NIX systems (including Mac OS X 10.3 and
-// later) which use dlopen
-//
-// Each part of the ifdef contains a complete implementation for
-// the static methods of DynamicLoader.
-
-#define CHECK_OPEN_FLAGS(var, supported, ret) \
- do { \
- /* Check for unknown flags. */ \
- if ((var & AllOpenFlags) != var) { \
- return ret; \
- } \
- \
- /* Check for unsupported flags. */ \
- if ((var & (supported)) != var) { \
- return ret; \
- } \
- } while (0)
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname)
-{
- return DynamicLoader::OpenLibrary(libname, 0);
-}
-}
-
-#if !KWSYS_SUPPORTS_SHARED_LIBS
-// Implementation for environments without dynamic libs
-# include <string.h> // for strerror()
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- return 0;
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- if (!lib) {
- return 0;
- }
-
- return 1;
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- return 0;
-}
-
-const char* DynamicLoader::LastError()
-{
- return "General error";
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#elif defined(__hpux)
-// Implementation for HPUX machines
-# include <dl.h>
-# include <errno.h>
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- CHECK_OPEN_FLAGS(flags, 0, 0);
-
- return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- if (!lib) {
- return 0;
- }
- return !shl_unload(lib);
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- void* addr;
- int status;
-
- /* TYPE_PROCEDURE Look for a function or procedure. (This used to be default)
- * TYPE_DATA Look for a symbol in the data segment (for example,
- * variables).
- * TYPE_UNDEFINED Look for any symbol.
- */
- status = shl_findsym(&lib, sym.c_str(), TYPE_UNDEFINED, &addr);
- void* result = (status < 0) ? (void*)0 : addr;
-
- // Hack to cast pointer-to-data to pointer-to-function.
- return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
-}
-
-const char* DynamicLoader::LastError()
-{
- // TODO: Need implementation with errno/strerror
- /* If successful, shl_findsym returns an integer (int) value zero. If
- * shl_findsym cannot find sym, it returns -1 and sets errno to zero.
- * If any other errors occur, shl_findsym returns -1 and sets errno to one
- * of these values (defined in <errno.h>):
- * ENOEXEC
- * A format error was detected in the specified library.
- * ENOSYM
- * A symbol on which sym depends could not be found.
- * EINVAL
- * The specified handle is invalid.
- */
-
- if (errno == ENOEXEC || errno == ENOSYM || errno == EINVAL) {
- return strerror(errno);
- }
- // else
- return 0;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#elif defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1030)
-// Implementation for Mac OS X 10.2.x and earlier
-# include <mach-o/dyld.h>
-# include <string.h> // for strlen
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- CHECK_OPEN_FLAGS(flags, 0, 0);
-
- NSObjectFileImageReturnCode rc;
- NSObjectFileImage image = 0;
-
- rc = NSCreateObjectFileImageFromFile(libname.c_str(), &image);
- // rc == NSObjectFileImageInappropriateFile when trying to load a dylib file
- if (rc != NSObjectFileImageSuccess) {
- return 0;
- }
- NSModule handle = NSLinkModule(image, libname.c_str(),
- NSLINKMODULE_OPTION_BINDNOW |
- NSLINKMODULE_OPTION_RETURN_ON_ERROR);
- NSDestroyObjectFileImage(image);
- return handle;
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- // NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED
- // With this option the memory for the module is not deallocated
- // allowing pointers into the module to still be valid.
- // You should use this option instead if your code experience some problems
- // reported against Panther 10.3.9 (fixed in Tiger 10.4.2 and up)
- bool success = NSUnLinkModule(lib, NSUNLINKMODULE_OPTION_NONE);
- return success;
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- void* result = 0;
- // Need to prepend symbols with '_' on Apple-gcc compilers
- std::string rsym = '_' + sym;
-
- NSSymbol symbol = NSLookupSymbolInModule(lib, rsym.c_str());
- if (symbol) {
- result = NSAddressOfSymbol(symbol);
- }
-
- // Hack to cast pointer-to-data to pointer-to-function.
- return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
-}
-
-const char* DynamicLoader::LastError()
-{
- return 0;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#elif defined(_WIN32) && !defined(__CYGWIN__)
-// Implementation for Windows win32 code but not cygwin
-# include <windows.h>
-
-# include <stdio.h>
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, nullptr);
-
- DWORD llFlags = 0;
- if (flags & SearchBesideLibrary) {
- llFlags |= LOAD_WITH_ALTERED_SEARCH_PATH;
- }
-
- return LoadLibraryExW(Encoding::ToWindowsExtendedPath(libname).c_str(),
- nullptr, llFlags);
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- return (int)FreeLibrary(lib);
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- // TODO: The calling convention affects the name of the symbol. We
- // should have a tool to help get the symbol with the desired
- // calling convention. Currently we assume cdecl.
- //
- // Borland:
- // __cdecl = "_func" (default)
- // __fastcall = "@_func"
- // __stdcall = "func"
- //
- // Watcom:
- // __cdecl = "_func"
- // __fastcall = "@_func@X"
- // __stdcall = "_func@X"
- // __watcall = "func_" (default)
- //
- // MSVC:
- // __cdecl = "func" (default)
- // __fastcall = "@_func@X"
- // __stdcall = "_func@X"
- //
- // Note that the "@X" part of the name above is the total size (in
- // bytes) of the arguments on the stack.
- void* result;
-# if defined(__BORLANDC__) || defined(__WATCOMC__)
- // Need to prepend symbols with '_'
- std::string ssym = '_' + sym;
- const char* rsym = ssym.c_str();
-# else
- const char* rsym = sym.c_str();
-# endif
- result = (void*)GetProcAddress(lib, rsym);
-// Hack to cast pointer-to-data to pointer-to-function.
-# ifdef __WATCOMC__
- return *(DynamicLoader::SymbolPointer*)(&result);
-# else
- return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
-# endif
-}
-
-# define DYNLOAD_ERROR_BUFFER_SIZE 1024
-
-const char* DynamicLoader::LastError()
-{
- wchar_t lpMsgBuf[DYNLOAD_ERROR_BUFFER_SIZE + 1];
-
- DWORD error = GetLastError();
- DWORD length = FormatMessageW(
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- lpMsgBuf, DYNLOAD_ERROR_BUFFER_SIZE, nullptr);
-
- static char str[DYNLOAD_ERROR_BUFFER_SIZE + 1];
-
- if (length < 1) {
- /* FormatMessage failed. Use a default message. */
- _snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
- "DynamicLoader encountered error 0x%X. "
- "FormatMessage failed with error 0x%X",
- error, GetLastError());
- return str;
- }
-
- if (!WideCharToMultiByte(CP_UTF8, 0, lpMsgBuf, -1, str,
- DYNLOAD_ERROR_BUFFER_SIZE, nullptr, nullptr)) {
- /* WideCharToMultiByte failed. Use a default message. */
- _snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
- "DynamicLoader encountered error 0x%X. "
- "WideCharToMultiByte failed with error 0x%X",
- error, GetLastError());
- }
-
- return str;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#elif defined(__BEOS__)
-// Implementation for BeOS / Haiku
-# include <string.h> // for strerror()
-
-# include <be/kernel/image.h>
-# include <be/support/Errors.h>
-
-namespace KWSYS_NAMESPACE {
-
-static image_id last_dynamic_err = B_OK;
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- CHECK_OPEN_FLAGS(flags, 0, 0);
-
- // image_id's are integers, errors are negative. Add one just in case we
- // get a valid image_id of zero (is that even possible?).
- image_id rc = load_add_on(libname.c_str());
- if (rc < 0) {
- last_dynamic_err = rc;
- return 0;
- }
-
- return rc + 1;
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- if (!lib) {
- last_dynamic_err = B_BAD_VALUE;
- return 0;
- } else {
- // The function dlclose() returns 0 on success, and non-zero on error.
- status_t rc = unload_add_on(lib - 1);
- if (rc != B_OK) {
- last_dynamic_err = rc;
- return 0;
- }
- }
-
- return 1;
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- // Hack to cast pointer-to-data to pointer-to-function.
- union
- {
- void* pvoid;
- DynamicLoader::SymbolPointer psym;
- } result;
-
- result.psym = nullptr;
-
- if (!lib) {
- last_dynamic_err = B_BAD_VALUE;
- } else {
- // !!! FIXME: BeOS can do function-only lookups...does this ever
- // !!! FIXME: actually _want_ a data symbol lookup, or was this union
- // !!! FIXME: a leftover of dlsym()? (s/ANY/TEXT for functions only).
- status_t rc =
- get_image_symbol(lib - 1, sym.c_str(), B_SYMBOL_TYPE_ANY, &result.pvoid);
- if (rc != B_OK) {
- last_dynamic_err = rc;
- result.psym = nullptr;
- }
- }
- return result.psym;
-}
-
-const char* DynamicLoader::LastError()
-{
- const char* retval = strerror(last_dynamic_err);
- last_dynamic_err = B_OK;
- return retval;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#elif defined(__MINT__)
-// Implementation for FreeMiNT on Atari
-# define _GNU_SOURCE /* for program_invocation_name */
-# include <dld.h>
-# include <errno.h>
-# include <malloc.h>
-# include <string.h>
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- CHECK_OPEN_FLAGS(flags, 0, nullptr);
-
- char* name = (char*)calloc(1, libname.size() + 1);
- dld_init(program_invocation_name);
- strncpy(name, libname.c_str(), libname.size());
- dld_link(libname.c_str());
- return (void*)name;
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- dld_unlink_by_file((char*)lib, 0);
- free(lib);
- return 0;
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- // Hack to cast pointer-to-data to pointer-to-function.
- union
- {
- void* pvoid;
- DynamicLoader::SymbolPointer psym;
- } result;
- result.pvoid = dld_get_symbol(sym.c_str());
- return result.psym;
-}
-
-const char* DynamicLoader::LastError()
-{
- return dld_strerror(dld_errno);
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#else
-// Default implementation for *NIX systems (including Mac OS X 10.3 and
-// later) which use dlopen
-# include <dlfcn.h>
-
-namespace KWSYS_NAMESPACE {
-
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
- const std::string& libname, int flags)
-{
- CHECK_OPEN_FLAGS(flags, 0, nullptr);
-
- return dlopen(libname.c_str(), RTLD_LAZY);
-}
-
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
- if (lib) {
- // The function dlclose() returns 0 on success, and non-zero on error.
- return !dlclose(lib);
- }
- // else
- return 0;
-}
-
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const std::string& sym)
-{
- // Hack to cast pointer-to-data to pointer-to-function.
- union
- {
- void* pvoid;
- DynamicLoader::SymbolPointer psym;
- } result;
- result.pvoid = dlsym(lib, sym.c_str());
- return result.psym;
-}
-
-const char* DynamicLoader::LastError()
-{
- return dlerror();
-}
-
-} // namespace KWSYS_NAMESPACE
-#endif
diff --git a/test/API/driver/kwsys/DynamicLoader.hxx.in b/test/API/driver/kwsys/DynamicLoader.hxx.in
deleted file mode 100644
index 539c742..0000000
--- a/test/API/driver/kwsys/DynamicLoader.hxx.in
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_DynamicLoader_hxx
-#define @KWSYS_NAMESPACE@_DynamicLoader_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <string>
-
-#if defined(__hpux)
-# include <dl.h>
-#elif defined(_WIN32) && !defined(__CYGWIN__)
-# include <windows.h>
-#elif defined(__APPLE__)
-# include <AvailabilityMacros.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
-# include <mach-o/dyld.h>
-# endif
-#elif defined(__BEOS__)
-# include <be/kernel/image.h>
-#endif
-
-namespace @KWSYS_NAMESPACE@ {
-/** \class DynamicLoader
- * \brief Portable loading of dynamic libraries or dll's.
- *
- * DynamicLoader provides a portable interface to loading dynamic
- * libraries or dll's into a process.
- *
- * Directory currently works with Windows, Apple, HP-UX and Unix (POSIX)
- * operating systems
- *
- * \warning dlopen on *nix system works the following way:
- * If filename contains a slash ("/"), then it is interpreted as a (relative
- * or absolute) pathname. Otherwise, the dynamic linker searches for the
- * library as follows : see ld.so(8) for further details):
- * Whereas this distinction does not exist on Win32. Therefore ideally you
- * should be doing full path to guarantee to have a consistent way of dealing
- * with dynamic loading of shared library.
- *
- * \warning the Cygwin implementation do not use the Win32 HMODULE. Put extra
- * condition so that we can include the correct declaration (POSIX)
- */
-
-class @KWSYS_NAMESPACE@_EXPORT DynamicLoader
-{
-public:
-// Ugly stuff for library handles
-// They are different on several different OS's
-#if defined(__hpux)
- typedef shl_t LibraryHandle;
-#elif defined(_WIN32) && !defined(__CYGWIN__)
- typedef HMODULE LibraryHandle;
-#elif defined(__APPLE__)
-# if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
- typedef NSModule LibraryHandle;
-# else
- typedef void* LibraryHandle;
-# endif
-#elif defined(__BEOS__)
- typedef image_id LibraryHandle;
-#else // POSIX
- typedef void* LibraryHandle;
-#endif
-
- // Return type from DynamicLoader::GetSymbolAddress.
- typedef void (*SymbolPointer)();
-
- enum OpenFlags
- {
- // Search for dependent libraries beside the library being loaded.
- //
- // This is currently only supported on Windows.
- SearchBesideLibrary = 0x00000001,
-
- AllOpenFlags = SearchBesideLibrary
- };
-
- /** Load a dynamic library into the current process.
- * The returned LibraryHandle can be used to access the symbols in the
- * library. The optional second argument is a set of flags to use when
- * opening the library. If unrecognized or unsupported flags are specified,
- * the library is not opened. */
- static LibraryHandle OpenLibrary(const std::string&);
- static LibraryHandle OpenLibrary(const std::string&, int);
-
- /** Attempt to detach a dynamic library from the
- * process. A value of true is returned if it is successful. */
- static int CloseLibrary(LibraryHandle);
-
- /** Find the address of the symbol in the given library. */
- static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
-
- /** Return the default module prefix for the current platform. */
- static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
-
- /** Return the default module suffix for the current platform. */
- static const char* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; }
-
- /** Return the last error produced from a calls made on this class. */
- static const char* LastError();
-}; // End Class: DynamicLoader
-
-} // namespace @KWSYS_NAMESPACE@
-
-#endif
diff --git a/test/API/driver/kwsys/Encoding.h.in b/test/API/driver/kwsys/Encoding.h.in
deleted file mode 100644
index 86a2669..0000000
--- a/test/API/driver/kwsys/Encoding.h.in
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_Encoding_h
-#define @KWSYS_NAMESPACE@_Encoding_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-#include <wchar.h>
-
-/* Redefine all public interface symbol names to be in the proper
- namespace. These macros are used internally to kwsys only, and are
- not visible to user code. Use kwsysHeaderDump.pl to reproduce
- these macros after making changes to the interface. */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
-#endif
-#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsysEncoding kwsys_ns(Encoding)
-# define kwsysEncoding_mbstowcs kwsys_ns(Encoding_mbstowcs)
-# define kwsysEncoding_DupToWide kwsys_ns(Encoding_DupToWide)
-# define kwsysEncoding_wcstombs kwsys_ns(Encoding_wcstombs)
-# define kwsysEncoding_DupToNarrow kwsys_ns(Encoding_DupToNarrow)
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/* Convert a narrow string to a wide string.
- On Windows, UTF-8 is assumed, and on other platforms,
- the current locale is assumed.
- */
-kwsysEXPORT size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* src,
- size_t n);
-
-/* Convert a narrow string to a wide string.
- This can return NULL if the conversion fails. */
-kwsysEXPORT wchar_t* kwsysEncoding_DupToWide(const char* src);
-
-/* Convert a wide string to a narrow string.
- On Windows, UTF-8 is assumed, and on other platforms,
- the current locale is assumed. */
-kwsysEXPORT size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* src,
- size_t n);
-
-/* Convert a wide string to a narrow string.
- This can return NULL if the conversion fails. */
-kwsysEXPORT char* kwsysEncoding_DupToNarrow(const wchar_t* str);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
- Otherwise, undefine them to keep the namespace clean. */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsysEncoding
-# undef kwsysEncoding_mbstowcs
-# undef kwsysEncoding_DupToWide
-# undef kwsysEncoding_wcstombs
-# undef kwsysEncoding_DupToNarrow
-# endif
-#endif
-
-#endif
diff --git a/test/API/driver/kwsys/Encoding.hxx.in b/test/API/driver/kwsys/Encoding.hxx.in
deleted file mode 100644
index 75a2d4d..0000000
--- a/test/API/driver/kwsys/Encoding.hxx.in
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_Encoding_hxx
-#define @KWSYS_NAMESPACE@_Encoding_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <string>
-#include <vector>
-
-namespace @KWSYS_NAMESPACE@ {
-class @KWSYS_NAMESPACE@_EXPORT Encoding
-{
-public:
- // Container class for argc/argv.
- class @KWSYS_NAMESPACE@_EXPORT CommandLineArguments
- {
- public:
- // On Windows, get the program command line arguments
- // in this Encoding module's 8 bit encoding.
- // On other platforms the given argc/argv is used, and
- // to be consistent, should be the argc/argv from main().
- static CommandLineArguments Main(int argc, char const* const* argv);
-
- // Construct CommandLineArguments with the given
- // argc/argv. It is assumed that the string is already
- // in the encoding used by this module.
- CommandLineArguments(int argc, char const* const* argv);
-
- // Construct CommandLineArguments with the given
- // argc and wide argv. This is useful if wmain() is used.
- CommandLineArguments(int argc, wchar_t const* const* argv);
- ~CommandLineArguments();
- CommandLineArguments(const CommandLineArguments&);
- CommandLineArguments& operator=(const CommandLineArguments&);
-
- int argc() const;
- char const* const* argv() const;
-
- protected:
- std::vector<char*> argv_;
- };
-
- /**
- * Convert between char and wchar_t
- */
-
-#if @KWSYS_NAMESPACE@_STL_HAS_WSTRING
-
- // Convert a narrow string to a wide string.
- // On Windows, UTF-8 is assumed, and on other platforms,
- // the current locale is assumed.
- static std::wstring ToWide(const std::string& str);
- static std::wstring ToWide(const char* str);
-
- // Convert a wide string to a narrow string.
- // On Windows, UTF-8 is assumed, and on other platforms,
- // the current locale is assumed.
- static std::string ToNarrow(const std::wstring& str);
- static std::string ToNarrow(const wchar_t* str);
-
-# if defined(_WIN32)
- /**
- * Convert the path to an extended length path to avoid MAX_PATH length
- * limitations on Windows. If the input is a local path the result will be
- * prefixed with \\?\; if the input is instead a network path, the result
- * will be prefixed with \\?\UNC\. All output will also be converted to
- * absolute paths with Windows-style backslashes.
- **/
- static std::wstring ToWindowsExtendedPath(std::string const&);
- static std::wstring ToWindowsExtendedPath(const char* source);
- static std::wstring ToWindowsExtendedPath(std::wstring const& wsource);
-# endif
-
-#endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING
-
-}; // class Encoding
-} // namespace @KWSYS_NAMESPACE@
-
-#endif
diff --git a/test/API/driver/kwsys/EncodingC.c b/test/API/driver/kwsys/EncodingC.c
deleted file mode 100644
index e12236a..0000000
--- a/test/API/driver/kwsys/EncodingC.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Encoding.h)
-
-/* Work-around CMake dependency scanning limitation. This must
- duplicate the above list of headers. */
-#if 0
-# include "Encoding.h.in"
-#endif
-
-#include <stdlib.h>
-
-#ifdef _WIN32
-# include <windows.h>
-#endif
-
-size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* str, size_t n)
-{
- if (str == 0) {
- return (size_t)-1;
- }
-#ifdef _WIN32
- return MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str, -1, dest,
- (int)n) -
- 1;
-#else
- return mbstowcs(dest, str, n);
-#endif
-}
-
-wchar_t* kwsysEncoding_DupToWide(const char* str)
-{
- wchar_t* ret = NULL;
- size_t length = kwsysEncoding_mbstowcs(NULL, str, 0) + 1;
- if (length > 0) {
- ret = (wchar_t*)malloc((length) * sizeof(wchar_t));
- if (ret) {
- ret[0] = 0;
- kwsysEncoding_mbstowcs(ret, str, length);
- }
- }
- return ret;
-}
-
-size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
-{
- if (str == 0) {
- return (size_t)-1;
- }
-#ifdef _WIN32
- return WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str, -1, dest,
- (int)n, NULL, NULL) -
- 1;
-#else
- return wcstombs(dest, str, n);
-#endif
-}
-
-char* kwsysEncoding_DupToNarrow(const wchar_t* str)
-{
- char* ret = NULL;
- size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1;
- if (length > 0) {
- ret = (char*)malloc(length);
- if (ret) {
- ret[0] = 0;
- kwsysEncoding_wcstombs(ret, str, length);
- }
- }
- return ret;
-}
diff --git a/test/API/driver/kwsys/EncodingCXX.cxx b/test/API/driver/kwsys/EncodingCXX.cxx
deleted file mode 100644
index 5cad934..0000000
--- a/test/API/driver/kwsys/EncodingCXX.cxx
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifdef __osf__
-# define _OSF_SOURCE
-# define _POSIX_C_SOURCE 199506L
-# define _XOPEN_SOURCE_EXTENDED
-#endif
-
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Encoding.hxx)
-#include KWSYS_HEADER(Encoding.h)
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "Encoding.h.in"
-# include "Encoding.hxx.in"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <vector>
-
-#ifdef _MSC_VER
-# pragma warning(disable : 4786)
-#endif
-
-// Windows API.
-#if defined(_WIN32)
-# include <windows.h>
-
-# include <ctype.h>
-# include <shellapi.h>
-#endif
-
-namespace KWSYS_NAMESPACE {
-
-Encoding::CommandLineArguments Encoding::CommandLineArguments::Main(
- int argc, char const* const* argv)
-{
-#ifdef _WIN32
- (void)argc;
- (void)argv;
-
- int ac;
- LPWSTR* w_av = CommandLineToArgvW(GetCommandLineW(), &ac);
-
- std::vector<std::string> av1(ac);
- std::vector<char const*> av2(ac);
- for (int i = 0; i < ac; i++) {
- av1[i] = ToNarrow(w_av[i]);
- av2[i] = av1[i].c_str();
- }
- LocalFree(w_av);
- return CommandLineArguments(ac, &av2[0]);
-#else
- return CommandLineArguments(argc, argv);
-#endif
-}
-
-Encoding::CommandLineArguments::CommandLineArguments(int ac,
- char const* const* av)
-{
- this->argv_.resize(ac + 1);
- for (int i = 0; i < ac; i++) {
- this->argv_[i] = strdup(av[i]);
- }
- this->argv_[ac] = nullptr;
-}
-
-Encoding::CommandLineArguments::CommandLineArguments(int ac,
- wchar_t const* const* av)
-{
- this->argv_.resize(ac + 1);
- for (int i = 0; i < ac; i++) {
- this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]);
- }
- this->argv_[ac] = nullptr;
-}
-
-Encoding::CommandLineArguments::~CommandLineArguments()
-{
- for (size_t i = 0; i < this->argv_.size(); i++) {
- free(argv_[i]);
- }
-}
-
-Encoding::CommandLineArguments::CommandLineArguments(
- const CommandLineArguments& other)
-{
- this->argv_.resize(other.argv_.size());
- for (size_t i = 0; i < this->argv_.size(); i++) {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr;
- }
-}
-
-Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(
- const CommandLineArguments& other)
-{
- if (this != &other) {
- size_t i;
- for (i = 0; i < this->argv_.size(); i++) {
- free(this->argv_[i]);
- }
-
- this->argv_.resize(other.argv_.size());
- for (i = 0; i < this->argv_.size(); i++) {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr;
- }
- }
-
- return *this;
-}
-
-int Encoding::CommandLineArguments::argc() const
-{
- return static_cast<int>(this->argv_.size() - 1);
-}
-
-char const* const* Encoding::CommandLineArguments::argv() const
-{
- return &this->argv_[0];
-}
-
-#if KWSYS_STL_HAS_WSTRING
-
-std::wstring Encoding::ToWide(const std::string& str)
-{
- std::wstring wstr;
-# if defined(_WIN32)
- const int wlength =
- MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
- int(str.size()), nullptr, 0);
- if (wlength > 0) {
- wchar_t* wdata = new wchar_t[wlength];
- int r = MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
- int(str.size()), wdata, wlength);
- if (r > 0) {
- wstr = std::wstring(wdata, wlength);
- }
- delete[] wdata;
- }
-# else
- size_t pos = 0;
- size_t nullPos = 0;
- do {
- if (pos < str.size() && str.at(pos) != '\0') {
- wstr += ToWide(str.c_str() + pos);
- }
- nullPos = str.find('\0', pos);
- if (nullPos != std::string::npos) {
- pos = nullPos + 1;
- wstr += wchar_t('\0');
- }
- } while (nullPos != std::string::npos);
-# endif
- return wstr;
-}
-
-std::string Encoding::ToNarrow(const std::wstring& str)
-{
- std::string nstr;
-# if defined(_WIN32)
- int length =
- WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(),
- int(str.size()), nullptr, 0, nullptr, nullptr);
- if (length > 0) {
- char* data = new char[length];
- int r =
- WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(),
- int(str.size()), data, length, nullptr, nullptr);
- if (r > 0) {
- nstr = std::string(data, length);
- }
- delete[] data;
- }
-# else
- size_t pos = 0;
- size_t nullPos = 0;
- do {
- if (pos < str.size() && str.at(pos) != '\0') {
- nstr += ToNarrow(str.c_str() + pos);
- }
- nullPos = str.find(wchar_t('\0'), pos);
- if (nullPos != std::string::npos) {
- pos = nullPos + 1;
- nstr += '\0';
- }
- } while (nullPos != std::string::npos);
-# endif
- return nstr;
-}
-
-std::wstring Encoding::ToWide(const char* cstr)
-{
- std::wstring wstr;
- size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0) + 1;
- if (length > 0) {
- std::vector<wchar_t> wchars(length);
- if (kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) {
- wstr = &wchars[0];
- }
- }
- return wstr;
-}
-
-std::string Encoding::ToNarrow(const wchar_t* wcstr)
-{
- std::string str;
- size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0) + 1;
- if (length > 0) {
- std::vector<char> chars(length);
- if (kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0) {
- str = &chars[0];
- }
- }
- return str;
-}
-
-# if defined(_WIN32)
-// Convert local paths to UNC style paths
-std::wstring Encoding::ToWindowsExtendedPath(std::string const& source)
-{
- return ToWindowsExtendedPath(ToWide(source));
-}
-
-// Convert local paths to UNC style paths
-std::wstring Encoding::ToWindowsExtendedPath(const char* source)
-{
- return ToWindowsExtendedPath(ToWide(source));
-}
-
-// Convert local paths to UNC style paths
-std::wstring Encoding::ToWindowsExtendedPath(std::wstring const& wsource)
-{
- // Resolve any relative paths
- DWORD wfull_len;
-
- /* The +3 is a workaround for a bug in some versions of GetFullPathNameW that
- * won't return a large enough buffer size if the input is too small */
- wfull_len = GetFullPathNameW(wsource.c_str(), 0, nullptr, nullptr) + 3;
- std::vector<wchar_t> wfull(wfull_len);
- GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], nullptr);
-
- /* This should get the correct size without any extra padding from the
- * previous size workaround. */
- wfull_len = static_cast<DWORD>(wcslen(&wfull[0]));
-
- if (wfull_len >= 2 && isalpha(wfull[0]) &&
- wfull[1] == L':') { /* C:\Foo\bar\FooBar.txt */
- return L"\\\\?\\" + std::wstring(&wfull[0]);
- } else if (wfull_len >= 2 && wfull[0] == L'\\' &&
- wfull[1] == L'\\') { /* Starts with \\ */
- if (wfull_len >= 4 && wfull[2] == L'?' &&
- wfull[3] == L'\\') { /* Starts with \\?\ */
- if (wfull_len >= 8 && wfull[4] == L'U' && wfull[5] == L'N' &&
- wfull[6] == L'C' &&
- wfull[7] == L'\\') { /* \\?\UNC\Foo\bar\FooBar.txt */
- return std::wstring(&wfull[0]);
- } else if (wfull_len >= 6 && isalpha(wfull[4]) &&
- wfull[5] == L':') { /* \\?\C:\Foo\bar\FooBar.txt */
- return std::wstring(&wfull[0]);
- } else if (wfull_len >= 5) { /* \\?\Foo\bar\FooBar.txt */
- return L"\\\\?\\UNC\\" + std::wstring(&wfull[4]);
- }
- } else if (wfull_len >= 4 && wfull[2] == L'.' &&
- wfull[3] == L'\\') { /* Starts with \\.\ a device name */
- if (wfull_len >= 6 && isalpha(wfull[4]) &&
- wfull[5] == L':') { /* \\.\C:\Foo\bar\FooBar.txt */
- return L"\\\\?\\" + std::wstring(&wfull[4]);
- } else if (wfull_len >=
- 5) { /* \\.\Foo\bar\ Device name is left unchanged */
- return std::wstring(&wfull[0]);
- }
- } else if (wfull_len >= 3) { /* \\Foo\bar\FooBar.txt */
- return L"\\\\?\\UNC\\" + std::wstring(&wfull[2]);
- }
- }
-
- // If this case has been reached, then the path is invalid. Leave it
- // unchanged
- return wsource;
-}
-# endif
-
-#endif // KWSYS_STL_HAS_WSTRING
-
-} // namespace KWSYS_NAMESPACE
diff --git a/test/API/driver/kwsys/ExtraTest.cmake.in b/test/API/driver/kwsys/ExtraTest.cmake.in
deleted file mode 100644
index e8c0a1c..0000000
--- a/test/API/driver/kwsys/ExtraTest.cmake.in
+++ /dev/null
@@ -1 +0,0 @@
-MESSAGE("*** This message is generated by message inside a file that is included in DartTestfile.txt ***")
diff --git a/test/API/driver/kwsys/FStream.cxx b/test/API/driver/kwsys/FStream.cxx
deleted file mode 100644
index 5e4133a..0000000
--- a/test/API/driver/kwsys/FStream.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(FStream.hxx)
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "FStream.hxx.in"
-#endif
-
-namespace KWSYS_NAMESPACE {
-namespace FStream {
-
-BOM ReadBOM(std::istream& in)
-{
- if (!in.good()) {
- return BOM_None;
- }
- unsigned long orig = in.tellg();
- unsigned char bom[4];
- in.read(reinterpret_cast<char*>(bom), 2);
- if (!in.good()) {
- in.clear();
- in.seekg(orig);
- return BOM_None;
- }
- if (bom[0] == 0xEF && bom[1] == 0xBB) {
- in.read(reinterpret_cast<char*>(bom + 2), 1);
- if (in.good() && bom[2] == 0xBF) {
- return BOM_UTF8;
- }
- } else if (bom[0] == 0xFE && bom[1] == 0xFF) {
- return BOM_UTF16BE;
- } else if (bom[0] == 0x00 && bom[1] == 0x00) {
- in.read(reinterpret_cast<char*>(bom + 2), 2);
- if (in.good() && bom[2] == 0xFE && bom[3] == 0xFF) {
- return BOM_UTF32BE;
- }
- } else if (bom[0] == 0xFF && bom[1] == 0xFE) {
- unsigned long p = in.tellg();
- in.read(reinterpret_cast<char*>(bom + 2), 2);
- if (in.good() && bom[2] == 0x00 && bom[3] == 0x00) {
- return BOM_UTF32LE;
- }
- in.seekg(p);
- return BOM_UTF16LE;
- }
- in.clear();
- in.seekg(orig);
- return BOM_None;
-}
-
-} // FStream namespace
-} // KWSYS_NAMESPACE
diff --git a/test/API/driver/kwsys/FStream.hxx.in b/test/API/driver/kwsys/FStream.hxx.in
deleted file mode 100644
index d79bbdf..0000000
--- a/test/API/driver/kwsys/FStream.hxx.in
+++ /dev/null
@@ -1,278 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#ifndef @KWSYS_NAMESPACE@_FStream_hxx
-#define @KWSYS_NAMESPACE@_FStream_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <@KWSYS_NAMESPACE@/Encoding.hxx>
-
-#include <fstream>
-#if defined(_WIN32)
-# if !defined(_MSC_VER) && @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
-# include <ext/stdio_filebuf.h>
-# endif
-#endif
-
-namespace @KWSYS_NAMESPACE@ {
-#if defined(_WIN32) && \
- (defined(_MSC_VER) || @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H)
-# if defined(_NOEXCEPT)
-# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT _NOEXCEPT
-# else
-# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT
-# endif
-
-# if defined(_MSC_VER)
-
-template <typename CharType, typename Traits>
-class basic_filebuf : public std::basic_filebuf<CharType, Traits>
-{
-# if _MSC_VER >= 1400
-public:
- typedef std::basic_filebuf<CharType, Traits> my_base_type;
- basic_filebuf* open(char const* s, std::ios_base::openmode mode)
- {
- const std::wstring wstr = Encoding::ToWindowsExtendedPath(s);
- return static_cast<basic_filebuf*>(my_base_type::open(wstr.c_str(), mode));
- }
-# endif
-};
-
-# else
-
-inline std::wstring getcmode(const std::ios_base::openmode mode)
-{
- std::wstring cmode;
- bool plus = false;
- if (mode & std::ios_base::app) {
- cmode += L"a";
- plus = mode & std::ios_base::in ? true : false;
- } else if (mode & std::ios_base::trunc ||
- (mode & std::ios_base::out && (mode & std::ios_base::in) == 0)) {
- cmode += L"w";
- plus = mode & std::ios_base::in ? true : false;
- } else {
- cmode += L"r";
- plus = mode & std::ios_base::out ? true : false;
- }
- if (plus) {
- cmode += L"+";
- }
- if (mode & std::ios_base::binary) {
- cmode += L"b";
- } else {
- cmode += L"t";
- }
- return cmode;
-};
-
-# endif
-
-template <typename CharType, typename Traits = std::char_traits<CharType> >
-class basic_efilebuf
-{
-public:
-# if defined(_MSC_VER)
- typedef basic_filebuf<CharType, Traits> internal_buffer_type;
-# else
- typedef __gnu_cxx::stdio_filebuf<CharType, Traits> internal_buffer_type;
-# endif
-
- basic_efilebuf()
- : file_(0)
- {
- buf_ = 0;
- }
-
- bool _open(char const* file_name, std::ios_base::openmode mode)
- {
- if (is_open() || file_) {
- return false;
- }
-# if defined(_MSC_VER)
- const bool success = buf_->open(file_name, mode) != 0;
-# else
- const std::wstring wstr = Encoding::ToWindowsExtendedPath(file_name);
- bool success = false;
- std::wstring cmode = getcmode(mode);
- file_ = _wfopen(wstr.c_str(), cmode.c_str());
- if (file_) {
- if (buf_) {
- delete buf_;
- }
- buf_ = new internal_buffer_type(file_, mode);
- success = true;
- }
-# endif
- return success;
- }
-
- bool is_open()
- {
- if (!buf_) {
- return false;
- }
- return buf_->is_open();
- }
-
- bool is_open() const
- {
- if (!buf_) {
- return false;
- }
- return buf_->is_open();
- }
-
- bool _close()
- {
- bool success = false;
- if (buf_) {
- success = buf_->close() != 0;
-# if !defined(_MSC_VER)
- if (file_) {
- success = fclose(file_) == 0 ? success : false;
- file_ = 0;
- }
-# endif
- }
- return success;
- }
-
- static void _set_state(bool success, std::basic_ios<CharType, Traits>* ios,
- basic_efilebuf* efilebuf)
- {
-# if !defined(_MSC_VER)
- ios->rdbuf(efilebuf->buf_);
-# else
- static_cast<void>(efilebuf);
-# endif
- if (!success) {
- ios->setstate(std::ios_base::failbit);
- } else {
- ios->clear();
- }
- }
-
- ~basic_efilebuf()
- {
- if (buf_) {
- delete buf_;
- }
- }
-
-protected:
- internal_buffer_type* buf_;
- FILE* file_;
-};
-
-template <typename CharType, typename Traits = std::char_traits<CharType> >
-class basic_ifstream
- : public std::basic_istream<CharType, Traits>
- , public basic_efilebuf<CharType, Traits>
-{
-public:
- typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type
- internal_buffer_type;
- typedef std::basic_istream<CharType, Traits> internal_stream_type;
-
- basic_ifstream()
- : internal_stream_type(new internal_buffer_type())
- {
- this->buf_ =
- static_cast<internal_buffer_type*>(internal_stream_type::rdbuf());
- }
- explicit basic_ifstream(char const* file_name,
- std::ios_base::openmode mode = std::ios_base::in)
- : internal_stream_type(new internal_buffer_type())
- {
- this->buf_ =
- static_cast<internal_buffer_type*>(internal_stream_type::rdbuf());
- open(file_name, mode);
- }
-
- void open(char const* file_name,
- std::ios_base::openmode mode = std::ios_base::in)
- {
- mode = mode | std::ios_base::in;
- this->_set_state(this->_open(file_name, mode), this, this);
- }
-
- void close() { this->_set_state(this->_close(), this, this); }
-
- using basic_efilebuf<CharType, Traits>::is_open;
-
- internal_buffer_type* rdbuf() const { return this->buf_; }
-
- ~basic_ifstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT { close(); }
-};
-
-template <typename CharType, typename Traits = std::char_traits<CharType> >
-class basic_ofstream
- : public std::basic_ostream<CharType, Traits>
- , public basic_efilebuf<CharType, Traits>
-{
- using basic_efilebuf<CharType, Traits>::is_open;
-
-public:
- typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type
- internal_buffer_type;
- typedef std::basic_ostream<CharType, Traits> internal_stream_type;
-
- basic_ofstream()
- : internal_stream_type(new internal_buffer_type())
- {
- this->buf_ =
- static_cast<internal_buffer_type*>(internal_stream_type::rdbuf());
- }
- explicit basic_ofstream(char const* file_name,
- std::ios_base::openmode mode = std::ios_base::out)
- : internal_stream_type(new internal_buffer_type())
- {
- this->buf_ =
- static_cast<internal_buffer_type*>(internal_stream_type::rdbuf());
- open(file_name, mode);
- }
- void open(char const* file_name,
- std::ios_base::openmode mode = std::ios_base::out)
- {
- mode = mode | std::ios_base::out;
- this->_set_state(this->_open(file_name, mode), this, this);
- }
-
- void close() { this->_set_state(this->_close(), this, this); }
-
- internal_buffer_type* rdbuf() const { return this->buf_; }
-
- ~basic_ofstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT { close(); }
-};
-
-typedef basic_ifstream<char> ifstream;
-typedef basic_ofstream<char> ofstream;
-
-# undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT
-#else
-using std::ofstream;
-using std::ifstream;
-#endif
-
-namespace FStream {
-enum BOM
-{
- BOM_None,
- BOM_UTF8,
- BOM_UTF16BE,
- BOM_UTF16LE,
- BOM_UTF32BE,
- BOM_UTF32LE
-};
-
-// Read a BOM, if one exists.
-// If a BOM exists, the stream is advanced to after the BOM.
-// This function requires a seekable stream (but not a relative
-// seekable stream).
-@KWSYS_NAMESPACE@_EXPORT BOM ReadBOM(std::istream& in);
-}
-}
-
-#endif
diff --git a/test/API/driver/kwsys/GitSetup/.gitattributes b/test/API/driver/kwsys/GitSetup/.gitattributes
deleted file mode 100644
index e96d1f8..0000000
--- a/test/API/driver/kwsys/GitSetup/.gitattributes
+++ /dev/null
@@ -1,6 +0,0 @@
-.git* export-ignore
-
-config* eol=lf whitespace=indent-with-non-tab
-git-* eol=lf whitespace=indent-with-non-tab
-tips eol=lf whitespace=indent-with-non-tab
-setup-* eol=lf whitespace=indent-with-non-tab
diff --git a/test/API/driver/kwsys/GitSetup/LICENSE b/test/API/driver/kwsys/GitSetup/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/test/API/driver/kwsys/GitSetup/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/test/API/driver/kwsys/GitSetup/NOTICE b/test/API/driver/kwsys/GitSetup/NOTICE
deleted file mode 100644
index 0d32c02..0000000
--- a/test/API/driver/kwsys/GitSetup/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Kitware Local Git Setup Scripts
-Copyright 2010-2012 Kitware, Inc.
-
-This product includes software developed at Kitware, Inc.
-(http://www.kitware.com/).
diff --git a/test/API/driver/kwsys/GitSetup/README b/test/API/driver/kwsys/GitSetup/README
deleted file mode 100644
index 2f9f1ec..0000000
--- a/test/API/driver/kwsys/GitSetup/README
+++ /dev/null
@@ -1,87 +0,0 @@
-Kitware Local Git Setup Scripts
-
-
-Introduction
-------------
-
-This is a collection of local Git development setup scripts meant for
-inclusion in project source trees to aid their development workflow.
-Project-specific information needed by the scripts may be configured
-in a "config" file added next to them in the project.
-
-
-Import
-------
-
-A project may import these scripts into their source tree by
-initializing a subtree merge. Bring up a Git prompt and set the
-current working directory inside a clone of the target project.
-Fetch the "setup" branch from the GitSetup repository:
-
- $ git fetch ../GitSetup setup:setup
-
-Prepare to merge the branch but place the content in a subdirectory.
-Any prefix (with trailing '/') may be chosen so long as it is used
-consistently within a project through the rest of these instructions:
-
- $ git merge -s ours --no-commit setup
- $ git read-tree -u --prefix=Utilities/GitSetup/ setup
-
-Commit the merge with an informative message:
-
- $ git commit
- ------------------------------------------------------------------------
- Merge branch 'setup'
-
- Add Utilities/GitSetup/ directory using subtree merge from
- the general GitSetup repository "setup" branch.
- ------------------------------------------------------------------------
-
-Optionally add to the project ".gitattributes" file the line
-
- /Utilities/GitSetup export-ignore
-
-to exclude the GitSetup directory from inclusion by "git archive"
-since it does not make sense in source tarballs.
-
-
-Configuration
--------------
-
-Read the "Project configuration instructions" comment in each script.
-Add a "config" file next to the scripts with desired configuration
-(optionally copy and modify "config.sample"). For example, to
-configure the "setup-hooks" script:
-
- $ git config -f Utilities/GitSetup/config hooks.url "$url"
-
-where "$url" is the project repository publishing the "hooks" branch.
-When finished, add and commit the configuration file:
-
- $ git add Utilities/GitSetup/config
- $ git commit
-
-
-Update
-------
-
-A project may update these scripts from the GitSetup repository.
-Bring up a Git prompt and set the current working directory inside a
-clone of the target project. Fetch the "setup" branch from the
-GitSetup repository:
-
- $ git fetch ../GitSetup setup:setup
-
-Merge the "setup" branch into the subtree:
-
- $ git merge -X subtree=Utilities/GitSetup setup
-
-where "Utilities/GitSetup" is the same prefix used during the import
-setup, but without a trailing '/'.
-
-
-License
--------
-
-Distributed under the Apache License 2.0.
-See LICENSE and NOTICE for details.
diff --git a/test/API/driver/kwsys/GitSetup/config b/test/API/driver/kwsys/GitSetup/config
deleted file mode 100644
index cba4c14..0000000
--- a/test/API/driver/kwsys/GitSetup/config
+++ /dev/null
@@ -1,4 +0,0 @@
-[hooks]
- url = https://gitlab.kitware.com/utils/gitsetup.git
-[upstream]
- url = https://gitlab.kitware.com/utils/kwsys.git
diff --git a/test/API/driver/kwsys/GitSetup/config.sample b/test/API/driver/kwsys/GitSetup/config.sample
deleted file mode 100644
index eeb468b..0000000
--- a/test/API/driver/kwsys/GitSetup/config.sample
+++ /dev/null
@@ -1,32 +0,0 @@
-# Kitware Local Git Setup Scripts - Sample Project Configuration
-#
-# Copy to "config" and edit as necessary.
-
-[hooks]
- url = http://public.kitware.com/GitSetup.git
- #branch = hooks
-
-[ssh]
- host = public.kitware.com
- key = id_git_public
- request-url = https://www.kitware.com/Admin/SendPassword.cgi
-
-[stage]
- #url = git://public.kitware.com/stage/Project.git
- #pushurl = git@public.kitware.com:stage/Project.git
-
-[gerrit]
- #project = Project
- site = http://review.source.kitware.com
- # pushurl placeholder "$username" is literal
- pushurl = $username@review.source.kitware.com:Project
-
-[upstream]
- url = git://public.kitware.com/Project.git
-
-[gitlab]
- host = gitlab.kitware.com
- group-path = group
- group-name = Group
- project-path = project
- project-name = Project
diff --git a/test/API/driver/kwsys/GitSetup/git-gerrit-push b/test/API/driver/kwsys/GitSetup/git-gerrit-push
deleted file mode 100644
index b46f753..0000000
--- a/test/API/driver/kwsys/GitSetup/git-gerrit-push
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env bash
-#=============================================================================
-# Copyright 2010-2015 Kitware, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#=============================================================================
-
-USAGE="[<remote>] [--no-topic] [--dry-run] [--]"
-OPTIONS_SPEC=
-SUBDIRECTORY_OK=Yes
-. "$(git --exec-path)/git-sh-setup"
-
-#-----------------------------------------------------------------------------
-
-remote=''
-refspecs=''
-no_topic=''
-dry_run=''
-
-# Parse the command line options.
-while test $# != 0; do
- case "$1" in
- --no-topic) no_topic=1 ;;
- --dry-run) dry_run=--dry-run ;;
- --) shift; break ;;
- -*) usage ;;
- *) test -z "$remote" || usage ; remote="$1" ;;
- esac
- shift
-done
-test $# = 0 || usage
-
-# Default remote.
-test -n "$remote" || remote="gerrit"
-
-if test -z "$no_topic"; then
- # Identify and validate the topic branch name.
- head="$(git symbolic-ref HEAD)" && topic="${head#refs/heads/}" || topic=''
- if test -z "$topic" -o "$topic" = "master"; then
- die 'Please name your topic:
- git checkout -b descriptive-name'
- fi
- # The topic branch will be pushed by name.
- refspecs="HEAD:refs/for/master/$topic $refspecs"
-fi
-
-# Fetch the current upstream master branch head.
-# This helps computation of a minimal pack to push.
-echo "Fetching $remote master"
-fetch_out=$(git fetch "$remote" master 2>&1) || die "$fetch_out"
-
-# Exit early if we have nothing to push.
-if test -z "$refspecs"; then
- echo 'Nothing to push!'
- exit 0
-fi
-
-# Push. Save output and exit code.
-echo "Pushing to $remote"
-push_stdout=$(git push --porcelain $dry_run "$remote" $refspecs); push_exit=$?
-echo "$push_stdout"
-
-# Reproduce the push exit code.
-exit $push_exit
diff --git a/test/API/driver/kwsys/GitSetup/git-gitlab-push b/test/API/driver/kwsys/GitSetup/git-gitlab-push
deleted file mode 100644
index 768f853..0000000
--- a/test/API/driver/kwsys/GitSetup/git-gitlab-push
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/env bash
-#=============================================================================
-# Copyright 2010-2015 Kitware, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#=============================================================================
-
-USAGE='[<remote>] [<options>...] [--]
-
-OPTIONS
-
---dry-run
- Show what would be pushed without actually updating the destination
-
--f,--force
- Force-push the topic HEAD to rewrite the destination branch
-
---no-default
- Do not push the default branch (e.g. master)
-
---no-topic
- Do not push the topic HEAD.
-'
-OPTIONS_SPEC=
-SUBDIRECTORY_OK=Yes
-. "$(git --exec-path)/git-sh-setup"
-
-egrep-q() {
- egrep "$@" >/dev/null 2>/dev/null
-}
-
-# Load the project configuration.
-gitlab_upstream='' &&
-gitlab_configured='' &&
-config="${BASH_SOURCE%/*}/config" &&
-protocol=$(git config -f "$config" --get gitlab.protocol ||
- echo "https") &&
-host=$(git config -f "$config" --get gitlab.host) &&
-site=$(git config -f "$config" --get gitlab.site ||
- echo "$protocol://$host") &&
-group_path=$(git config -f "$config" --get gitlab.group-path) &&
-project_path=$(git config -f "$config" --get gitlab.project-path) &&
-gitlab_upstream="$site/$group_path/$project_path.git" &&
-gitlab_pushurl=$(git config --get remote.gitlab.pushurl ||
- git config --get remote.gitlab.url) &&
-gitlab_configured=1
-
-#-----------------------------------------------------------------------------
-
-remote=''
-refspecs=''
-force=''
-lease=false
-lease_flag=''
-no_topic=''
-no_default=''
-dry_run=''
-
-# Parse the command line options.
-while test $# != 0; do
- case "$1" in
- -f|--force) force='+'; lease=true ;;
- --no-topic) no_topic=1 ;;
- --dry-run) dry_run=--dry-run ;;
- --no-default) no_default=1 ;;
- --) shift; break ;;
- -*) usage ;;
- *) test -z "$remote" || usage ; remote="$1" ;;
- esac
- shift
-done
-test $# = 0 || usage
-
-# Default remote.
-test -n "$remote" || remote="gitlab"
-
-if test -z "$no_topic"; then
- # Identify and validate the topic branch name.
- head="$(git symbolic-ref HEAD)" && topic="${head#refs/heads/}" || topic=''
- if test -z "$topic" -o "$topic" = "master"; then
- die 'Please name your topic:
- git checkout -b descriptive-name'
- fi
-
- if $lease; then
- have_ref=false
- remoteref="refs/remotes/$remote/$topic"
- if git rev-parse --verify -q "$remoteref"; then
- have_ref=true
- else
- die "It seems that a local ref for the branch is
-missing; forcing a push is dangerous and may overwrite
-previous work. Fetch from the $remote remote first or
-push without '-f' or '--force'."
- fi
-
- have_lease_flag=false
- if git push -h | egrep-q -e '--force-with-lease'; then
- have_lease_flag=true
- fi
-
- if $have_lease_flag && $have_ref; then
- # Set the lease flag.
- lease_flag="--force-with-lease=$topic:$remoteref"
- # Clear the force string.
- force=''
- fi
- fi
-
- # The topic branch will be pushed by name.
- refspecs="${force}HEAD:refs/heads/$topic $refspecs"
-fi
-
-# Fetch the current remote master branch head.
-# This helps computation of a minimal pack to push.
-echo "Fetching $remote master"
-fetch_out=$(git fetch "$remote" master 2>&1) || die "$fetch_out"
-gitlab_head=$(git rev-parse FETCH_HEAD) || exit
-
-# Fetch the current upstream master branch head.
-if origin_fetchurl=$(git config --get remote.origin.url) &&
- test "$origin_fetchurl" = "$gitlab_upstream"; then
- upstream_remote='origin'
-else
- upstream_remote="$gitlab_upstream"
-fi
-echo "Fetching $upstream_remote master"
-fetch_out=$(git fetch "$upstream_remote" master 2>&1) || die "$fetch_out"
-upstream_head=$(git rev-parse FETCH_HEAD) || exit
-
-# Add a refspec to keep the remote master up to date if possible.
-if test -z "$no_default" &&
- base=$(git merge-base "$gitlab_head" "$upstream_head") &&
- test "$base" = "$gitlab_head"; then
- refspecs="$upstream_head:refs/heads/master $refspecs"
-fi
-
-# Exit early if we have nothing to push.
-if test -z "$refspecs"; then
- echo 'Nothing to push!'
- exit 0
-fi
-
-# Push. Save output and exit code.
-echo "Pushing to $remote"
-push_config='-c advice.pushUpdateRejected=false'
-push_stdout=$(git $push_config push $lease_flag --porcelain $dry_run "$remote" $refspecs); push_exit=$?
-echo "$push_stdout"
-
-if test "$push_exit" -ne 0 && test -z "$force"; then
- # Advise the user to fetch if needed.
- if echo "$push_stdout" | egrep-q 'stale info'; then
- echo "
-You have pushed to your branch from another machine; you may be overwriting
-commits unintentionally. Fetch from the $remote remote and check that you are
-not pushing an outdated branch."
- fi
-
- # Advise the user to force-push if needed.
- if echo "$push_stdout" | egrep-q 'non-fast-forward'; then
- echo '
-Add "-f" or "--force" to push a rewritten topic.'
- fi
-fi
-
-# Reproduce the push exit code.
-exit $push_exit
diff --git a/test/API/driver/kwsys/GitSetup/pre-commit b/test/API/driver/kwsys/GitSetup/pre-commit
deleted file mode 100644
index 1f1d3f5..0000000
--- a/test/API/driver/kwsys/GitSetup/pre-commit
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-egrep-q() {
- egrep "$@" >/dev/null 2>/dev/null
-}
-
-die() {
- echo 'pre-commit hook failure' 1>&2
- echo '-----------------------' 1>&2
- echo '' 1>&2
- echo "$@" 1>&2
- exit 1
-}
-
-#-----------------------------------------------------------------------------
-
-# Check that developmer setup is up-to-date.
-lastSetupForDevelopment=$(git config --get hooks.SetupForDevelopment || echo 0)
-eval $(grep '^SetupForDevelopment_VERSION=' "${BASH_SOURCE%/*}/../SetupForDevelopment.sh")
-test -n "$SetupForDevelopment_VERSION" || SetupForDevelopment_VERSION=0
-if test $lastSetupForDevelopment -lt $SetupForDevelopment_VERSION; then
- die 'Developer setup in this work tree is out of date. Please re-run
-
- ./SetupForDevelopment.sh
-'
-fi
diff --git a/test/API/driver/kwsys/GitSetup/setup-aliases b/test/API/driver/kwsys/GitSetup/setup-aliases
deleted file mode 100644
index 98810ad..0000000
--- a/test/API/driver/kwsys/GitSetup/setup-aliases
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-echo "Adding 'git prepush' alias" &&
-git config alias.prepush 'log --graph --stat origin/master..' &&
-gerrit_disabled="KWSys no longer uses Gerrit. Please use GitLab." &&
-git config alias.gerrit-push '!sh -c "echo '"${gerrit_disabled}"'"' &&
-true
diff --git a/test/API/driver/kwsys/GitSetup/setup-gerrit b/test/API/driver/kwsys/GitSetup/setup-gerrit
deleted file mode 100644