cmake update

This commit is contained in:
Markus F.X.J. Oberhumer 2024-07-17 12:06:41 +02:00
parent 3a11a5a82e
commit a7fa2f87c5
5 changed files with 23 additions and 7 deletions

View File

@ -27,6 +27,7 @@ endif()
# support functions and some utility
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR)
#***********************************************************************
# options
@ -154,9 +155,20 @@ include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
upx_cmake_include_hook(3_common_compilation_flags)
# assert sane type sizes
check_type_size("size_t" C_SIZEOF_SIZE_T LANGUAGE C)
check_type_size("size_t" CXX_SIZEOF_SIZE_T LANGUAGE CXX)
if(NOT "${C_SIZEOF_SIZE_T}" MATCHES "^(4|8|16)$")
message(FATAL_ERROR "ERROR: unexpected C_SIZEOF_SIZE_T '${C_SIZEOF_SIZE_T}'")
endif()
if(NOT ",${C_SIZEOF_SIZE_T}," STREQUAL ",${CXX_SIZEOF_SIZE_T},")
message(FATAL_ERROR "FATAL ERROR: '${C_SIZEOF_SIZE_T}' '${CXX_SIZEOF_SIZE_T}' mismatch")
endif()
if(NOT DEFINED HAVE_UNISTD_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
endif()

2
NEWS
View File

@ -4,7 +4,7 @@ User visible changes for UPX
Changes in 4.3.0 (XX XXX XXXX):
* bug fixes - see https://github.com/upx/upx/milestone/18
* ELF: PT_MIPS_ABIFLAGS is now fowarded into the compressed output;
* ELF: PT_MIPS_ABIFLAGS is now forwarded into the compressed output;
qemu-mips can choose the right floating-point emulation
* ELF: --unmap-all-pages completely avoids /proc/self/exe

View File

@ -10,6 +10,8 @@
# generator
upx_print_var(CMAKE_GENERATOR_TOOLSET CMAKE_GENERATOR_PLATFORM)
get_property(PROPERTY_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
upx_print_var(PROPERTY_GENERATOR_IS_MULTI_CONFIG)
# directories
if(NOT ",${CMAKE_BINARY_DIR}," STREQUAL ",${CMAKE_CURRENT_BINARY_DIR}," OR NOT ",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_CURRENT_SOURCE_DIR},")
@ -21,6 +23,7 @@ upx_print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM
upx_print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR)
upx_print_var(CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_VERSION CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
upx_print_var(CMAKE_APPLE_SILICON_PROCESSOR CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT)
upx_print_var(CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_PLATFORM_TOOLSET_VERSION)
upx_print_var(CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR)
# binutils
@ -41,6 +44,8 @@ endforeach()
# misc
upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE)
get_property(PROPERTY_TARGET_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
upx_print_var(PROPERTY_TARGET_SUPPORTS_SHARED_LIBS)
# shortcuts
upx_print_var(APPLE CLANG CYGWIN GNU_FRONTEND GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE MSVC_TOOLSET_VERSION MSVC_VERSION MSYS UNIX WIN32 WIN64)

View File

@ -94,7 +94,7 @@ build/extra/clang-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD=ON
# force building with clang/clang++ C++23 (and C23)
build/extra/clang-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug)
build/extra/clang-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release)
build/extra/clang-std-cxx23/%: export CC = clang -std=gnu2x
build/extra/clang-std-cxx23/%: export CC = clang -std=gnu2x -Wno-constant-logical-operand
build/extra/clang-std-cxx23/%: export CXX = clang++ -std=gnu++2b
build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD=ON
build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD=ON

View File

@ -25,7 +25,7 @@
*/
// doctest checks, and various tests to catch toolchain/qemu/sanitizer/valgrind/wine/etc
// problems; grown historically
// problems; grown historically; modern compilers will optimize away much of this code
#include "../util/system_headers.h"
#include <cmath> // std::isinf std::isnan
@ -320,7 +320,6 @@ static_assert((wchar_t) -1 > 0);
/*************************************************************************
// upx_compiler_sanity_check()
// assert a sane architecture and compiler
// (modern compilers will optimize away most of this code)
**************************************************************************/
namespace {
@ -983,7 +982,7 @@ void upx_compiler_sanity_check(void) noexcept {
CheckIntegral<upx_uintptr_t>::check();
#endif
#if (__SIZEOF_INT128__ == 16)
#if defined(_CPP_VER) // int128 is not supported by MSVC libstdc++ yet
#if defined(_CPP_VER) || defined(_WIN32) // int128 is not fully supported by MSVC libstdc++ yet
#else
CheckIntegral<upx_int128_t>::check();
CheckIntegral<upx_uint128_t>::check();
@ -1012,7 +1011,7 @@ void upx_compiler_sanity_check(void) noexcept {
CheckSignedness<upx_int64_t, true>::check();
CheckSignedness<upx_uint64_t, false>::check();
#if (__SIZEOF_INT128__ == 16)
#if defined(_CPP_VER) // int128 is not supported by MSVC libstdc++ yet
#if defined(_CPP_VER) || defined(_WIN32) // int128 is not fully supported by MSVC libstdc++ yet
#else
CheckSignedness<upx_int128_t, true>::check();
CheckSignedness<upx_uint128_t, false>::check();
@ -1040,7 +1039,7 @@ void upx_compiler_sanity_check(void) noexcept {
CHECK_TYPE_PAIR(upx_int32_t, upx_uint32_t);
CHECK_TYPE_PAIR(upx_int64_t, upx_uint64_t);
#if (__SIZEOF_INT128__ == 16)
#if defined(_CPP_VER) // int128 is not supported by MSVC libstdc++ yet
#if defined(_CPP_VER) || defined(_WIN32) // int128 is not fully supported by MSVC libstdc++ yet
#else
CHECK_TYPE_PAIR(upx_int128_t, upx_uint128_t);
#endif