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.
- Loading branch information
1 parent
88a9fa7
commit 4d12b19
Showing
18 changed files
with
2,441 additions
and
210 deletions.
There are no files selected for viewing
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,3 @@ | ||
[submodule "vcpkg"] | ||
path = vcpkg | ||
url = https://github.com/microsoft/vcpkg.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) |
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,220 @@ | ||
{ | ||
"version": 3, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 22, | ||
"patch": 1 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "default" | ||
}, | ||
{ | ||
"name": "vcpkg", | ||
"displayName": "vcpkg", | ||
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake", | ||
"binaryDir": "${sourceDir}/build", | ||
"installDir": "${sourceDir}/build/stage", | ||
"cacheVariables": {}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "ninja", | ||
"generator": "Ninja", | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "debug", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "release", | ||
"binaryDir": "${sourceDir}/build/Release", | ||
"installDir": "${sourceDir}/build/Release/stage", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "relwithdebinfo", | ||
"binaryDir": "${sourceDir}/build/RelWithDebInfo", | ||
"installDir": "${sourceDir}/build/RelWithDebInfo/stage", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "RelWithDebInfo" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "ubuntu", | ||
"cacheVariables": { | ||
"USE_OPTIONAL": "OFF", | ||
"USE_CPPUNIT": "ON", | ||
"INCLUDE_PLUGINS": "ON", | ||
"SUPPRESS_V8EMBED": "ON", | ||
"SUPPRESS_REMBED": "ON" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "windows", | ||
"cacheVariables": { | ||
"USE_OPTIONAL": "OFF", | ||
"CLIENTTOOLS_ONLY": "ON", | ||
"USE_AZURE": "OFF", | ||
"USE_CASSANDRA": "OFF", | ||
"USE_JAVA": "OFF", | ||
"USE_OPENLDAP": "OFF" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "ubuntu-ninja", | ||
"inherits": [ | ||
"vcpkg", | ||
"ninja", | ||
"ubuntu" | ||
] | ||
}, | ||
{ | ||
"name": "ubuntu-ninja-debug", | ||
"inherits": [ | ||
"ubuntu-ninja", | ||
"debug" | ||
] | ||
}, | ||
{ | ||
"name": "ubuntu-ninja-debug-minimal", | ||
"inherits": [ | ||
"ubuntu-ninja", | ||
"debug" | ||
], | ||
"cacheVariables": { | ||
"USE_CPPUNIT": "OFF", | ||
"INCLUDE_PLUGINS": "OFF" | ||
} | ||
}, | ||
{ | ||
"name": "ubuntu-ninja-release", | ||
"inherits": [ | ||
"ubuntu-ninja", | ||
"release" | ||
] | ||
}, | ||
{ | ||
"name": "ubuntu-ninja-relwithdebinfo", | ||
"inherits": [ | ||
"ubuntu-ninja", | ||
"relwithdebinfo" | ||
] | ||
}, | ||
{ | ||
"name": "VS-16", | ||
"generator": "Visual Studio 16 2019", | ||
"architecture": { | ||
"strategy": "set", | ||
"value": "x64" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "VS-17", | ||
"generator": "Visual Studio 17 2022", | ||
"architecture": { | ||
"strategy": "set", | ||
"value": "x64" | ||
}, | ||
"toolset": { | ||
"strategy": "set", | ||
"value": "host=x64" | ||
}, | ||
"hidden": true | ||
}, | ||
{ | ||
"name": "vcpkg-VS-16", | ||
"inherits": [ | ||
"vcpkg", | ||
"windows", | ||
"VS-16" | ||
] | ||
}, | ||
{ | ||
"name": "vcpkg-VS-17", | ||
"inherits": [ | ||
"vcpkg", | ||
"windows", | ||
"VS-17" | ||
] | ||
} | ||
], | ||
"buildPresets": [ | ||
{ | ||
"name": "ninja-linux", | ||
"condition": { | ||
"type": "equals", | ||
"lhs": "${hostSystemName}", | ||
"rhs": "Linux" | ||
}, | ||
"hidden": true, | ||
"nativeToolOptions": [] | ||
}, | ||
{ | ||
"name": "Ninja-Linux-Debug", | ||
"inherits": "Ninja-Linux", | ||
"configuration": "Debug" | ||
}, | ||
{ | ||
"name": "Ninja-Linux-Release", | ||
"inherits": "Ninja-Linux", | ||
"configuration": "Release" | ||
}, | ||
{ | ||
"name": "VS-16-Debug", | ||
"configurePreset": "vcpkg-VS-16", | ||
"configuration": "Debug", | ||
"jobs": 0, | ||
"nativeToolOptions": [ | ||
"-m" | ||
] | ||
}, | ||
{ | ||
"name": "VS-16-Release", | ||
"configurePreset": "vcpkg-VS-16", | ||
"configuration": "Release", | ||
"jobs": 0, | ||
"nativeToolOptions": [ | ||
"-m" | ||
] | ||
}, | ||
{ | ||
"name": "VS-17-Debug", | ||
"configurePreset": "vcpkg-VS-17", | ||
"configuration": "Debug", | ||
"jobs": 0, | ||
"nativeToolOptions": [ | ||
"-m" | ||
] | ||
}, | ||
{ | ||
"name": "VS-17-Release", | ||
"configurePreset": "vcpkg-VS-17", | ||
"configuration": "Release", | ||
"jobs": 0, | ||
"nativeToolOptions": [ | ||
"-m" | ||
] | ||
}, | ||
{ | ||
"name": "VS-17-RelWithDebInfo", | ||
"configurePreset": "vcpkg-VS-17", | ||
"configuration": "RelWithDebInfo", | ||
"jobs": 0, | ||
"nativeToolOptions": [ | ||
"-m" | ||
] | ||
} | ||
] | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.