Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Sep 20, 2022
2 parents ee9c3a6 + 0440453 commit 0ba5409
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 77 deletions.
80 changes: 37 additions & 43 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ env:
CMAKE_VERSION: 3.21.1
NINJA_VERSION: 1.10.2
BUILD_TYPE: Release
CCACHE_VERSION: 4.4

jobs:
build:
Expand Down Expand Up @@ -121,28 +120,37 @@ jobs:
sudo apt-get install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
- name: Download ccache
id: ccache
- name: Install ccache
shell: cmake -P {0}
run: |
set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_VERSION}/${{ runner.os }}.tar.xz")
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz)
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
if("${{ runner.os }}" STREQUAL "Windows")
# If ccache behaves badly on windows, skip this step
execute_process(COMMAND choco install ccache)
elseif("${{ runner.os }}" STREQUAL "macOS")
execute_process(COMMAND brew install ccache)
elseif("${{ runner.os }}" STREQUAL "Linux")
set(ccache_version "4.6.3")
set(ccache_dist "ccache-${ccache_version}-linux-x86_64")
set(ccache_url "https://github.com/ccache/ccache/releases/download/v${ccache_version}/${ccache_dist}.tar.xz")
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxvf ./ccache.tar.xz)
# Add to PATH environment variable
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${ccache_dist}" ccache_dir)
set(path_separator ":")
file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${ccache_dir}")
else()
message(FATAL_ERROR, "${{ runner.os }} is not supported")
endif()
- name: ccache cache files
uses: actions/cache@v1.1.0
- name: Setup ccache
# If ccache behaves badly on windows, skip this step
# if: runner.os != 'Windows'
uses: Chocobo1/setup-ccache-action@v1
with:
path: .ccache
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.config.name }}-ccache-
install_ccache: false
update_packager_index: false
prepend_symlinks_to_path: false
windows_compile_environment: msvc # this field is required

