summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindHDF5.cmake70
-rw-r--r--Modules/GenerateExportHeader.cmake3
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmBase32.cxx108
-rw-r--r--Source/cmBase32.h42
-rw-r--r--Source/cmFilePathUuid.cxx18
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
8 files changed, 224 insertions, 24 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 5e0996c..2f4ed82 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -183,7 +183,7 @@ endmacro()
# Test first if the current compilers automatically wrap HDF5
-function(_HDF5_test_regular_compiler_C success version)
+function(_HDF5_test_regular_compiler_C success version is_parallel)
set(scratch_directory
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
if(NOT ${success} OR
@@ -214,10 +214,21 @@ function(_HDF5_test_regular_compiler_C success version)
set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3})
endif()
set(${version} ${${version}} PARENT_SCOPE)
+
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -showconfig
+ OUTPUT_VARIABLE config_output
+ ERROR_VARIABLE config_error
+ RESULT_VARIABLE config_result
+ )
+ if(config_output MATCHES "Parallel HDF5: yes")
+ set(${is_parallel} TRUE PARENT_SCOPE)
+ else()
+ set(${is_parallel} FALSE PARENT_SCOPE)
+ endif()
endif()
endfunction()
-function(_HDF5_test_regular_compiler_CXX success version)
+function(_HDF5_test_regular_compiler_CXX success version is_parallel)
set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
if(NOT ${success} OR
NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx)
@@ -248,10 +259,21 @@ function(_HDF5_test_regular_compiler_CXX success version)
set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3})
endif()
set(${version} ${${version}} PARENT_SCOPE)
+
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -showconfig
+ OUTPUT_VARIABLE config_output
+ ERROR_VARIABLE config_error
+ RESULT_VARIABLE config_result
+ )
+ if(config_output MATCHES "Parallel HDF5: yes")
+ set(${is_parallel} TRUE PARENT_SCOPE)
+ else()
+ set(${is_parallel} FALSE PARENT_SCOPE)
+ endif()
endif()
endfunction()
-function(_HDF5_test_regular_compiler_Fortran success)
+function(_HDF5_test_regular_compiler_Fortran success is_parallel)
if(NOT ${success})
set(scratch_directory
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
@@ -266,12 +288,24 @@ function(_HDF5_test_regular_compiler_Fortran success)
" call h5close_f(error)\n"
"end\n")
try_compile(${success} ${scratch_directory} ${test_file})
+ if(${success})
+ execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig
+ OUTPUT_VARIABLE config_output
+ ERROR_VARIABLE config_error
+ RESULT_VARIABLE config_result
+ )
+ if(config_output MATCHES "Parallel HDF5: yes")
+ set(${is_parallel} TRUE PARENT_SCOPE)
+ else()
+ set(${is_parallel} FALSE PARENT_SCOPE)
+ endif()
+ endif()
endif()
endfunction()
# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the
# return_value argument, the text output is stored to the output variable.
-macro( _HDF5_invoke_compiler language output return_value version)
+macro( _HDF5_invoke_compiler language output return_value version is_parallel)
set(${version})
if(HDF5_USE_STATIC_LIBRARIES)
set(lib_type_args -noshlib)
@@ -309,6 +343,11 @@ macro( _HDF5_invoke_compiler language output return_value version)
string(REPLACE "HDF5 Version: " "" ${version} "${version_match}")
string(REPLACE "-patch" "." ${version} "${${version}}")
endif()
+ if(config_output MATCHES "Parallel HDF5: yes")
+ set(${is_parallel} TRUE)
+ else()
+ set(${is_parallel} FALSE)
+ endif()
endmacro()
# Parse a compile line for definitions, includes, library paths, and libraries.
@@ -386,6 +425,7 @@ endif()
if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
find_package(HDF5 QUIET NO_MODULE)
if( HDF5_FOUND)
+ set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
set(HDF5_LIBRARIES)
set(HDF5_C_TARGET hdf5)
@@ -446,14 +486,17 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
if(__lang STREQUAL "C")
_HDF5_test_regular_compiler_C(
HDF5_${__lang}_COMPILER_NO_INTERROGATE
- HDF5_${__lang}_VERSION)
+ HDF5_${__lang}_VERSION
+ HDF5_${__lang}_IS_PARALLEL)
elseif(__lang STREQUAL "CXX")
_HDF5_test_regular_compiler_CXX(
HDF5_${__lang}_COMPILER_NO_INTERROGATE
- HDF5_${__lang}_VERSION)
+ HDF5_${__lang}_VERSION
+ HDF5_${__lang}_IS_PARALLEL)
elseif(__lang STREQUAL "Fortran")
_HDF5_test_regular_compiler_Fortran(
- HDF5_${__lang}_COMPILER_NO_INTERROGATE)
+ HDF5_${__lang}_COMPILER_NO_INTERROGATE
+ HDF5_${__lang}_IS_PARALLEL)
else()
continue()
endif()
@@ -490,7 +533,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
if(HDF5_${__lang}_COMPILER_EXECUTABLE)
_HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE
- HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION)
+ HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL)
if(HDF5_${__lang}_RETURN_VALUE EQUAL 0)
message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration")
_HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE
@@ -554,6 +597,15 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}")
endif()
endif()
+ if(DEFINED HDF5_${__lang}_IS_PARALLEL)
+ if(NOT DEFINED HDF5_IS_PARALLEL)
+ set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL})
+ elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL)
+ message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.")
+ elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL)
+ message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.")
+ endif()
+ endif()
endforeach()
else()
set(_HDF5_NEED_TO_SEARCH True)
@@ -613,7 +665,7 @@ if( NOT HDF5_FOUND )
set(HDF5_CXX_HL_LIBRARY_NAMES hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES})
set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES})
- set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5_hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES})
+ set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES})
foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
# find the HDF5 include directories
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 735a0d7..e33b927 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -415,6 +415,7 @@ function(add_compiler_export_flags)
if(ARGC GREATER 0)
set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
else()
- string(APPEND CMAKE_CXX_FLAGS " ${EXTRA_FLAGS}" PARENT_SCOPE)
+ string(APPEND CMAKE_CXX_FLAGS " ${EXTRA_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE)
endif()
endfunction()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8c74f60..6c3ebf5 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -166,6 +166,7 @@ endif()
#
set(SRCS
cmArchiveWrite.cxx
+ cmBase32.cxx
cmBootstrapCommands1.cxx
cmBootstrapCommands2.cxx
cmCacheManager.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 23c2ce3..811f4f7 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 6)
-set(CMake_VERSION_PATCH 20160901)
+set(CMake_VERSION_PATCH 20160903)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx
new file mode 100644
index 0000000..ce5c99b
--- /dev/null
+++ b/Source/cmBase32.cxx
@@ -0,0 +1,108 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2016 Sebastian Holtermann <sebholt@xwmw.org>
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmBase32.h"
+
+// -- Static functions
+
+static const unsigned char Base32EncodeTable[33] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+
+inline unsigned char Base32EncodeChar(int schar)
+{
+ return Base32EncodeTable[schar];
+}
+
+void Base32Encode5(const unsigned char src[5], char dst[8])
+{
+ // [0]:5 bits
+ dst[0] = Base32EncodeChar((src[0] >> 3) & 0x1F);
+ // [0]:3 bits + [1]:2 bits
+ dst[1] = Base32EncodeChar(((src[0] << 2) & 0x1C) + ((src[1] >> 6) & 0x03));
+ // [1]:5 bits
+ dst[2] = Base32EncodeChar((src[1] >> 1) & 0x1F);
+ // [1]:1 bit + [2]:4 bits
+ dst[3] = Base32EncodeChar(((src[1] << 4) & 0x10) + ((src[2] >> 4) & 0x0F));
+ // [2]:4 bits + [3]:1 bit
+ dst[4] = Base32EncodeChar(((src[2] << 1) & 0x1E) + ((src[3] >> 7) & 0x01));
+ // [3]:5 bits
+ dst[5] = Base32EncodeChar((src[3] >> 2) & 0x1F);
+ // [3]:2 bits + [4]:3 bit
+ dst[6] = Base32EncodeChar(((src[3] << 3) & 0x18) + ((src[4] >> 5) & 0x07));
+ // [4]:5 bits
+ dst[7] = Base32EncodeChar((src[4] << 0) & 0x1F);
+}
+
+// -- Class methods
+
+cmBase32Encoder::cmBase32Encoder()
+{
+}
+
+cmBase32Encoder::~cmBase32Encoder()
+{
+}
+
+std::string cmBase32Encoder::encodeString(const unsigned char* input,
+ size_t len, bool padding)
+{
+ std::string res;
+
+ static const size_t blockSize = 5;
+ static const size_t bufferSize = 8;
+ char buffer[bufferSize];
+
+ const unsigned char* end = input + len;
+ while ((input + blockSize) <= end) {
+ Base32Encode5(input, buffer);
+ res.append(buffer, bufferSize);
+ input += blockSize;
+ }
+
+ size_t remain(end - input);
+ if (remain != 0) {
+ // Temporary source buffer filled up with 0s
+ unsigned char extended[blockSize];
+ for (size_t ii = 0; ii != remain; ++ii) {
+ extended[ii] = input[ii];
+ }
+ for (size_t ii = remain; ii != blockSize; ++ii) {
+ extended[ii] = 0;
+ }
+
+ Base32Encode5(extended, buffer);
+ size_t numPad(0);
+ switch (remain) {
+ case 1:
+ numPad = 6;
+ break;
+ case 2:
+ numPad = 4;
+ break;
+ case 3:
+ numPad = 3;
+ break;
+ case 4:
+ numPad = 1;
+ break;
+ default:
+ break;
+ }
+ res.append(buffer, bufferSize - numPad);
+ if (padding) {
+ for (size_t ii = 0; ii != numPad; ++ii) {
+ res.push_back(paddingChar);
+ }
+ }
+ }
+
+ return res;
+}
diff --git a/Source/cmBase32.h b/Source/cmBase32.h
new file mode 100644
index 0000000..66ff8ba
--- /dev/null
+++ b/Source/cmBase32.h
@@ -0,0 +1,42 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2016 Sebastian Holtermann <sebholt@xwmw.org>
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmBase32_h
+#define cmBase32_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <stddef.h>
+#include <string>
+
+/** \class cmBase32Encoder
+ * \brief Encodes a byte sequence to a Base32 byte sequence according to
+ * RFC4648
+ *
+ */
+class cmBase32Encoder
+{
+public:
+ static const char paddingChar = '=';
+
+public:
+ cmBase32Encoder();
+ ~cmBase32Encoder();
+
+ // Encodes the given input byte sequence into a string
+ // @arg input Input data pointer
+ // @arg len Input data size
+ // @arg padding Flag to append "=" on demand
+ std::string encodeString(const unsigned char* input, size_t len,
+ bool padding = true);
+};
+
+#endif
diff --git a/Source/cmFilePathUuid.cxx b/Source/cmFilePathUuid.cxx
index 2839b63..f99646c 100644
--- a/Source/cmFilePathUuid.cxx
+++ b/Source/cmFilePathUuid.cxx
@@ -12,10 +12,10 @@
#include "cmFilePathUuid.h"
+#include "cmBase32.h"
#include "cmCryptoHash.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cmsys/Base64.h"
cmFilePathUuid::cmFilePathUuid(cmMakefile* makefile)
{
@@ -111,22 +111,16 @@ std::string cmFilePathUuid::GetChecksumString(
const std::string& sourceFilename, const std::string& sourceRelPath,
const std::string& sourceRelSeed)
{
- std::string checksumBase64;
+ std::string checksumBase32;
{
// Calculate the file ( seed + relative path + name ) checksum
std::vector<unsigned char> hashBytes =
cmCryptoHash::New("SHA256")->ByteHashString(
(sourceRelSeed + sourceRelPath + sourceFilename).c_str());
- // Convert hash bytes to Base64 text string
- std::vector<unsigned char> base64Bytes(hashBytes.size() * 2, 0);
- cmsysBase64_Encode(&hashBytes[0], hashBytes.size(), &base64Bytes[0], 0);
- checksumBase64 = reinterpret_cast<const char*>(&base64Bytes[0]);
+
+ checksumBase32 =
+ cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(), false);
}
- // Base64 allows '/', '+' and '=' characters which are problematic
- // when used in file names. Replace them with safer alternatives.
- std::replace(checksumBase64.begin(), checksumBase64.end(), '/', '-');
- std::replace(checksumBase64.begin(), checksumBase64.end(), '+', '_');
- std::replace(checksumBase64.begin(), checksumBase64.end(), '=', '_');
- return checksumBase64;
+ return checksumBase32;
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 907b65b..8ff7366 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2365,7 +2365,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
const char* toolset = gg->GetPlatformToolset();
if (toolset &&
- (toolset == kWINDOWS_7_1_SDK || cmHasLiteralPrefix(toolset, "v90") ||
+ (toolset == kWINDOWS_7_1_SDK || /* clang-format please break here */
+ cmHasLiteralPrefix(toolset, "v80") ||
+ cmHasLiteralPrefix(toolset, "v90") ||
cmHasLiteralPrefix(toolset, "v100") ||
cmHasLiteralPrefix(toolset, "v110") ||
cmHasLiteralPrefix(toolset, "v120"))) {