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.
chore: Refactor work and squash for an initial release
Signed-off-by: Gordon Smith <[email protected]>
- Loading branch information
1 parent
88a9fa7
commit 13e431a
Showing
79 changed files
with
6,976 additions
and
743 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
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.