Skip to content

Commit

Permalink
Move to COPACABANA and Doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
jfalcou authored Aug 9, 2024
1 parent f288bb1 commit 43d4032
Show file tree
Hide file tree
Showing 66 changed files with 5,491 additions and 961 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
##======================================================================================================================
## SPY - Compact C++20 Tuple Toolbox
## Copyright : SPY Project Contributors
## SPDX-License-Identifier: BSL-1.0
##======================================================================================================================
name: SPY Documentation Generation
on:
push:
branches:
- main

jobs:
generate-doc:
runs-on: ubuntu-latest
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false
steps:
- name: Fetch current branch
uses: actions/[email protected]
- name: Prepare SPY
run: |
mkdir build && cd build
cmake .. -G Ninja -DSPY_BUILD_TEST=OFF -DSPY_BUILD_DOCUMENTATION=ON
- name: Generate Doxygen
run: |
cd build
ninja spy-doxygen
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/doc
75 changes: 75 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
##======================================================================================================================
## SPY - Compact C++20 Tuple Toolbox
## Copyright : SPY Project Contributors
## SPDX-License-Identifier: BSL-1.0
##======================================================================================================================
name: SPY Integration Tests
on:
push:
branches:
- main

concurrency:
group: spy-integration-${{ github.ref }}
cancel-in-progress: true

jobs:

install:
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false

steps:
- name: Fetch current branch
uses: actions/[email protected]
- name: Install SPY from checkout
run: |
mkdir build && cd build
cmake -G Ninja .. -DSPY_BUILD_TEST=OFF -DCMAKE_CXX_COMPILER=clang++
ninja install
- name: Run Sample CMake
run: |
mkdir install && cd install
cmake ../test/integration/install-test -G Ninja
ninja && ctest --verbose
fetch-content:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false

steps:
- name: Fetch current branch
uses: actions/[email protected]
- name: Compile using FetchContent
run: |
git config --global --add safe.directory /__w/kumi/kumi
mkdir install && cd install
cmake ../test/integration/fetch-test -G Ninja -DGIT_BRANCH=${BRANCH_NAME} -DSPY_BUILD_TEST=OFF -DCMAKE_CXX_COMPILER=clang++
ninja && ctest --verbose
cpm:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false

steps:
- name: Fetch current branch
uses: actions/[email protected]
- name: Compile using CPM
run: |
git config --global --add safe.directory /__w/kumi/kumi
mkdir install && cd install
cmake ../test/integration/cpm-test -G Ninja -DGIT_BRANCH=${BRANCH_NAME} -DCMAKE_CXX_COMPILER=clang++ -DSPY_BUILD_TEST=OFF
ninja && ctest --verbose
34 changes: 17 additions & 17 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- main

concurrency:
group: unit-${{ github.ref }}
group: spy-unit-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand All @@ -37,7 +37,7 @@ jobs:
cmake .. -DCMAKE_BUILD_TYPE="${{ matrix.cfg.mode }}" \
-DCMAKE_TOOLCHAIN_FILE=../test/toolchain/${{ matrix.cfg.comp }}.${{ matrix.cfg.arch }}.cmake
- name: Compiling Unit Tests
run: cd build && make unit -j 2
run: cd build && make spy-test -j 2
- name: Running Unit Tests
run: cd build && ctest --output-on-failure -j 2

Expand All @@ -63,7 +63,7 @@ jobs:
- name: Compiling Unit Tests
run: |
cd build
cmake --build . --target unit --config ${{ matrix.cfg.mode }} --parallel 2
cmake --build . --target spy-test --config ${{ matrix.cfg.mode }} --parallel 2
- name: Running Tests
run: |
cd build
Expand All @@ -88,7 +88,7 @@ jobs:
- name: Compiling Unit Tests
run: |
cd build
cmake --build . --target unit --config ${{ matrix.cfg.mode }} --parallel 2
cmake --build . --target spy-test --config ${{ matrix.cfg.mode }} --parallel 2
- name: Running Tests
run: |
cd build
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
cmake .. -G Ninja -DCMAKE_BUILD_TYPE="${{ matrix.cfg.mode }}" \
-DCMAKE_TOOLCHAIN_FILE=../test/toolchain/${{ matrix.cfg.comp }}.${{ matrix.cfg.arch }}.cmake
- name: Compiling Unit Tests
run: cd build && ninja unit -j 2
run: cd build && ninja spy-test -j 2
- name: Running Unit Tests
run: cd build && ctest --output-on-failure -j 2

