Skip to content

Commit

Permalink
[all] Implement runtime property
Browse files Browse the repository at this point in the history
  • Loading branch information
osdeverr committed Jun 1, 2024
1 parent 250e341 commit a7a1aaf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
7 changes: 7 additions & 0 deletions buildkit/re/deps/vcpkg_dep_resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ namespace re
auto re_platform = scope.ResolveLocal("platform");
auto re_config = scope.ResolveLocal("configuration");

auto lib_type = scope.ResolveLocal("vcpkg-library-type");

auto at_prefix = (dep.version.size() && dep.ns == "vcpkg") ? fmt::format("-{}", dep.version) : "";
// fmt::print(" / dbg - ns='{}' atp='{}'\n", dep.ns, at_prefix);

if (!lib_type.empty() && lib_type != "dynamic")
{
at_prefix = fmt::format("-{}", lib_type) + at_prefix;
}

auto cache_path = fmt::format("{}{}-{}-{}-{}", dep.name, at_prefix, re_arch, re_platform, re_config);

if (dep.extra_config_hash)
Expand Down
9 changes: 4 additions & 5 deletions buildkit/re/langs/cxx/cxx_lang_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ namespace re
auto &target_vars = target.target_var_scope.emplace(&target.local_var_ctx, "target", &target);
auto &vars = target.build_var_scope.emplace(&target.local_var_ctx, "build", &target_vars);

std::unordered_map<std::string, std::string> cond_desc = {{"target-type", TargetTypeToString(target.type)},
{"platform", vars.ResolveLocal("platform")},
{"host-platform", vars.ResolveLocal("host-platform")},
{"config", vars.ResolveLocal("configuration")},
{"load-context", vars.ResolveLocal("load-context")}};
std::unordered_map<std::string, std::string> cond_desc = {
{"target-type", TargetTypeToString(target.type)}, {"platform", vars.ResolveLocal("platform")},
{"host-platform", vars.ResolveLocal("host-platform")}, {"config", vars.ResolveLocal("configuration")},
{"load-context", vars.ResolveLocal("load-context")}, {"runtime", vars.ResolveLocal("runtime")}};

target.resolved_config = GetResolvedTargetCfg(target, cond_desc);

Expand Down
31 changes: 29 additions & 2 deletions resources/data/core-project/re.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ config.release.debinfo:
cxx-build-options:
cxx-exceptions: on

# By default, use the dynamic runtime.
runtime: dynamic

runtime.static:
vcpkg-library-type: static

runtime.dynamic:
vcpkg-library-type: dynamic

# Thanks K2Re8 for the right flags!
cxxenv.msvc|clang-cl:
config.release:
Expand All @@ -146,8 +155,6 @@ cxxenv.msvc|clang-cl:
msvc.optimization-generate-intrinsics: true
msvc.buffer-security-check: false

msvc.runtime-library: multithreaded-dll

msvc.whole-program-optimization: true

build-debug-info: true
Expand All @@ -156,6 +163,24 @@ cxxenv.msvc|clang-cl:
cxx-build-options:
msvc.runtime-library: multithreaded-dll-debug

runtime.static:
config.release:
cxx-build-options:
msvc.runtime-library: multithreaded-static

config.debug:
cxx-build-options:
msvc.runtime-library: multithreaded-static-debug

runtime.dynamic:
config.release:
cxx-build-options:
msvc.runtime-library: multithreaded-dll

config.debug:
cxx-build-options:
msvc.runtime-library: multithreaded-dll-debug

cxx-build-options:
warning-level: 3
build-link-debug-info: true
Expand Down Expand Up @@ -211,3 +236,5 @@ load-context.standalone:

package-sources:
re: https://re.plakmp.com

vcpkg-library-type: dynamic

0 comments on commit a7a1aaf

Please sign in to comment.