- name: Configure
shell: cmake -P {0}
Expand All @@ -169,18 +177,26 @@ jobs:
endif()
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
# If ccache shows some strange behavior on windows, you can easily
# disable it here by setting the variable to "OFF"
if (NOT "${{ runner.os }}" STREQUAL "Windows")
set(enable_ccache "ON")
else()
set(enable_ccache "ON")
endif()
execute_process(
COMMAND cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-G Ninja
-D USE_CCACHE=${enable_ccache}
-D CMAKE_MAKE_PROGRAM=ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D ASAP_BUILD_TESTS=ON
-D ASAP_BUILD_EXAMPLES=ON
-D CMAKE_INSTALL_PREFIX=install
-D CMAKE_VERBOSE_MAKEFILE=ON
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
Expand All @@ -201,19 +217,6 @@ jobs:
endforeach()
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
set(ENV{CCACHE_COMPRESS} "true")
set(ENV{CCACHE_COMPRESSLEVEL} "6")
set(ENV{CCACHE_MAXSIZE} "400M")
if ("${{ matrix.config.cxx }}" STREQUAL "cl")
set(ENV{CCACHE_MAXSIZE} "600M")
endif()
execute_process(COMMAND ccache -p)
execute_process(COMMAND ccache -z)
execute_process(
COMMAND cmake --build build --target all --target build-all-tests
RESULT_VARIABLE result
Expand All @@ -228,15 +231,6 @@ jobs:
message(FATAL_ERROR "Build failed")
endif()
- name: ccache statistics
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
execute_process(COMMAND ccache -s)
- name: Run tests
shell: cmake -P {0}
run: |
Expand Down
35 changes: 33 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [4.6.0](http://github.com/abdes/asap/compare/v4.5.2...v4.6.0) (2022-09-20)

### Features

* option to control the use of ccache, default is OFF ([49a17a9](http://github.com/abdes/asap/commit/49a17a99026ae7e59d14297d01ed2f8d10c78762))

More robust implementation of fatser builds with `ccache`. Caching is enabled in
GitHub CI builds and can be enabled in development environments by simply
setting the cmake variable `USE_CCACHE` to 'ON'/'TRUE' or equivalent.

A precondition for the environment is of course to have `ccache` installed,
which gets done automatically in GitHub workflows, but needs to be done in
development environments. It is recommended to use brew/choco for MacOS/Windows,
but to install from the pre-built binaries for Linux as the version that comes
with most distros is quite old.

It is to be noted that `ccache` with MSVC on Windows may have some issues and if
that is the case, simply do not use it.

### [4.5.2](http://github.com/abdes/asap/compare/v4.5.1...v4.5.2) (2022-09-20)

### Bug Fixes

* sub-projects with tests fail due to coverage all target not being setup early enough ([400b2cc](http://github.com/abdes/asap/commit/400b2ccc120bd4f2c4d70f48fd3f94ce7a3f6de0))

## [4.5.1](http://github.com/abdes/asap/compare/v4.5.0...v4.5.1) (2022-09-19)

### Bug Fixes

* contract mode definition should only be added when not testing asap_contract ([c6d5e34](http://github.com/abdes/asap/commit/c6d5e342e7a74236bb1b006be1e0d6bfe956a51a))
* use correct path for the version include file ([7997b68](http://github.com/abdes/asap/commit/7997b68eeef236e6940b0ba168c79dbdd21b34ad))

## [4.5.0](http://github.com/abdes/asap/compare/v4.4.8...v4.5.0) (2022-09-19)

### Features
Expand All @@ -20,8 +52,7 @@ All notable changes to this project will be documented in this file. See [standa

2. **More visibility on project/module nesting**

Enhance configure logs with project/module nesting hierarchy
([f6c13f2](http://github.com/abdes/asap/commit/f6c13f2a08c89cac57fb2f0dd857c8f382e50e7b))
Enhance configure logs with project/module nesting hierarchy ([f6c13f2](http://github.com/abdes/asap/commit/f6c13f2a08c89cac57fb2f0dd857c8f382e50e7b))

Track the projects/modules nesting level with a hierarchy stack updated
when we enter/exit a project/module. Most of the management is done
Expand Down
54 changes: 27 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ set(META_VERSION_PATCH "2")
set(META_VERSION_REVISION "${GIT_REV}")
set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}")
set(META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION})")
set(META_CMAKE_INIT_SHA "${GIT_REV}")
# cmake-format: on

string(MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID)
Expand Down Expand Up @@ -84,6 +83,7 @@ option(ASAP_WITH_GOOGLE_ASAN "Instrument code with address sanitizer"
option(ASAP_WITH_GOOGLE_UBSAN "Instrument code with undefined behavior sanitizer" OFF)
option(ASAP_WITH_GOOGLE_TSAN "Instrument code with thread sanitizer" OFF)
option(ASAP_WITH_VALGRIND "Builds targets with valgrind profilers added" OFF)
option(USE_CCACHE "Enable caching of compiled artifacts using ccache" OFF)
# cmake-format: on

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -150,6 +150,32 @@ include(DoxGeneration)
set(SPHINX_BUILD_DIR "${CMAKE_BINARY_DIR}/sphinx")
include(SphinxGeneration)

# ------------------------------------------------------------------------------
# Testing
# ------------------------------------------------------------------------------

if(ASAP_BUILD_TESTS)
include(GoogleSanitizers)
include(CodeCoverage)
# Enable this target when the project has test cases
asap_add_code_coverage_all_targets()
include(Valgrind)

cpmaddpackage(
NAME
googletest
GIT_TAG
main
GITHUB_REPOSITORY
google/googletest
OPTIONS
"gtest_force_shared_crt ON"
"INSTALL_GTEST OFF")

include(GoogleTest)
include(CTest)
endif()

# ------------------------------------------------------------------------------
# Third party modules
#
Expand Down Expand Up @@ -206,32 +232,6 @@ if(NOT SYSTEM_DIR_INSTALL)
set(CMAKE_INSTALL_RPATH "$ORIGIN/${ASAP_INSTALL_LIB}")
endif()

# ------------------------------------------------------------------------------
# Testing
# ------------------------------------------------------------------------------

if(ASAP_BUILD_TESTS)
include(GoogleSanitizers)
include(CodeCoverage)
# Enable this target when the project has test cases
asap_add_code_coverage_all_targets()
include(Valgrind)

cpmaddpackage(
NAME
googletest
GIT_TAG
main
GITHUB_REPOSITORY
google/googletest
OPTIONS
"gtest_force_shared_crt ON"
"INSTALL_GTEST OFF")

include(GoogleTest)
include(CTest)
endif()

# ------------------------------------------------------------------------------
# Project modules
# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion cmake/common
Submodule common updated 1 files
+18 −0 FindAuk.cmake
1 change: 1 addition & 0 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ asap_add_package(
master
GITHUB_REPOSITORY
asap-projects/asap-common
OPTIONS
"ASAP_COMMON_INSTALL OFF"
"ASAP_BUILD_TESTS OFF"
"ASAP_BUILD_EXAMPLES OFF")
10 changes: 6 additions & 4 deletions tools/version-info/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ target_include_directories(
# Run executable test
# ------------------------------------------------------------------------------

add_test(
NAME version-info
COMMAND ${MODULE_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(ASAP_BUILD_TESTS)
add_test(
NAME version-info
COMMAND ${MODULE_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

# ==============================================================================
# Deployment instructions
Expand Down

0 comments on commit 0ba5409

Please sign in to comment.