CI updates

This commit is contained in:
Markus F.X.J. Oberhumer
2024-04-05 18:16:29 +02:00
parent 87956de092
commit f5ec8363b4
6 changed files with 112 additions and 69 deletions
+17 -15
View File
@@ -25,7 +25,7 @@ else()
cmake_minimum_required(VERSION "3.8" FATAL_ERROR) # CMake >= 3.8 is needed for CXX_STANDARD 17
endif()
# support functions
# support functions and some utility
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
#***********************************************************************
@@ -35,19 +35,19 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
upx_cmake_include_hook(1_options)
# compilation config options
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/use_strict_defaults.cmake")
if(NOT USE_STRICT_DEFAULTS)
# permissive config defaults when building from source code tarball
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." ON)
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." ON)
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with Git version info." ON)
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with sanitize options." ON)
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with -Werror option." ON)
option(UPX_CONFIG_DISABLE_WSTRICT "Do not compile with strict compiler warnings." ON)
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." ON)
else()
# strict config defaults for Git developer builds
message(STATUS "===== UPX info: strict config defaults enabled")
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." OFF)
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." OFF)
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with Git version info." OFF)
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with sanitize options." OFF)
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with -Werror option." OFF)
option(UPX_CONFIG_DISABLE_WSTRICT "Do not compile with strict compiler warnings." OFF)
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." OFF)
endif()
# test config options (see below)
@@ -135,9 +135,11 @@ upx_set_default_build_type(Release) # default is CMAKE_BUILD_TYPE=Release
project(upx VERSION "${UPX_VERSION_STRING}" LANGUAGES C CXX)
upx_apply_build_type()
# set MSVC_FRONTEND and MINGW
# set MSVC_FRONTEND, GNU_FRONTEND and MINGW
if(NOT DEFINED MSVC_FRONTEND AND (MSVC OR CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC"))
set(MSVC_FRONTEND 1)
elseif (NOT DEFINED GNU_FRONTEND AND (CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^GNU" OR CMAKE_C_COMPILER_ID MATCHES "(Clang|GNU)"))
set(GNU_FRONTEND 1)
endif()
if(NOT DEFINED MINGW AND CMAKE_C_PLATFORM_ID MATCHES "^MinGW")
set(MINGW 1)
@@ -331,7 +333,7 @@ upx_sanitize_target(${t})
target_compile_definitions(${t} PRIVATE BZ_NO_STDIO=1)
if(MSVC_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_WN} -wd4127 -wd4244 -wd4267 ${warn_WX})
else()
elseif(GNU_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
endif()
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
@@ -343,7 +345,7 @@ upx_compile_target_debug_with_O2(${t})
upx_sanitize_target(${t})
if(MSVC_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_WN} ${warn_WX})
else()
elseif(GNU_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
endif()
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
@@ -357,7 +359,7 @@ if(HAVE_UNISTD_H)
endif()
if(MSVC_FRONTEND)
target_compile_options(${t} PRIVATE -W3 ${warn_WX})
else()
elseif(GNU_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_Wall} -Wno-cast-align -Wno-cast-qual ${warn_Werror})
endif()
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
@@ -369,7 +371,7 @@ upx_sanitize_target(${t})
target_compile_definitions(${t} PRIVATE DYNAMIC_BMI2=0 ZSTD_DISABLE_ASM=1)
if(MSVC_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_WN} ${warn_WX})
else()
elseif(GNU_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
endif()
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
@@ -412,7 +414,7 @@ upx_compile_source_debug_with_O2(src/filter/filter_impl.cpp)
upx_sanitize_target(${t})
if(MSVC_FRONTEND)
target_compile_options(${t} PRIVATE -EHsc ${warn_WN} ${warn_WX})
else()
elseif(GNU_FRONTEND)
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
endif()
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
@@ -508,7 +510,7 @@ upx_print_var(CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_AR CMAKE_RANLIB)
upx_print_var(CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_C_COMPILER_ARCHITECTURE_ID CMAKE_C_PLATFORM_ID CMAKE_C_COMPILER_ABI)
upx_print_var(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_ARCHITECTURE_ID CMAKE_CXX_PLATFORM_ID CMAKE_CXX_COMPILER_ABI)
upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE CMAKE_TRY_COMPILE_CONFIGURATION)
upx_print_var(APPLE CLANG CYGWIN GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE UNIX WIN32 WIN64)
upx_print_var(APPLE CLANG CYGWIN GNU_FRONTEND GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE MSVC_TOOLSET_VERSION MSVC_VERSION MSYS UNIX WIN32 WIN64)
endif() # UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO
upx_print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE)
if(Threads_FOUND)