generated from TheLartians/ModernCppStarter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from GordonSmith/REFACTOR
chore: Refactor work and squash for an initial release
- Loading branch information
Showing
79 changed files
with
6,965 additions
and
745 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ name: Ubuntu | |
on: | ||
push: | ||
branches: | ||
- master | ||
- trunk | ||
- main | ||
pull_request: | ||
branches: | ||
- master | ||
- trunk | ||
- main | ||
|
||
env: | ||
|
@@ -21,22 +21,34 @@ 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" | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/build* | ||
/.vscode | ||
/cpm_modules | ||
.DS_Store | ||
/vcpkg_installed | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ---- | ||
|
||
|
@@ -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) |
Oops, something went wrong.