Skip to content

Commit

Permalink
chore: Refactor work and squash for an initial release
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Jun 4, 2024
1 parent 88a9fa7 commit 13e431a
Show file tree
Hide file tree
Showing 79 changed files with 6,976 additions and 743 deletions.
16 changes: 0 additions & 16 deletions .clang-format

This file was deleted.

57 changes: 0 additions & 57 deletions .cmake-format

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Install
on:
push:
branches:
- master
- trunk
- main
pull_request:
branches:
- master
- trunk
- main

env:
Expand All @@ -20,20 +20,26 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: install dependencies
run: |
sudo apt-get install ninja-build
- name: build and install library
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release
sudo cmake --build build --target install
rm -rf build
- name: configure
run: cmake -Stest -Bbuild -DTEST_INSTALLED_VERSION=1
run: cmake -Stest -Bbuild -DTEST_INSTALLED_VERSION=ON

- name: build
run: cmake --build build --config Debug -j4
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: MacOS
on:
push:
branches:
- master
- trunk
- main
pull_request:
branches:
- master
- trunk
- main

env:
Expand All @@ -20,19 +20,27 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: install dependencies
run: |
brew install ninja
- name: configure
run: cmake -Stest -Bbuild -DCMAKE_BUILD_TYPE=Debug
run: |
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug
- name: build
run: cmake --build build -j4
run: cmake --build build --parallel

- name: test
working-directory: build/test
run: |
cd build
ctest --build-config Debug
ctest
4 changes: 2 additions & 2 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Standalone
on:
push:
branches:
- master
- trunk
- main
pull_request:
branches:
- master
- trunk
- main

env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Style
on:
push:
branches:
- master
- trunk
- main
pull_request:
branches:
- master
- trunk
- main

env:
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Ubuntu
on:
push:
branches:
- master
- trunk
- main
pull_request:
branches:
- master
- trunk
- main

env:
Expand All @@ -21,22 +21,31 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: install dependencies
run: |
sudo apt-get install ninja-build
- name: configure
run: cmake -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug
run: |
cmake -G Ninja -S . -B build -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug
- name: build-wasm
run: ./test/wasm/build.sh

- name: build
run: cmake --build build -j4
run: cmake --build build --parallel

- name: test
run: |
cd build
ctest --build-config Debug
ctest --test-dir ./build/test
- name: collect code coverage
run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
16 changes: 10 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Windows
on:
push:
branches:
- master
- trunk
- main
pull_request:
branches:
- master
- trunk
- main

env:
Expand All @@ -20,19 +20,23 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: configure
run: cmake -Stest -Bbuild
run: |
cmake -S . -B build
- name: build
run: cmake --build build --config Debug -j4
run: cmake --build build --config Debug --parallel

- name: test
working-directory: build/test
run: |
cd build
ctest --build-config Debug
ctest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build*
/.vscode
/cpm_modules
.DS_Store
/vcpkg_installed
.DS_Store
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
[submodule "ref/component-model"]
path = ref/component-model
url = [email protected]:WebAssembly/component-model.git
75 changes: 10 additions & 65 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
cmake_minimum_required(VERSION 3.14...3.22)

# ---- Project ----
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VCPKG_FILES_DIR "${CMAKE_BINARY_DIR}" CACHE STRING "Folder for vcpkg download, build and installed files")
set(CMAKE_TOOLCHAIN_FILE ${ROOT_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(VCPKG_ROOT ${ROOT_DIR}/vcpkg)
set(VCPKG_INSTALLED_DIR "${VCPKG_FILES_DIR}/vcpkg_installed")
set(VCPKG_INSTALL_OPTIONS "--x-abi-tools-use-exact-versions;--downloads-root=${VCPKG_FILES_DIR}/vcpkg_downloads;--x-buildtrees-root=${VCPKG_FILES_DIR}/vcpkg_buildtrees;--x-packages-root=${VCPKG_FILES_DIR}/vcpkg_packages")
set(VCPKG_VERBOSE OFF)

# Note: update this to your new project's name and version
project(
Greeter
VERSION 1.0
LANGUAGES CXX
)
project(BuildAll LANGUAGES CXX)

# ---- Include guards ----

Expand All @@ -18,61 +19,5 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
)
endif()

# ---- Add dependencies via CPM ----
# see https://github.com/TheLartians/CPM.cmake for more info

include(cmake/CPM.cmake)

# PackageProject.cmake will be used to make our target installable
CPMAddPackage("gh:TheLartians/[email protected]")

CPMAddPackage(
NAME fmt
GIT_TAG 9.1.0
GITHUB_REPOSITORY fmtlib/fmt
OPTIONS "FMT_INSTALL YES" # create an installable target
)

# ---- Add source files ----

# Note: globbing sources is considered bad practice as CMake's generators may not detect new files
# automatically. Keep that in mind when changing files, or explicitly mention them here.
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")

# ---- Create library ----

# Note: for header-only libraries change all PUBLIC flags to INTERFACE and create an interface
# target: add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME} ${headers} ${sources})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)

# being a cross-platform target, we enforce standards conformance on MSVC
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")

# Link dependencies
target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt)

target_include_directories(
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)

# ---- Create an installable target ----
# this allows users to install and find the library via `find_package()`.

# the location where the project's version header will be placed should match the project's regular
# header paths
string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION)

packageProject(
NAME ${PROJECT_NAME}
VERSION ${PROJECT_VERSION}
NAMESPACE ${PROJECT_NAME}
BINARY_DIR ${PROJECT_BINARY_DIR}
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
COMPATIBILITY SameMajorVersion
DEPENDENCIES "fmt 9.1.0"
)
add_subdirectory(src)
add_subdirectory(test)
Loading

0 comments on commit 13e431a

Please sign in to comment.