diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 7285f129..b8859d05 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -9,14 +9,18 @@ on: pull_request: workflow_dispatch: schedule: - - cron: '30 15 * * *' + - cron: '30 15 * * 6' + +concurrency: + group: ${{format('{0}:{1}', github.repository, github.ref)}} + cancel-in-progress: true jobs: beman-submodule-check: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.3.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.7.3 preset-test: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.3.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.7.3 with: matrix_config: > [ @@ -29,33 +33,45 @@ jobs: ] build-and-test: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.3.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.7.3 with: matrix_config: > { "gcc": [ - { "versions": ["15"], + { "versions": ["16"], "tests": [ { "cxxversions": ["c++26"], "tests": [ { "stdlibs": ["libstdc++"], "tests": [ - "Debug.Default", "Release.Default", "Release.MaxSan", - "Debug.Coverage", "Debug.Werror", - "Debug.Dynamic", "Release.Dynamic" + "Debug.Default", "Release.Default", "Release.TSan", + "Release.MaxSan", "Debug.Werror", + "Debug.Coverage", "Debug.-DBEMAN_USE_MODULES=On" ] } ] }, { "cxxversions": ["c++23"], - "tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}] + "tests": [ + { "stdlibs": ["libstdc++"], + "tests": [ + "Release.Default", "Debug.-DBEMAN_USE_MODULES=On" + ] + } + ] } ] }, - { "versions": ["14"], + { "versions": ["15"], "tests": [ { "cxxversions": ["c++26", "c++23"], - "tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}] + "tests": [ + { "stdlibs": ["libstdc++"], + "tests": [ + "Release.Default", "Debug.-DBEMAN_USE_MODULES=On" + ] + } + ] } ] } @@ -67,15 +83,20 @@ jobs: "tests": [ { "stdlibs": ["libc++"], "tests": [ - "Debug.Default", "Release.Default", "Release.MaxSan", - "Debug.Dynamic", "Release.Dynamic" + "Debug.Default", "Release.Default", "Release.TSan", + "Release.MaxSan", "Debug.Werror", + "Debug.-DBEMAN_USE_MODULES=On" ] } ] }, { "cxxversions": ["c++23"], "tests": [ - {"stdlibs": ["libc++"], "tests": ["Release.Default"]} + { "stdlibs": ["libc++"], + "tests": [ + "Release.Default", "Debug.-DBEMAN_USE_MODULES=On" + ] + } ] } ] @@ -96,8 +117,9 @@ jobs: { "cxxversions": ["c++23"], "tests": [ { "stdlibs": ["stl"], - "tests": ["Debug.Default", "Release.Default", "Release.MaxSan", - "Debug.Dynamic", "Release.Dynamic" + "tests": [ + "Debug.Default", "Release.Default", "Release.MaxSan", + "Debug.-DBEMAN_USE_MODULES=On" ] } ] @@ -110,4 +132,4 @@ jobs: create-issue-when-fault: needs: [preset-test, build-and-test] if: failure() && github.event_name == 'schedule' - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.3.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.7.3 diff --git a/.github/workflows/pre-commit-update.yml b/.github/workflows/pre-commit-update.yml index 930b750c..53825d40 100644 --- a/.github/workflows/pre-commit-update.yml +++ b/.github/workflows/pre-commit-update.yml @@ -9,7 +9,7 @@ on: jobs: auto-update-pre-commit: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-update-pre-commit.yml@1.3.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-update-pre-commit.yml@1.7.3 secrets: APP_ID: ${{ secrets.AUTO_PR_BOT_APP_ID }} PRIVATE_KEY: ${{ secrets.AUTO_PR_BOT_PRIVATE_KEY }} diff --git a/.gitignore b/.gitignore index bc32eb4a..3156a8c3 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ cmake-build-* .cache .vscode .idea +.init compile_commands.json stagedir diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 117f209e..2ff9a1b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: # Config file: .codespellrc - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell files: ^.*\.(cmake|cpp|cppm|hpp|txt|md|mds|json|js|in|yaml|yml|py|toml)$ @@ -49,7 +49,7 @@ repos: # Config file: pyproject.toml # first Python sort imports - repo: https://github.com/pycqa/isort - rev: 9.0.0a3 + rev: 9.0.0b1 hooks: - id: isort diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e01bc92..3d80e7dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,6 @@ set(BEMAN_EXECUTION_TARGET_PREFIX ${PROJECT_NAME}) # NOTE: used in src, and docs #=============================================================================== if(BEMAN_USE_MODULES) - option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) - set(CMAKE_CXX_SCAN_FOR_MODULES ON) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) @@ -61,14 +59,6 @@ if(BEMAN_USE_MODULES) DLL_NAME_WITH_SOVERSION TRUE ) - # FIXME: Quickfix only to prevent linker problems on windows dll? CK - if(WIN32 AND BUILD_SHARED_LIBS) - set_target_properties( - ${BEMAN_EXECUTION_TARGET_PREFIX} - PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON - ) - endif() - find_package(Threads REQUIRED) target_link_libraries( ${BEMAN_EXECUTION_TARGET_PREFIX} diff --git a/CMakePresets.json b/CMakePresets.json index 224619b9..7cffee09 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -34,7 +34,7 @@ }, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "BEMAN_BUILDSYS_SANITIZER": "MaxSan" + "BEMAN_BUILDSYS_SANITIZER": "" } }, { @@ -90,7 +90,7 @@ "_release-base" ], "cacheVariables": { - "BEMAN_USE_STD_MODULE": false, + "BEMAN_USE_STD_MODULE": true, "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/infra/cmake/llvm-libc++-toolchain.cmake" }, "environment": { diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 00000000..865ec0e8 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,46 @@ +# GNUmakefile +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +MAKEFLAGS+= --no-builtin-rules # Disable the built-in implicit rules. +MAKEFLAGS+= --warn-undefined-variables # Warn when an undefined variable is referenced. +.SUFFIXES: # Disable all suffix rules. +################################################## + +PRESET ?= release +IMAGE ?= linux-clang:23 + +.PHONY: all check distclean dockerbuild + +# default target rule +all: .init compile_commands.json + cmake --workflow --preset $(PRESET) + +.init: CMakeUserPresets.json CMakePresets.json CMakeLists.txt #NO! $(MAKEFILE) + cmake --preset $(PRESET) --fresh --log-level=VERBOSE + touch $@ + +check: .init compile_commands.json +compile_commands.json: build/$(PRESET)/compile_commands.json + ln -fs $< $@ + +CMakeUserPresets.json:: cmake/CMakeUserPresets.json + ln -fs $< $@ + +distclean: + rm -rf build .cache + rm -f CMakeUserPresets.json \ + compile_commands.json \ + .init + find . -name '*~' -delete + +dockerbuild: + docker run -it -v $(CURDIR):/home/builder/workdir $(IMAGE) + +# NOTE: double-colon targets which has no prerequisites must always remade by gmake? +# Prerequisite 'GNUmakefile' is newer than target '.init'. +# -> Must remake target '.init'. +# NOTE: impizit handled by gmake! GNUmakefile :: ; + +# Anything we don't know how to build will use this rule. +% :: + ninja -C build/$(PRESET) $(@) diff --git a/Makefile b/Makefile index 218730ec..ed03c97c 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ ifeq (${hostSystemName},Darwin) # export LDFLAGS=-L$(LLVM_DIR)/lib/c++ -lc++abi -lc++ # -lc++experimental # export GCOV="llvm-cov gcov" - ### TODO: to test g++-15: + ### TODO: to test g++-16: # export GCC_PREFIX:=$(shell brew --prefix gcc) # export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) @@ -63,16 +63,16 @@ ifeq (${hostSystemName},Darwin) export CXX=clang++ CXXLIB=libc++ else - export CXX=g++-15 + export CXX=g++-16 CXXLIB=libstdc++ endif export CXX_FLAGS=-stdlib=$(CXXLIB) endif export GCOV="gcov" else ifeq (${hostSystemName},Linux) - export LLVM_DIR=/usr/lib/llvm-20 + export LLVM_DIR=/usr/lib/llvm-23 export PATH:=${LLVM_DIR}/bin:${PATH} - # export CXX=clang++-20 + # NO! export CXX=clang++-23 else export CXX=$(COMPILER) endif diff --git a/cmake/cxx-modules-rules.cmake b/cmake/cxx-modules-rules.cmake index 91939b36..275f2902 100644 --- a/cmake/cxx-modules-rules.cmake +++ b/cmake/cxx-modules-rules.cmake @@ -95,12 +95,14 @@ if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) endif() message(STATUS "BEMAN_USE_MODULES=${BEMAN_USE_MODULES}") -option( - BEMAN_USE_STD_MODULE - "Check if 'import std;' is possible with the toolchain?" - OFF -) -message(STATUS "BEMAN_USE_STD_MODULE=${BEMAN_USE_STD_MODULE}") +if(CMAKE_CXX_STANDARD GREATER_EQUAL 23) + option( + BEMAN_USE_STD_MODULE + "Check if 'import std;' is possible with the toolchain?" + ON + ) + message(STATUS "BEMAN_USE_STD_MODULE=${BEMAN_USE_STD_MODULE}") +endif() if(BEMAN_USE_MODULES AND BEMAN_USE_STD_MODULE) # ------------------------------------------------------------------------- diff --git a/cmake/prelude.cmake b/cmake/prelude.cmake index de91a0b5..cb7fcf4c 100644 --- a/cmake/prelude.cmake +++ b/cmake/prelude.cmake @@ -21,7 +21,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) # --------------------------------------------------------------------------- # The CMAKE_EXPERIMENTAL_CXX_IMPORT_STD is not longer needed except for OSX # --------------------------------------------------------------------------- -if(NOT BEMAN_USE_STD_MODULE OR CMAKE_VERSION VERSION_GREATER_EQUAL 4.4) +if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.5) if(NOT APPLE) return() endif() @@ -31,7 +31,7 @@ endif() # --------------------------------------------------------------------------- # check if import std; is supported by CMAKE_CXX_COMPILER # --------------------------------------------------------------------------- -if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.4) +if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.5) if(PROJECT_NAME) message( WARNING @@ -46,7 +46,7 @@ include( ) if(NOT APPLE) - return() + # TODO(CK): return() endif() # --------------------------------------------------------------------------- @@ -83,8 +83,6 @@ if( add_link_options(-L${LLVM_DIR}/lib/c++) include_directories(SYSTEM ${LLVM_DIR}/include) - # /usr/local/Cellar/llvm/21.1.8_1/lib/c++/libc++.modules.json - # "/usr/local/Cellar/llvm/21.1.8_1/share/libc++/v1/std.cppm", set(CMAKE_CXX_STDLIB_MODULES_JSON ${LLVM_DIR}/lib/c++/libc++.modules.json ) @@ -105,18 +103,19 @@ if( endif() if(EXISTS ${CMAKE_CXX_STDLIB_MODULES_JSON}) - message( - STATUS - "CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" - ) + file(REAL_PATH "${CMAKE_CXX_STDLIB_MODULES_JSON}" LLVM_MODULES) + message(STATUS "CMAKE_CXX_STDLIB_MODULES_JSON=${LLVM_MODULES}") # gersemi: off set(CACHE{CMAKE_CXX_STDLIB_MODULES_JSON} TYPE FILEPATH - HELP "Result of: clang++ -print-file-name=c++/libc++.modules.json" - VALUE ${CMAKE_CXX_STDLIB_MODULES_JSON} + HELP "Result of: clang++ -print-file-name=libc++.modules.json" + VALUE ${LLVM_MODULES} ) # gersemi: on else() - message(STATUS "File does NOT EXISTS! ${CMAKE_CXX_STDLIB_MODULES_JSON}") + message( + WARNING + "File does NOT EXISTS! ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) endif() endif() diff --git a/infra/.beman_submodule b/infra/.beman_submodule index 628b5d0d..5cbeca37 100644 --- a/infra/.beman_submodule +++ b/infra/.beman_submodule @@ -1,3 +1,3 @@ [beman_submodule] remote=https://github.com/bemanproject/infra.git -commit_hash=7b66b858d7f48428fca936184aef2bd246ccc81a +commit_hash=7fc85e2e26cb491926ca2744c359c2aa7ea8fd27 diff --git a/infra/cmake/enable-experimental-import-std.cmake b/infra/cmake/enable-experimental-import-std.cmake index e41a5f7c..3c6d6887 100644 --- a/infra/cmake/enable-experimental-import-std.cmake +++ b/infra/cmake/enable-experimental-import-std.cmake @@ -1,5 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.3.0") +if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.4.0") + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD + "f35a9ac6-8463-4d38-8eec-5d6008153e7d" + ) +elseif(CMAKE_VERSION VERSION_GREATER_EQUAL "4.3.0") set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b" ) diff --git a/requirements.txt b/requirements.txt index 878177a0..d93c02ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ pyaml bump2version>=1.0.1 check-jsonschema>=0.36.1 cmake>=4.3 -codespell>=2.4.1 +codespell>=2.4.3 # conan>=2.26.2 gersemi>=0.27.2 gcovr>=8.6 diff --git a/tests/beman/execution/CMakeLists.txt b/tests/beman/execution/CMakeLists.txt index 91bcd74e..a0c287d9 100644 --- a/tests/beman/execution/CMakeLists.txt +++ b/tests/beman/execution/CMakeLists.txt @@ -135,7 +135,7 @@ foreach(test ${execution_tests}) endforeach() if(CMAKE_BUILD_TYPE STREQUAL "Debug") - return() + # TODO(CK): return() endif() #======================================================================