Add SDK v1.0.0
This commit is contained in:
commit
40688938ef
76 files changed
+11805
No files matched your search
@@ -0,0 +1,49 @@
|
||||
# fmt: fetched from source at the pinned tag, unless an installed copy that
|
||||
# is at least version 12 is found first.
|
||||
#
|
||||
# GIT_TAG 12.1.0 the version this template is built and tested
|
||||
# with. Anything older than 11.1 does not compile
|
||||
# with Clang >= 21 (including clang-cl): its
|
||||
# FMT_STRING macro, used inside fmt's own sources,
|
||||
# is rejected as "not a constant expression"
|
||||
# (fmtlib/fmt#4807). 12.x also drops the
|
||||
# fmt::format-via-<fmt/core.h> shim, which is why
|
||||
# Greeting.cpp includes <fmt/format.h>.
|
||||
# Deliberately not the newest release, 12.2.0:
|
||||
# that one doesn't compile for 32-bit x86
|
||||
# (windows-x86-mingw32) -- its fallback for a
|
||||
# missing __int128 lacks operator~ -- and the
|
||||
# fix, fmtlib/fmt#4813, landed on main after the
|
||||
# tag. Move up once a release contains it.
|
||||
# FIND_PACKAGE_ARGS 12 ... the "12" is a minimum version for an installed
|
||||
# copy. Without it ANY installed fmt beats the
|
||||
# pin -- distro packages are old (Ubuntu 24.04
|
||||
# ships 9.1, 26.04 ships 10.1) and would quietly
|
||||
# bring the Clang >= 21 failure back.
|
||||
# GIT_SHALLOW TRUE every preset has its own build directory (and
|
||||
# so its own _deps/), so keep each fetch small.
|
||||
#
|
||||
# FMT_MODULE OFF fmt 12 turns its C++20 named-module library on
|
||||
# BY DEFAULT whenever CMake >= 3.28, C++20, Ninja
|
||||
# >= 1.11 and Clang >= 16 / GCC >= 15 / MSVC >= 19.34 are all
|
||||
# in play -- which this project's setup is, on
|
||||
# most machines. That adds a module-interface
|
||||
# build nothing here uses, and needs module
|
||||
# dependency scanning (clang-scan-deps for
|
||||
# Clang, which e.g. Ubuntu's plain `clang`
|
||||
# package doesn't include). Cached without FORCE
|
||||
# so an explicit -DFMT_MODULE=ON still wins.
|
||||
set(FMT_MODULE OFF CACHE BOOL
|
||||
"Build fmt's C++20 named-module library (not used by this project)")
|
||||
|
||||
add_dependency(fmt
|
||||
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
|
||||
GIT_TAG 12.1.0
|
||||
GIT_SHALLOW TRUE
|
||||
FIND_PACKAGE_ARGS 12 NAMES fmt
|
||||
)
|
||||
|
||||
# core_farewell is an objects module (source/CoreFarewell): a piece of this
|
||||
# library with a module of its own. Naming it here is all it takes for its
|
||||
# object files to go into demo_core and its header to reach core_lib's users.
|
||||
add_lib_module(core_lib TYPE SHARED OUTPUT_NAME "demo_core" DEPENDS fmt::fmt core_farewell)
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
/// @file
|
||||
/// Tiny "core" module shared by every executable module in this demo.
|
||||
/// Registered as a library module in source/Core/CMakeLists.txt -- see
|
||||
/// that file for how its build type (STATIC/SHARED) and its fmt
|
||||
/// dependency are declared. The farewell half is a piece of it kept in
|
||||
/// its own objects module, source/CoreFarewell (core/Farewell.hpp).
|
||||
namespace demo::core
|
||||
{
|
||||
|
||||
/// Builds a greeting for @p name.
|
||||
///
|
||||
/// @param name the person (or thing) being greeted.
|
||||
/// @return a formatted greeting string, e.g. "Hello, Ale! (from demo_core)".
|
||||
std::string makeGreeting(const std::string& name);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "core/Greeting.hpp"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace demo::core
|
||||
{
|
||||
|
||||
std::string makeGreeting(const std::string& name)
|
||||
{
|
||||
return fmt::format("Hello, {}! (from {})", name, MODULE_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user