Expand All @@ -133,15 +133,15 @@ jobs:
- name: Compiling Unit Tests
run: |
mkdir build && cd build
nvcc ../test/accelerator.cu -std=c++17 -I../include -o accelerator.device.exe
nvcc ../test/accelerator.cpp -std=c++17 -I../include -o accelerator.host.exe
nvcc ../test/arch.cpp -std=c++17 -I../include -o arch.exe
nvcc ../test/compiler.cpp -std=c++17 -I../include -o compiler.exe
nvcc ../test/data_model.cpp -std=c++17 -I../include -o data_model.exe
nvcc ../test/libc.cpp -std=c++17 -I../include -o libc.exe
nvcc ../test/os.cpp -std=c++17 -I../include -o os.exe
nvcc ../test/simd.cpp -std=c++17 -I../include -o simd.exe
nvcc ../test/stdlib.cpp -std=c++17 -I../include -o stdlib.exe
nvcc ../test/unit/accelerator.cu -std=c++17 -I../include -o accelerator.device.exe
nvcc ../test/unit/accelerator.cpp -std=c++17 -I../include -o accelerator.host.exe
nvcc ../test/unit/arch.cpp -std=c++17 -I../include -o arch.exe
nvcc ../test/unit/compiler.cpp -std=c++17 -I../include -o compiler.exe
nvcc ../test/unit/data_model.cpp -std=c++17 -I../include -o data_model.exe
nvcc ../test/unit/libc.cpp -std=c++17 -I../include -o libc.exe
nvcc ../test/unit/os.cpp -std=c++17 -I../include -o os.exe
nvcc ../test/unit/simd.cpp -std=c++17 -I../include -o simd.exe
nvcc ../test/unit/stdlib.cpp -std=c++17 -I../include -o stdlib.exe
- name: Running Unit Tests
run: |
cd build
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
cmake .. -G Ninja -DCMAKE_BUILD_TYPE="${{ matrix.cfg.mode }}" \
-DCMAKE_TOOLCHAIN_FILE=../test/toolchain/${{ matrix.cfg.comp }}.${{ matrix.cfg.arch }}.cmake
- name: Compiling Unit Tests
run: cd build && ninja unit -j 2
run: cd build && ninja spy-test -j 2
- name: Running Unit Tests
run: cd build && ctest --output-on-failure -j 2

Expand All @@ -199,7 +199,7 @@ jobs:
cmake .. -G Ninja -DCMAKE_BUILD_TYPE="${{ matrix.cfg.mode }}" \
-DCMAKE_TOOLCHAIN_FILE=../test/toolchain/${{ matrix.cfg.comp }}.${{ matrix.cfg.arch }}.cmake
- name: Compiling Unit Tests
run: cd build && ninja unit -j 2
run: cd build && ninja spy-test -j 2
- name: Running Unit Tests
run: cd build && ctest --output-on-failure -j 2

Expand Down Expand Up @@ -233,6 +233,6 @@ jobs:
cmake .. -G Ninja -DCMAKE_BUILD_TYPE="${{ matrix.cfg.mode }}" \
-DCMAKE_TOOLCHAIN_FILE=../test/toolchain/${{ matrix.cfg.comp }}.${{ matrix.cfg.arch }}.cmake
- name: Compile Unit Tests
run: cd build && ninja unit -j 2
run: cd build && ninja spy-test -j 2
- name: Running Unit Tests
run: cd build && ctest --output-on-failure -j 2
108 changes: 58 additions & 50 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,65 +1,73 @@
##==================================================================================================
##======================================================================================================================
## SPY - C++ Informations Broker
## Copyright : SPY Project Contributors
## SPDX-License-Identifier: BSL-1.0
##==================================================================================================
cmake_minimum_required(VERSION 3.18)

## -------------------------------------------------------------------------------------------------
## Setup project
## -------------------------------------------------------------------------------------------------
##======================================================================================================================
cmake_minimum_required(VERSION 3.22)
project(spy LANGUAGES CXX)
set(PROJECT_VERSION 0.0.2.0)
set(PROJECT_DOC_DIR ${PROJECT_SOURCE_DIR}/doc)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake )

## -------------------------------------------------------------------------------------------------
## No in-source build
## -------------------------------------------------------------------------------------------------
if (${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "[spy]: In-source build is not recommend")
endif()
##======================================================================================================================
option( SPY_BUILD_TEST "Build tests for SPY" ON )
option( SPY_BUILD_DOCUMENTATION "Build Doxygen for SPY" OFF )

## -------------------------------------------------------------------------------------------------
## Options
## -------------------------------------------------------------------------------------------------
option( SPY_BUILD_TEST "Build tests for spy" ON )
##======================================================================================================================
include(${PROJECT_SOURCE_DIR}/cmake/dependencies.cmake)

## -------------------------------------------------------------------------------------------------
## Install target
## -------------------------------------------------------------------------------------------------
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/spy DESTINATION spy )
install(FILES ${PROJECT_SOURCE_DIR}/include/spy.hpp DESTINATION . )
if(SPY_BUILD_TEST)
include(${PROJECT_SOURCE_DIR}/cmake/compiler.cmake)
endif()

