Compare commits

...

3 Commits

2
CMakeLists.txt generated

@ -23,6 +23,8 @@ if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY) configure_file(cmake.toml cmake.toml COPYONLY)
endif() endif()
include("cmake/O2.cmake")
project(cmkr project(cmkr
LANGUAGES LANGUAGES
CXX CXX

@ -7,6 +7,7 @@ version = "0.1.4"
description = "CMakeLists generator from TOML" description = "CMakeLists generator from TOML"
languages = ["CXX"] languages = ["CXX"]
subdirs = ["third_party", "tests"] subdirs = ["third_party", "tests"]
include-before = ["cmake/O2.cmake"]
[target.cmkr] [target.cmkr]
type = "executable" type = "executable"

@ -0,0 +1,6 @@
# Modify compile flags to change optimization level from O3 to O2
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "/Od /Ob2 /DNDEBUG")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
endif()

@ -34,7 +34,11 @@ struct Package {
struct Vcpkg { struct Vcpkg {
std::string version; std::string version;
std::string triplet;
std::vector<std::string> packages; std::vector<std::string> packages;
std::vector<std::string> ports;
std::vector<std::string> overlay_ports;
std::vector<std::string> overlay_triplets;
}; };
enum TargetType { enum TargetType {

@ -33,6 +33,7 @@ static EnumType to_enum(const std::string &str, const std::string &help_name) {
return value; return value;
} }
// If the key is found, get strongly-typed value (throws on user-error)
template <typename T> template <typename T>
static void get_optional(const TomlBasicValue &v, const toml::key &ky, T &destination); static void get_optional(const TomlBasicValue &v, const toml::key &ky, T &destination);
@ -249,6 +250,8 @@ CMake::CMake(const std::string &path, bool build) {
const auto &v = toml::find(toml, "vcpkg"); const auto &v = toml::find(toml, "vcpkg");
vcpkg.version = toml::find(v, "version").as_string(); vcpkg.version = toml::find(v, "version").as_string();
vcpkg.packages = toml::find<decltype(vcpkg.packages)>(v, "packages"); vcpkg.packages = toml::find<decltype(vcpkg.packages)>(v, "packages");
get_optional(v, "overlay-ports", vcpkg.overlay_ports);
get_optional(v, "overlay-triplets", vcpkg.overlay_triplets);
// This allows the user to use a custom pmm version if desired // This allows the user to use a custom pmm version if desired
if (contents.count("pmm") == 0) { if (contents.count("pmm") == 0) {

@ -526,7 +526,11 @@ int generate_cmake(const char *path, bool root) {
cmd("include")("${pmm_SOURCE_DIR}/pmm.cmake"); cmd("include")("${pmm_SOURCE_DIR}/pmm.cmake");
tsl::ordered_map<std::string, std::vector<std::string>> vcpkg_args; tsl::ordered_map<std::string, std::vector<std::string>> vcpkg_args;
vcpkg_args["REVISION"] = {cmake.vcpkg.version}; vcpkg_args["REVISION"] = {cmake.vcpkg.version};
vcpkg_args["TRIPLET"] = {cmake.vcpkg.triplet};
vcpkg_args["REQUIRES"] = cmake.vcpkg.packages; vcpkg_args["REQUIRES"] = cmake.vcpkg.packages;
vcpkg_args["PORTS"] = cmake.vcpkg.ports;
vcpkg_args["OVERLAY_PORTS"] = cmake.vcpkg.overlay_ports;
vcpkg_args["OVERLAY_TRIPLETS"] = cmake.vcpkg.overlay_triplets;
auto vcpkg = std::make_pair("VCPKG", vcpkg_args); auto vcpkg = std::make_pair("VCPKG", vcpkg_args);
cmd("pmm")(vcpkg).endl(); cmd("pmm")(vcpkg).endl();
} }

@ -0,0 +1,16 @@
[cmake]
version = "3.15"
[project]
name = "vcpkg_template"
#[fetch-content]
#cmkr-issue-repoA = { git = "https://github.com/darknessxk/cmkr-issue-repoA.git" }
[vcpkg]
version = "2020.11"
packages = ["fmt", "sqlite3"]
[find-package]
fmt = { version = "*" }
unofficial-sqlite3 = { version = "*" }

@ -0,0 +1,10 @@
[project]
name = "vcpkg_template"
[vcpkg]
version = "2020.11"
packages = ["fmt", "sqlite3"]
[find-package]
fmt = { version = "*" }
unofficial-sqlite3 = { version = "*" }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save