Skip to content

Commit

Permalink
Use ccache if available
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Nov 29, 2024
1 parent 1961b3f commit 26293af
Showing 10 changed files with 129 additions and 107 deletions.
138 changes: 73 additions & 65 deletions asio/.TODO.txt
Original file line number Diff line number Diff line change
@@ -1,89 +1,97 @@
ninja -C build/dev spell-check
#!/bin/sh
set -x
set -e

make
git ls-files '::*CMakeLists.txt' | xargs cmake-lint
ninja -C build/dev spell-check 2>&1 | tee .TODO.txt
#
ninja: Entering directory `build/dev'
[1/1] Checking spelling
FAILED: CMakeFiles/spell-check /home/klein_cl/Workspace/cpp/asio/asio/build/dev/CMakeFiles/spell-check
cd /home/klein_cl/Workspace/cpp/asio/asio && /home/klein_cl/.local/lib/python3.10/site-packages/cmake/data/bin/cmake -D SPELL_COMMAND=codespell -P /home/klein_cl/Workspace/cpp/asio/asio/cmake/spell.cmake
FAILED: CMakeFiles/spell-check /Users/clausklein/Workspace/cpp/asio/asio/build/dev/CMakeFiles/spell-check
cd /Users/clausklein/Workspace/cpp/asio/asio && /usr/local/bin/cmake -D SPELL_COMMAND=codespell -P /Users/clausklein/Workspace/cpp/asio/asio/cmake/spell.cmake
Used config files:
1: .codespellrc
./src/examples/cpp14/operations/composed_7.cpp:73: asychronous ==> asynchronous
./src/examples/cpp14/operations/composed_7.cpp:119: asychronous ==> asynchronous
./src/examples/cpp14/operations/composed_6.cpp:111: asychronous ==> asynchronous
./include/asio/basic_datagram_socket.hpp:348: ore ==> or
./include/asio/basic_datagram_socket.hpp:380: ore ==> or
./include/asio/basic_raw_socket.hpp:342: ore ==> or
./include/asio/basic_raw_socket.hpp:373: ore ==> or
./include/asio/disposition.hpp:29: arbtirary ==> arbitrary
./include/asio/io_context.hpp:301: reponsibility ==> responsibility
./include/asio/io_context.hpp:350: reponsibility ==> responsibility
./include/asio/use_future.hpp:93: retuned ==> returned
./include/asio/impl/use_future.hpp:105: exeption ==> exception, exemption
./include/asio/experimental/impl/parallel_group.hpp:81: operatations ==> operations
./include/asio/experimental/impl/parallel_group.hpp:396: operatations ==> operations
./include/asio/detail/executor_function.hpp:119: copyable ==> copiable
./include/asio/detail/service_registry.hpp:79: Initalise ==> Initialise
./include/asio/detail/service_registry.hpp:84: Initalise ==> Initialise
./include/asio/detail/timer_queue_ptime.hpp:34: instantation ==> instantiation
./include/asio/detail/win_iocp_io_context.hpp:260: resouce ==> resource
./include/asio/detail/impl/socket_ops.ipp:3330: servent ==> servant, serpent, fervent
./include/asio/detail/impl/socket_ops.ipp:3341: servent ==> servant, serpent, fervent
./include/asio/detail/impl/socket_ops.ipp:3715: servent ==> servant, serpent, fervent
./include/asio/execution/any_executor.hpp:112: requre ==> require
./include/asio/execution/impl/bad_executor.ipp:2: exection ==> execution, ejection, election, exertion
./include/asio/ip/detail/endpoint.hpp:31: implementating ==> implementing
./src/examples/cpp20/operations/composed_6.cpp:116: asychronous ==> asynchronous
./src/examples/cpp20/operations/composed_7.cpp:74: asychronous ==> asynchronous
./src/examples/cpp20/operations/composed_7.cpp:120: asychronous ==> asynchronous
./src/examples/cpp11/timers/time_t_timer.cpp:66: absoluate ==> absolute
./src/examples/cpp11/porthopper/client.cpp:96: renegotation ==> renegotiation
./src/examples/cpp11/porthopper/client.cpp:120: renegotation ==> renegotiation
./src/examples/cpp11/porthopper/client.cpp:149: renegotation ==> renegotiation
./src/examples/cpp11/porthopper/client.cpp:162: renegotation ==> renegotiation
./src/examples/cpp11/operations/composed_7.cpp:60: asychronous ==> asynchronous
./src/examples/cpp11/operations/composed_6.cpp:93: asychronous ==> asynchronous
./src/examples/cpp20/operations/composed_7.cpp:74: asychronous ==> asynchronous
./src/examples/cpp20/operations/composed_7.cpp:120: asychronous ==> asynchronous
./src/examples/cpp20/operations/composed_6.cpp:116: asychronous ==> asynchronous
./src/doc/reference.qbk:1697: requre ==> require
./src/doc/reference.qbk:3966: requre ==> require
./src/doc/reference.qbk:17885: ore ==> or
./src/doc/reference.qbk:17947: ore ==> or
./src/doc/reference.qbk:32144: ore ==> or
./src/doc/reference.qbk:32206: ore ==> or
./src/doc/reference.qbk:89453: requre ==> require
./src/doc/reference.qbk:110672: reponsibility ==> responsibility
./src/doc/reference.qbk:110715: reponsibility ==> responsibility
./src/doc/reference.qbk:110799: reponsibility ==> responsibility
./src/doc/reference.qbk:110833: reponsibility ==> responsibility
./src/doc/reference.qbk:164642: retuned ==> returned
./src/doc/history.qbk:41: potental ==> potential
./src/doc/history.qbk:165: immmediate ==> immediate
./src/doc/history.qbk:863: occured ==> occurred
./src/doc/history.qbk:1710: compatiblity ==> compatibility
./src/doc/history.qbk:1827: Lightening ==> Lightning, Lighting
./src/doc/history.qbk:1903: copyable ==> copiable
./src/doc/history.qbk:1946: discconected ==> disconnected
./src/doc/history.qbk:2108: compatability ==> compatibility
./src/doc/history.qbk:2533: copyable ==> copiable
./src/doc/history.qbk:2568: accomodate ==> accommodate
./src/doc/history.qbk:2788: tranferred ==> transferred
./src/doc/history.qbk:2907: re-use ==> reuse
./src/examples/cpp11/operations/composed_7.cpp:60: asychronous ==> asynchronous
./src/examples/cpp14/operations/composed_6.cpp:111: asychronous ==> asynchronous
./src/examples/cpp14/operations/composed_7.cpp:73: asychronous ==> asynchronous
./src/examples/cpp14/operations/composed_7.cpp:119: asychronous ==> asynchronous
./src/doc/history.qbk:327: potental ==> potential
./src/doc/history.qbk:451: immmediate ==> immediate
./src/doc/history.qbk:1149: occured ==> occurred
./src/doc/history.qbk:1996: compatiblity ==> compatibility
./src/doc/history.qbk:2113: Lightening ==> Lightning, Lighting
./src/doc/history.qbk:2189: copyable ==> copiable
./src/doc/history.qbk:2232: discconected ==> disconnected
./src/doc/history.qbk:2394: compatability ==> compatibility
./src/doc/history.qbk:2819: copyable ==> copiable
./src/doc/history.qbk:2854: accomodate ==> accommodate
./src/doc/history.qbk:3074: tranferred ==> transferred
./src/doc/history.qbk:3193: re-use ==> reuse
./src/doc/quickref.xml:17: thead ==> thread
./src/doc/quickref.xml:26: thead ==> thread
./src/doc/quickref.xml:133: thead ==> thread
./src/doc/quickref.xml:139: thead ==> thread
./src/doc/quickref.xml:320: thead ==> thread
./src/doc/quickref.xml:326: thead ==> thread
./src/doc/quickref.xml:427: thead ==> thread
./src/doc/quickref.xml:433: thead ==> thread
./src/doc/quickref.xml:577: thead ==> thread
./src/doc/quickref.xml:592: thead ==> thread
./src/doc/quickref.xml:693: thead ==> thread
./src/doc/quickref.xml:705: thead ==> thread
./src/doc/quickref.xml:350: thead ==> thread
./src/doc/quickref.xml:356: thead ==> thread
./src/doc/quickref.xml:454: thead ==> thread
./src/doc/quickref.xml:460: thead ==> thread
./src/doc/quickref.xml:604: thead ==> thread
./src/doc/quickref.xml:619: thead ==> thread
./src/doc/quickref.xml:719: thead ==> thread
./src/doc/quickref.xml:731: thead ==> thread
./src/doc/reference.qbk:1705: requre ==> require
./src/doc/reference.qbk:3974: requre ==> require
./src/doc/reference.qbk:18087: ore ==> or
./src/doc/reference.qbk:18149: ore ==> or
./src/doc/reference.qbk:32346: ore ==> or
./src/doc/reference.qbk:32408: ore ==> or
./src/doc/reference.qbk:91119: requre ==> require
./src/doc/reference.qbk:112306: reponsibility ==> responsibility
./src/doc/reference.qbk:112349: reponsibility ==> responsibility
./src/doc/reference.qbk:112433: reponsibility ==> responsibility
./src/doc/reference.qbk:112467: reponsibility ==> responsibility
./src/doc/reference.qbk:167559: retuned ==> returned
./src/doc/using.qbk:232: Explictly ==> Explicitly
./src/doc/requirements/asynchronous_operations.qbk:332: asynchonous ==> asynchronous
./src/doc/overview/immediate_completion.qbk:16: immmediate ==> immediate
./src/doc/overview/cpp20_coroutines.qbk:223: Asynchonous ==> Asynchronous
./src/doc/overview/coro.qbk:15: transfomers ==> transformers
./src/doc/overview/coro.qbk:136: dermined ==> determined
./src/doc/overview/coro.qbk:137: follwing ==> following
./src/doc/overview/coro.qbk:194: direclty ==> directly
./src/doc/overview/cpp20_coroutines.qbk:223: Asynchonous ==> Asynchronous
./src/doc/overview/immediate_completion.qbk:16: immmediate ==> immediate
./src/doc/overview/implementation.qbk:63: asynchonous ==> asynchronous
./cmake/install-rules.cmake:19: requierd ==> required
./include/asio/io_context.hpp:300: reponsibility ==> responsibility
./include/asio/io_context.hpp:331: reponsibility ==> responsibility
./include/asio/io_context.hpp:381: reponsibility ==> responsibility
./include/asio/io_context.hpp:403: reponsibility ==> responsibility
./include/asio/basic_datagram_socket.hpp:348: ore ==> or
./include/asio/basic_datagram_socket.hpp:380: ore ==> or
./include/asio/use_future.hpp:102: retuned ==> returned
./include/asio/basic_raw_socket.hpp:342: ore ==> or
./include/asio/basic_raw_socket.hpp:373: ore ==> or
./include/asio/detail/timer_queue_ptime.hpp:32: instantation ==> instantiation
./include/asio/detail/executor_function.hpp:119: copyable ==> copiable
./include/asio/detail/service_registry.hpp:79: Initalise ==> Initialise
./include/asio/detail/service_registry.hpp:84: Initalise ==> Initialise
./include/asio/detail/win_iocp_io_context.hpp:267: resouce ==> resource
./include/asio/execution/any_executor.hpp:112: requre ==> require
./include/asio/execution/impl/bad_executor.ipp:2: exection ==> execution
./include/asio/experimental/impl/parallel_group.hpp:81: operatations ==> operations
./include/asio/experimental/impl/parallel_group.hpp:396: operatations ==> operations
./include/asio/ip/detail/endpoint.hpp:31: implementating ==> implementing
./include/asio/impl/use_future.hpp:104: exeption ==> exception, exemption
CMake Error at cmake/spell.cmake:27 (message):
Run again with FIX=YES to fix these errors.
3 changes: 1 addition & 2 deletions asio/.cmakefiles.txt
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ files='
.cmakefiles.txt
.codespellrc
.gitignore
GNUMakefile
GNUmakefile
docs
requirements.txt
BUILDING.md
@@ -33,7 +33,6 @@ cmake/install-rules.cmake
cmake/lint-targets.cmake
cmake/lint.cmake
cmake/prelude.cmake
cmake/project-is-top-level.cmake
cmake/spell-targets.cmake
cmake/spell.cmake
cmake/variables.cmake
53 changes: 30 additions & 23 deletions asio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ project(asio
LANGUAGES CXX
)

# include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)

if(PROJECT_IS_TOP_LEVEL)
@@ -33,51 +32,59 @@ find_package(Threads REQUIRED)

# ---- Declare library ----

file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp")
list(FILTER implementation EXCLUDE REGEX [=[.*/experimental/.*]=])
file(GLOB_RECURSE _asio_implementation "include/asio/*/*.hpp" "include/asio/*.ipp")
list(FILTER _asio_implementation EXCLUDE REGEX [=[.*/experimental/.*]=])

add_library(asio_header INTERFACE)
add_library(asio::asio_header ALIAS asio_header)
target_sources(asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${implementation})
target_sources(asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${_asio_implementation})

target_compile_definitions(asio_header INTERFACE ${CPPdefinitions})
target_compile_features(asio_header INTERFACE cxx_std_20)
target_compile_features(
asio_header INTERFACE "$<$<COMPILE_FEATURES:cxx_std_23>:cxx_std_23>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
)
target_link_libraries(asio_header INTERFACE Threads::Threads)

if(ASIO_SEPARATE_COMPILATION)
#XXX find_package(OpenSSL)
set(libasio_SOURCES src/asio.cpp)
set(_libasio_SOURCES src/asio.cpp)

# TODO(ssl): find_package(OpenSSL)
if(OpenSSL_FOUND)
#XXX set(libasio_SOURCES ${libasio_SOURCES} src/asio_ssl.cpp)
# TODO(ssl): list(APPEND _libasio_SOURCES src/asio_ssl.cpp)
endif()

set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL})

file(GLOB_RECURSE headers "include/asio/*.hpp")
list(FILTER headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=])
list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=])
list(FILTER headers EXCLUDE REGEX [=[.*/ssl/\.*]=])
list(FILTER headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=])
file(GLOB_RECURSE _asio_headers "include/asio/*.hpp")
list(FILTER _asio_headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=])
list(FILTER _asio_headers EXCLUDE REGEX [=[.*/ssl\.hpp]=])
list(FILTER _asio_headers EXCLUDE REGEX [=[.*/ssl/\.*]=])
list(FILTER _asio_headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=])

# FIXME: some header in include/asio/detail fails CMAKE_VERIFY_INTERFACE_HEADER_SETS!
# NOTE: we need them installed, but we used them install with asio_header INTERFACE! CK
set(public_headers ${headers})
list(FILTER public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=])
list(FILTER public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=])
list(FILTER public_headers EXCLUDE REGEX [=[.*/ssl/\.*]=])
list(FILTER public_headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=])
# foreach(header in LISTS ${public_headers})
set(_public_headers ${_asio_headers})
list(FILTER _public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=])
list(FILTER _public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=])
list(FILTER _public_headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=])
# foreach(header in LISTS ${_public_headers})
# message(INFO "${header}")
# endforeach()

add_library(asio ${libasio_SOURCES})
add_library(asio ${_libasio_SOURCES})
add_library(asio::asio ALIAS asio)
target_sources(asio PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${public_headers})
target_sources(asio PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${_public_headers})

target_compile_definitions(asio PUBLIC ASIO_SEPARATE_COMPILATION ${CPPdefinitions})
target_link_libraries(asio PUBLIC Threads::Threads)
target_compile_features(asio INTERFACE cxx_std_20)
target_compile_features(
asio INTERFACE "$<$<COMPILE_FEATURES:cxx_std_23>:cxx_std_23>" "$<$<NOT:$<COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
)

if(ASIO_WARNINGS_AS_ERRORS AND ASIO_DEVELOPER_MODE AND UNIX)
target_compile_options(asio PUBLIC -Werror)
endif()

if(OpenSSL_FOUND)
target_link_libraries(asio PUBLIC OpenSSL::SSL)
@@ -94,7 +101,7 @@ endif()

# ---- Developer mode ----

if(NOT asio_DEVELOPER_MODE)
if(NOT ASIO_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(AUTHOR_WARNING "Developer mode is intended for developers of asio")
2 changes: 1 addition & 1 deletion asio/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
"hidden": true,
"inherits": "cmake-pedantic",
"cacheVariables": {
"asio_DEVELOPER_MODE": "ON"
"ASIO_DEVELOPER_MODE": "ON"
}
},
{
File renamed without changes.
4 changes: 2 additions & 2 deletions asio/HACKING.md
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ guide.
## Developer mode

Build system targets that are only useful for developers of this project are
hidden if the `asio_DEVELOPER_MODE` option is disabled. Enabling this
hidden if the `ASIO_DEVELOPER_MODE` option is disabled. Enabling this
option makes tests and other developer targets and options available. Not
enabling this option means that you are a consumer of this project and thus you
have no need for these targets and options.
@@ -23,7 +23,7 @@ the project. As a developer, you are recommended to always have the [latest
CMake version][2] installed to make use of the latest Quality-of-Life
additions.

You have a few options to pass `asio_DEVELOPER_MODE` to the configure
You have a few options to pass `ASIO_DEVELOPER_MODE` to the configure
command, but this project prefers to use presets.

As a developer, you should create a `CMakeUserPresets.json` file at the root of
16 changes: 8 additions & 8 deletions asio/cmake/install-rules.cmake
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ include(cmake/AddUninstallTarget.cmake)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)

# find_package(<package>) call for consumers to find this project
set(package asio)
# find_package(<package) call for consumers to find this project
set(_package asio)

#NO! install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development)

@@ -22,23 +22,23 @@ if(TARGET asio)
install(TARGETS asio EXPORT asioTargets FILE_SET public_headers)
endif()

write_basic_package_version_file("${package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
write_basic_package_version_file("${_package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)

# Allow package maintainers to freely override the path for the configs
set(asio_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}"
set(ASIO_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${_package}"
CACHE PATH "CMake package config location relative to the install prefix"
)
mark_as_advanced(asio_INSTALL_CMAKEDIR)
mark_as_advanced(ASIO_INSTALL_CMAKEDIR)

install(FILES cmake/install-config.cmake DESTINATION "${asio_INSTALL_CMAKEDIR}" RENAME "${package}Config.cmake"
install(FILES cmake/install-config.cmake DESTINATION "${ASIO_INSTALL_CMAKEDIR}" RENAME "${_package}Config.cmake"
COMPONENT asio_Development
)

install(FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" DESTINATION "${asio_INSTALL_CMAKEDIR}"
install(FILES "${PROJECT_BINARY_DIR}/${_package}ConfigVersion.cmake" DESTINATION "${ASIO_INSTALL_CMAKEDIR}"
COMPONENT asio_Development
)

install(EXPORT asioTargets NAMESPACE asio:: DESTINATION "${asio_INSTALL_CMAKEDIR}" COMPONENT asio_Development)
install(EXPORT asioTargets NAMESPACE asio:: DESTINATION "${ASIO_INSTALL_CMAKEDIR}" COMPONENT asio_Development)

if(PROJECT_IS_TOP_LEVEL)
set(CPACK_GENERATOR TGZ)
8 changes: 8 additions & 0 deletions asio/cmake/prelude.cmake
Original file line number Diff line number Diff line change
@@ -7,3 +7,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
"You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' first."
)
endif()

# -- Use ccache if found --
find_program(CCACHE_EXECUTABLE "ccache" HINTS /usr/local/bin /opt/local/bin)
if(CCACHE_EXECUTABLE)
message(STATUS "use ccache")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache" FORCE)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache" FORCE)
endif()
2 changes: 0 additions & 2 deletions asio/cmake/project-is-top-level.cmake

This file was deleted.

10 changes: 6 additions & 4 deletions asio/cmake/variables.cmake
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
# Targets necessary to build the project must be provided unconditionally, so
# consumers can trivially build and package the project
if(PROJECT_IS_TOP_LEVEL)
option(asio_DEVELOPER_MODE "Enable developer mode" OFF)
option(ASIO_DEVELOPER_MODE "Enable developer mode" OFF)
endif()

# ---- Warning guard ----
@@ -16,9 +16,11 @@ endif()
# add_subdirectory or FetchContent is used to consume this project
set(warning_guard "")
if(NOT PROJECT_IS_TOP_LEVEL)
option(asio_INCLUDES_WITH_SYSTEM "Use SYSTEM modifier for asio's includes, disabling warnings" ON)
mark_as_advanced(asio_INCLUDES_WITH_SYSTEM)
if(asio_INCLUDES_WITH_SYSTEM)
option(ASIO_INCLUDES_WITH_SYSTEM "Use SYSTEM modifier for asio's includes, disabling warnings" ON)
mark_as_advanced(ASIO_INCLUDES_WITH_SYSTEM)
if(ASIO_INCLUDES_WITH_SYSTEM)
set(warning_guard SYSTEM)
endif()
endif()

option(ASIO_WARNINGS_AS_ERRORS "Be really strict" OFF)

0 comments on commit 26293af

Please sign in to comment.