## -------------------------------------------------------------------------------------------------
## Standalone command
## -------------------------------------------------------------------------------------------------
find_package(Python COMPONENTS Interpreter)
##======================================================================================================================
## Project setup via copacabana
##======================================================================================================================
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake ${COPACABANA_SOURCE_DIR}/copacabana/cmake)
include(${COPACABANA_SOURCE_DIR}/copacabana/cmake/copacabana.cmake)
copa_project_version(MAJOR 1 MINOR 1 PATCH 0)

if(Python_FOUND)
add_custom_command(OUTPUT spy.hpp
COMMAND "${Python_EXECUTABLE}"
${CMAKE_CURRENT_SOURCE_DIR}/script/embed.py
${CMAKE_CURRENT_SOURCE_DIR}/src/spy.hpp
-I include
-o ${CMAKE_CURRENT_SOURCE_DIR}/include/spy.hpp
--include-match spy/*
--guard-match .*_HPP_INCLUDED

WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating standalone headers"
VERBATIM
)
##======================================================================================================================
## Summary Display
##======================================================================================================================
if(NOT SPY_QUIET)
if(CMAKE_BUILD_TYPE)
message(STATUS "[${PROJECT_NAME}] - Building in ${CMAKE_BUILD_TYPE} mode")
endif()
message(STATUS "[${PROJECT_NAME}] - Unit tests : ${SPY_BUILD_TEST} (via SPY_BUILD_TEST)")
message(STATUS "[${PROJECT_NAME}] - Doxygen : ${SPY_BUILD_DOCUMENTATION} (via SPY_BUILD_DOCUMENTATION)")
set(QUIET_OPTION "")
else()
set(QUIET_OPTION "QUIET")
endif()

add_custom_target(standalone DEPENDS spy.hpp)
set(SPY_FORCE_STANDALONE 1)
##======================================================================================================================
## Install Process setup
##======================================================================================================================
copa_setup_install( LIBRARY spy
FEATURES cxx_std_17
DOC ${PROJECT_SOURCE_DIR}/LICENSE.md
INCLUDE ${PROJECT_SOURCE_DIR}/include/spy
)

##======================================================================================================================
## Setup doxygen
##======================================================================================================================
if(SPY_BUILD_DOCUMENTATION)
copa_setup_doxygen(${QUIET_OPTION} TARGET spy-doxygen DESTINATION "${PROJECT_BINARY_DIR}/doc")
endif()

## -------------------------------------------------------------------------------------------------
## Test target
## -------------------------------------------------------------------------------------------------
if( SPY_BUILD_TEST )
include(CTest)
add_subdirectory(${PROJECT_SOURCE_DIR}/test/)
##======================================================================================================================
## Standalone generation
##======================================================================================================================
copa_setup_standalone ( QUIET
FILE spy.hpp SOURCE include DESTINATION standalone
ROOT spy TARGET spy-standalone
)

##======================================================================================================================
## Tests setup
##======================================================================================================================
if(SPY_BUILD_TEST)
enable_testing()
add_custom_target(spy-unit)
add_subdirectory(test)
endif()
29 changes: 29 additions & 0 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
##======================================================================================================================
## SPY - C++ Informations Broker
## Copyright : SPY Project Contributors
## SPDX-License-Identifier: BSL-1.0
##======================================================================================================================

##======================================================================================================================
## Compiler options for Tests
##======================================================================================================================
add_library(spy_tests INTERFACE)

target_compile_features ( spy_tests INTERFACE cxx_std_17 )

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
target_compile_options( spy_tests INTERFACE /W3 /EHsc )
else()
target_compile_options( spy_tests INTERFACE -Werror -Wall -Wextra -Wunused-variable -Wdocumentation)
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options( spy_tests INTERFACE /W3 /EHsc /Zc:preprocessor)
else()
target_compile_options( spy_tests INTERFACE -Werror -Wall -Wextra -Wunused-variable)
endif()

target_include_directories( spy_tests INTERFACE
${PROJECT_SOURCE_DIR}/test
${PROJECT_SOURCE_DIR}/include
)
33 changes: 33 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##======================================================================================================================
## SPY - C++ Informations Broker
## Copyright : SPY Project Contributors
## SPDX-License-Identifier: BSL-1.0
##======================================================================================================================

##======================================================================================================================
## Download and setup CPM
##======================================================================================================================
set(CPM_DOWNLOAD_VERSION 0.34.0)

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "[${PROJECT_NAME}] Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endif()

include(${CPM_DOWNLOAD_LOCATION})

##======================================================================================================================
## Retrieve dependencies
##======================================================================================================================
CPMAddPackage(NAME COPACABANA GITHUB_REPOSITORY jfalcou/copacabana GIT_TAG main)
Loading

0 comments on commit 43d4032

Please sign in to comment.