Commit 036b6ef7 authored by Brad King's avatar Brad King

Port CMake from cmIML to KWIML

KWIML no longer uses a configured prefix.
parent 12293371
......@@ -538,9 +538,9 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
endif()
# Create the KWIML library for CMake.
set(KWIML cmIML)
set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
if(BUILD_TESTING)
set(KWIML_TEST_ENABLE 1)
endif()
add_subdirectory(Utilities/KWIML)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
......
......@@ -36,7 +36,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF"
"Warning.*: .*/Utilities/KWIML/test/test_INT_format.h.* # Redundant preprocessing concatenation"
"Warning.*: .*/Utilities/KWIML/test/test_int_format.h.* # Redundant preprocessing concatenation"
"Warning: library was too large for page size.*"
"Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*"
"Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*"
......
......@@ -162,13 +162,13 @@ struct cmRange
const_iterator end() const { return End; }
bool empty() const { return std::distance(Begin, End) == 0; }
difference_type size() const { return std::distance(Begin, End); }
cmRange& advance(cmIML_INT_intptr_t amount)
cmRange& advance(KWIML_INT_intptr_t amount)
{
std::advance(Begin, amount);
return *this;
}
cmRange& retreat(cmIML_INT_intptr_t amount)
cmRange& retreat(KWIML_INT_intptr_t amount)
{
std::advance(End, -amount);
return *this;
......
......@@ -15,9 +15,6 @@
#include <cmsys/auto_ptr.hxx>
#include <cmsys/FStream.hxx>
// Need the native byte order of the running CPU.
#include <cmIML/ABI.h>
// Include the ELF format information system header.
#if defined(__OpenBSD__)
# include <stdint.h>
......@@ -101,9 +98,9 @@ public:
// In most cases the processor-specific byte order will match that
// of the target execution environment. If we choose wrong here
// it is fixed when the header is read.
#if cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_LITTLE
#if KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_LITTLE
this->NeedSwap = (this->ByteOrder == ByteOrderMSB);
#elif cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_BIG
#elif KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_BIG
this->NeedSwap = (this->ByteOrder == ByteOrderLSB);
#else
this->NeedSwap = false; // Final decision is at runtime anyway.
......@@ -197,7 +194,7 @@ struct cmELFTypes32
typedef Elf32_Shdr ELF_Shdr;
typedef Elf32_Dyn ELF_Dyn;
typedef Elf32_Half ELF_Half;
typedef cmIML_INT_uint32_t tagtype;
typedef KWIML_INT_uint32_t tagtype;
static const char* GetName() { return "32-bit"; }
};
......@@ -208,7 +205,7 @@ struct cmELFTypes64
typedef Elf64_Shdr ELF_Shdr;
typedef Elf64_Dyn ELF_Dyn;
typedef Elf64_Half ELF_Half;
typedef cmIML_INT_uint64_t tagtype;
typedef KWIML_INT_uint64_t tagtype;
static const char* GetName() { return "64-bit"; }
};
......
......@@ -2811,8 +2811,8 @@ namespace {
case CURLINFO_SSL_DATA_OUT:
{
char buf[128];
int n = sprintf(buf, "[%" cmIML_INT_PRIu64 " bytes data]\n",
static_cast<cmIML_INT_uint64_t>(size));
int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n",
static_cast<KWIML_INT_uint64_t>(size));
if (n > 0)
{
vec->insert(vec->end(), buf, buf + n);
......
......@@ -130,7 +130,7 @@ private:
unsigned int VersionFoundPatch;
unsigned int VersionFoundTweak;
unsigned int VersionFoundCount;
cmIML_INT_uint64_t RequiredCMakeVersion;
KWIML_INT_uint64_t RequiredCMakeVersion;
bool Quiet;
bool Required;
bool UseConfigFiles;
......
......@@ -2980,7 +2980,7 @@ cmLocalGenerator::GetTargetDirectory(const cmGeneratorTarget*) const
}
//----------------------------------------------------------------------------
cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
{
// The computed version may change until the project is fully
// configured.
......@@ -3033,7 +3033,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
// Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set
// equal to or lower than the given version.
cmIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility();
KWIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility();
return (actual_compat &&
actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
}
......
......@@ -267,7 +267,7 @@ public:
*
* and is monotonically increasing with the CMake version.
*/
cmIML_INT_uint64_t GetBackwardsCompatibility();
KWIML_INT_uint64_t GetBackwardsCompatibility();
/**
* Test whether compatibility is set to a given version or lower.
......@@ -390,7 +390,7 @@ protected:
// committed.
std::string TargetImplib;
cmIML_INT_uint64_t BackwardsCompatibility;
KWIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal;
private:
void AddSharedFlags(std::string& flags, const std::string& lang,
......
......@@ -31,7 +31,7 @@
#endif
// Provide fixed-size integer types.
#include <cmIML/INT.h>
#include <cm_kwiml.h>
#include <fstream>
#include <iostream>
......
......@@ -34,7 +34,7 @@ public:
/* Encode with room for up to 1000 minor releases between major releases
and to encode dates until the year 10000 in the patch level. */
#define CMake_VERSION_ENCODE__BASE cmIML_INT_UINT64_C(100000000)
#define CMake_VERSION_ENCODE__BASE KWIML_INT_UINT64_C(100000000)
#define CMake_VERSION_ENCODE(major, minor, patch) \
((((major) * 1000u) * CMake_VERSION_ENCODE__BASE) + \
(((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \
......
......@@ -87,22 +87,21 @@
* made).
*/
#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
/* CMake modification: use byte order from cmIML. */
# include "cmIML/ABI.h"
/* CMake modification: use byte order from KWIML. */
# undef BYTE_ORDER
# undef BIG_ENDIAN
# undef LITTLE_ENDIAN
# define BYTE_ORDER cmIML_ABI_ENDIAN_ID
# define BIG_ENDIAN cmIML_ABI_ENDIAN_ID_BIG
# define LITTLE_ENDIAN cmIML_ABI_ENDIAN_ID_LITTLE
# define BYTE_ORDER KWIML_ABI_ENDIAN_ID
# define BIG_ENDIAN KWIML_ABI_ENDIAN_ID_BIG
# define LITTLE_ENDIAN KWIML_ABI_ENDIAN_ID_LITTLE
#endif
/* CMake modification: use types computed in header. */
typedef cm_sha2_uint8_t sha_byte; /* Exactly 1 byte */
typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */
typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */
#define SHA_UINT32_C(x) cmIML_INT_UINT32_C(x)
#define SHA_UINT64_C(x) cmIML_INT_UINT64_C(x)
#define SHA_UINT32_C(x) KWIML_INT_UINT32_C(x)
#define SHA_UINT64_C(x) KWIML_INT_UINT64_C(x)
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wcast-align"
#endif
......
......@@ -38,11 +38,11 @@
#include "cm_sha2_mangle.h"
/* CMake modification: use integer types from cmIML. */
#include "cmIML/INT.h"
typedef cmIML_INT_uint8_t cm_sha2_uint8_t;
typedef cmIML_INT_uint32_t cm_sha2_uint32_t;
typedef cmIML_INT_uint64_t cm_sha2_uint64_t;
/* CMake modification: use integer types from KWIML. */
#include <cm_kwiml.h>
typedef KWIML_INT_uint8_t cm_sha2_uint8_t;
typedef KWIML_INT_uint32_t cm_sha2_uint32_t;
typedef KWIML_INT_uint64_t cm_sha2_uint64_t;
#ifdef __cplusplus
extern "C" {
......
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
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 cm_kwiml_h
#define cm_kwiml_h
#include "KWIML/include/kwiml/abi.h"
#include "KWIML/include/kwiml/int.h"
#endif
......@@ -373,11 +373,6 @@ KWSYS_FILES="\
SystemTools.hxx \
Terminal.h"
KWIML_FILES='
ABI.h
INT.h
'
# Display CMake bootstrap usage
cmake_usage()
{
......@@ -702,11 +697,6 @@ if [ ! -d "cmsys" ]; then
cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
fi
[ -d "cmIML" ] || mkdir "cmIML"
if [ ! -d "cmIML" ]; then
cmake_error 12 "Cannot create directory ${cmake_bootstrap_dir}/cmIML"
fi
# Delete all the bootstrap files
rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
......@@ -1280,11 +1270,6 @@ for a in ${KWSYS_FILES}; do
"${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
done
for a in ${KWIML_FILES}; do
cmake_replace_string "${cmake_source_dir}/Utilities/KWIML/${a}.in" \
"${cmake_bootstrap_dir}/cmIML/${a}" KWIML cmIML
done
# Generate Makefile
dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
objs=""
......@@ -1326,9 +1311,9 @@ cmake_cxx_flags_SystemTools="
-DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
"
cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
-I`cmake_escape \"${cmake_bootstrap_dir}\"`"
-I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
-I`cmake_escape \"${cmake_bootstrap_dir}\"`"
-I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_CXX_SOURCES}; do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment