1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

CI and cmake updates

This commit is contained in:
Markus F.X.J. Oberhumer
2023-06-25 01:55:06 +02:00
parent 512a26cee4
commit aaf3f75990
6 changed files with 84 additions and 23 deletions

View File

@ -11,8 +11,8 @@ on: [push, workflow_dispatch]
env:
DEBIAN_FRONTEND: noninteractive
UPX_CMAKE_BUILD_FLAGS: --verbose
# 2023-06-23
ZIG_DIST_VERSION: 0.11.0-dev.3777+64f0059cd
# 2023-06-24
ZIG_DIST_VERSION: 0.11.0-dev.3797+d82ab4fd8
jobs:
job-rebuild-and-verify-stubs:

View File

@ -1,4 +1,4 @@
# build with "cmake -G Xcode"
# build with 'cmake -G Xcode'
name: 'Weekly CI - macOS cmake Xcode'

View File

@ -0,0 +1,51 @@
# build with 'cmake -G "NMake Makefiles"'
name: 'Weekly CI - Windows cmake NMake'
on:
schedule: [cron: '30 4 * * 3'] # run weekly Wednesday 04:30 UTC
workflow_dispatch:
jobs:
job-windows-cmake-nmake:
name: ${{ format('{0} {1}', matrix.os, matrix.arch) }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: windows-2019, vsversion: 2019, arch: amd64 }
- { os: windows-2019, vsversion: 2019, arch: amd64_arm64 }
- { os: windows-2019, vsversion: 2019, arch: amd64_x86 }
- { os: windows-2022, vsversion: 2022, arch: amd64 }
- { os: windows-2022, vsversion: 2022, arch: amd64_arm64 }
- { os: windows-2022, vsversion: 2022, arch: amd64_x86 }
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with: { submodules: true }
- name: 'Set up Developer Command Prompt'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
vsversion: ${{ matrix.vsversion }}
- name: 'Build cmake NMake Debug'
shell: cmd
run: |
cmake -S . -B build/debug -G "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug
cd build/debug
nmake
dir *.exe
- name: 'Build cmake NMake Release'
shell: cmd
run: |
cmake -S . -B build/release -G "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON
cd build/release
nmake
dir *.exe
- name: 'Run basic tests'
if: ${{ matrix.arch != 'amd64_arm64' }}
shell: cmd
run: |
ctest --test-dir build/debug
ctest --test-dir build/release

View File

@ -3,12 +3,12 @@
name: 'Weekly CI - zigcc'
on:
schedule: [cron: '30 4 * * 3'] # run weekly Wednesday 04:30 UTC
schedule: [cron: '40 4 * * 3'] # run weekly Wednesday 04:40 UTC
workflow_dispatch:
env:
# 2023-06-23
ZIG_DIST_VERSION: 0.11.0-dev.3777+64f0059cd
# 2023-06-24
ZIG_DIST_VERSION: 0.11.0-dev.3797+d82ab4fd8
jobs:
job-linux-zigcc:

View File

@ -1,18 +1,19 @@
#
# UPX CMake file; see https://cmake.org/
# UPX "CMake" build file; see https://cmake.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#
# CMake version check; using a somewhat current CMake version is highly recommended
if(NOT DEFINED UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION)
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) # needed for CXX_STANDARD 17
else()
cmake_minimum_required(VERSION "${UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION}" FATAL_ERROR)
endif()
# Build requirements:
# A C++ compiler that fully implements C++17: clang-5, gcc-8 or msvc-2019 16.11
# A C++ compiler that fully implements C++17: clang-5, gcc-8 or msvc-2019-16.11
# (older or other compilers may work but are unsupported, use at your own risk)
# CMake version check; using a somewhat current CMake version is highly recommended
if(DEFINED UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION)
cmake_minimum_required(VERSION "${UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION}" FATAL_ERROR)
else()
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) # CMake >= 3.8 is needed for CXX_STANDARD 17
endif()
# compilation config options
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
# permissive config defaults when building from source code tarball
@ -51,7 +52,10 @@ endif()
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
if(${CMAKE_VERSION} VERSION_GREATER "3.14.7")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
cmake_policy(SET CMP0091 NEW)
endif()
# determine Git revision
set(GITREV_SHORT "")
@ -95,11 +99,16 @@ else()
message(STATUS "UPX_VERSION_GITREV: not set")
endif()
# CMake init
project(upx VERSION 4.0.2 LANGUAGES C CXX)
# set default build type to "Release"
# set the default build type to "Release"
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT is_multi_config AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
endif()
# CMake init
project(upx VERSION 4.1.0 LANGUAGES C CXX)
# set the default multi-config build type to "Release"
if(is_multi_config)
set(c "${CMAKE_CONFIGURATION_TYPES}")
list(INSERT c 0 "Release")
@ -109,8 +118,6 @@ if(is_multi_config)
endif()
list(REMOVE_DUPLICATES c)
set(CMAKE_CONFIGURATION_TYPES "${c}" CACHE STRING "List of supported configuration types." FORCE)
elseif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
endif()
set(MSVC_FRONTEND 0)
@ -122,6 +129,7 @@ endif()
# targets
#***********************************************************************
# internal settings
set(UPX_CONFIG_DISABLE_THREADS ON) # multithreading is currently not used; maybe in UPX version 5
set(UPX_CONFIG_DISABLE_BZIP2 ON) # bzip2 is currently not used; we might need it to decompress linux kernels
set(UPX_CONFIG_DISABLE_ZSTD ON) # zstd is currently not used; maybe in UPX version 5
@ -254,7 +262,9 @@ function(upx_sanitize_target)
# default sanitizer for Debug builds
target_compile_options(${t} PRIVATE $<$<CONFIG:Debug>:-fsanitize=undefined -fsanitize-undefined-trap-on-error -fstack-protector-all>)
# default sanitizer for Release builds
target_compile_options(${t} PRIVATE $<$<CONFIG:MinSizeRel>:-fstack-protector>)
target_compile_options(${t} PRIVATE $<$<CONFIG:Release>:-fstack-protector>)
target_compile_options(${t} PRIVATE $<$<CONFIG:RelWithDebInfo>:-fstack-protector>)
endif()
endforeach()
endfunction()
@ -417,7 +427,7 @@ function(print_var)
endif()
endforeach()
endfunction()
print_var(CMAKE_VERSION)
print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION)
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION)
print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_CROSSCOMPILING)

View File

@ -44,7 +44,7 @@ Short overview
Tools needed to build/modify the UPX sources
--------------------------------------------
- A C++ compiler that fully implements C++17: clang-5, gcc-8 or msvc-2019 16.11
- A C++ compiler that fully implements C++17: clang-5, gcc-8 or msvc-2019-16.11
(older or other compilers may work but are unsupported, use at your own risk)
- GNU make