Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Apr 3, 2022
2 parents 93a2742 + 227de02 commit 0bfdbb5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,8 @@ include(cmake/CPM.cmake)
# excluded from the generated target lists for the various tools.
set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/third_party_deps)

# ---- Speedup build using ccache ----
# see https://github.com/TheLartians/Ccache.cmake enables CCACHE support through
# the USE_CCACHE flag possible values are: YES, NO or equivalent
if(USE_CCACHE)
cpmaddpackage("gh:TheLartians/Ccache.cmake@1.2.3")
endif()
# ---- Speedup build using ccache (needs CPM) ----
include(cmake/FasterBuild.cmake)

# ------------------------------------------------------------------------------
# Testing
Expand Down
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"installDir": "${sourceDir}/out/install/${presetName}",
"environment": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CPM_SOURCE_CACHE": "$env{HOME}/.cache/CPM",
"caexcludepath": "${sourceDir}/third_party;${sourceDir}/out"
},
"cacheVariables": {
"CPM_SOURCE_CACHE": "~/.cache/CPM",
"USE_CCACHE": "ON",
"ASAP_BUILD_TESTS": "ON",
"ASAP_BUILD_EXAMPLES": "ON"
Expand Down Expand Up @@ -432,4 +432,4 @@
"configurePreset": "dev-gcc"
}
]
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Starter project for C++ with modern cmake
# Starter project for C++ with cmake

![Start Now!!](doc/_static/logo.png "ASAP Logo")

[![Build Matrix](https://github.com/abdes/asap/actions/workflows/cmake-build.yml/badge.svg?branch=master)](https://github.com/abdes/asap/actions/workflows/cmake-build.yml)
[![Build Matrix](https://github.com/abdes/asap/actions/workflows/cmake-build.yml/badge.svg?branch=develop)](https://github.com/abdes/asap/actions/workflows/cmake-build.yml)

## [Project Documentation](https://abdes.github.io/asap/asap_master/html/)

Expand Down
25 changes: 14 additions & 11 deletions cmake/AsapTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ endfunction()

function(_module_pkgconfig_files)
set(MODULE_PKGCONFIG_FILE ${MODULE_TARGET_NAME}.pc)
get_target_property(TARGET_DEBUG_POSTFIX ${MODULE_TARGET_NAME} DEBUG_POSTFIX)
set(MODULE_LINK_LIBS "-l${MODULE_TARGET_NAME}${TARGET_DEBUG_POSTFIX}")
if(NOT ${type} STREQUAL "INTERFACE_LIBRARY")
get_target_property(TARGET_DEBUG_POSTFIX ${MODULE_TARGET_NAME}
DEBUG_POSTFIX)
set(MODULE_LINK_LIBS "-l${MODULE_TARGET_NAME}${TARGET_DEBUG_POSTFIX}")
endif()
configure_file(config.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE} @ONLY)
if(${META_PROJECT_ID}_INSTALL)
Expand Down Expand Up @@ -112,16 +115,16 @@ function(asap_add_library target)
asap_set_compile_definitions(${target})
# Generate export headers for the library
asap_generate_export_headers(${target} ${META_MODULE_NAME})
endif()

set_target_properties(
${target}
PROPERTIES FOLDER "Libraries"
VERSION ${META_MODULE_VERSION}
SOVERSION ${META_MODULE_VERSION_MAJOR}
DEBUG_POSTFIX "d"
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES)
set_target_properties(
${target}
PROPERTIES FOLDER "Libraries"
VERSION ${META_MODULE_VERSION}
SOVERSION ${META_MODULE_VERSION_MAJOR}
DEBUG_POSTFIX "d"
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES)
endif()
endfunction()

function(asap_add_executable target)
Expand Down
22 changes: 22 additions & 0 deletions cmake/FasterBuild.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ===-----------------------------------------------------------------------===#
# Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
# copy at https://opensource.org/licenses/BSD-3-Clause).
# SPDX-License-Identifier: BSD-3-Clause
# ===-----------------------------------------------------------------------===#

# ------------------------------------------------------------------------------
# Reduce build time by using ccache when available
# ------------------------------------------------------------------------------

find_program(CCACHE_TOOL_PATH ccache)

if(NOT WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
message(STATUS "Using ccache (${CCACHE_TOOL_PATH}) (via wrapper).")
# see https://github.com/TheLartians/Ccache.cmake enables CCACHE support through
# the USE_CCACHE flag possible values are: YES, NO or equivalent
cpmaddpackage("gh:TheLartians/Ccache.cmake@1.2.3")
elseif(WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).")
endif()

0 comments on commit 0bfdbb5

Please sign in to comment.