You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
3.7 KiB
148 lines
3.7 KiB
4 years ago
|
#pragma once
|
||
|
|
||
|
#include <map>
|
||
4 years ago
|
#include <mpark/variant.hpp>
|
||
4 years ago
|
#include <stdexcept>
|
||
4 years ago
|
#include <string>
|
||
4 years ago
|
#include <tsl/ordered_map.h>
|
||
4 years ago
|
#include <vector>
|
||
4 years ago
|
|
||
4 years ago
|
namespace cmkr {
|
||
3 years ago
|
namespace parser {
|
||
4 years ago
|
|
||
4 years ago
|
struct Setting {
|
||
|
std::string name;
|
||
|
std::string comment;
|
||
4 years ago
|
mpark::variant<bool, std::string> val;
|
||
4 years ago
|
bool cache = false;
|
||
|
bool force = false;
|
||
|
};
|
||
|
|
||
4 years ago
|
struct Option {
|
||
|
std::string name;
|
||
4 years ago
|
std::string comment;
|
||
4 years ago
|
bool val = false;
|
||
4 years ago
|
};
|
||
|
|
||
|
struct Package {
|
||
|
std::string name;
|
||
|
std::string version;
|
||
|
bool required = true;
|
||
4 years ago
|
bool config = true;
|
||
4 years ago
|
std::vector<std::string> components;
|
||
|
};
|
||
|
|
||
4 years ago
|
struct Vcpkg {
|
||
4 years ago
|
std::string version;
|
||
4 years ago
|
std::string url;
|
||
4 years ago
|
std::vector<std::string> packages;
|
||
|
};
|
||
|
|
||
4 years ago
|
enum TargetType {
|
||
|
target_executable,
|
||
|
target_library,
|
||
|
target_shared,
|
||
|
target_static,
|
||
|
target_interface,
|
||
|
target_custom,
|
||
|
};
|
||
|
|
||
4 years ago
|
template <typename T>
|
||
|
using Condition = tsl::ordered_map<std::string, T>;
|
||
|
|
||
|
using ConditionVector = Condition<std::vector<std::string>>;
|
||
|
|
||
4 years ago
|
struct Target {
|
||
4 years ago
|
std::string name;
|
||
4 years ago
|
TargetType type = {};
|
||
4 years ago
|
|
||
3 years ago
|
ConditionVector headers;
|
||
|
ConditionVector sources;
|
||
|
|
||
4 years ago
|
// https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#project-commands
|
||
4 years ago
|
ConditionVector compile_definitions;
|
||
3 years ago
|
ConditionVector private_compile_definitions;
|
||
|
|
||
4 years ago
|
ConditionVector compile_features;
|
||
3 years ago
|
ConditionVector private_compile_features;
|
||
|
|
||
4 years ago
|
ConditionVector compile_options;
|
||
3 years ago
|
ConditionVector private_compile_options;
|
||
|
|
||
4 years ago
|
ConditionVector include_directories;
|
||
3 years ago
|
ConditionVector private_include_directories;
|
||
|
|
||
4 years ago
|
ConditionVector link_directories;
|
||
3 years ago
|
ConditionVector private_link_directories;
|
||
|
|
||
4 years ago
|
ConditionVector link_libraries;
|
||
3 years ago
|
ConditionVector private_link_libraries;
|
||
|
|
||
4 years ago
|
ConditionVector link_options;
|
||
3 years ago
|
ConditionVector private_link_options;
|
||
|
|
||
4 years ago
|
ConditionVector precompile_headers;
|
||
3 years ago
|
ConditionVector private_precompile_headers;
|
||
4 years ago
|
|
||
3 years ago
|
std::string condition;
|
||
4 years ago
|
std::string alias;
|
||
3 years ago
|
Condition<tsl::ordered_map<std::string, std::string>> properties;
|
||
4 years ago
|
|
||
4 years ago
|
Condition<std::string> cmake_before;
|
||
|
Condition<std::string> cmake_after;
|
||
|
ConditionVector include_before;
|
||
|
ConditionVector include_after;
|
||
4 years ago
|
};
|
||
|
|
||
4 years ago
|
struct Test {
|
||
|
std::string name;
|
||
4 years ago
|
std::vector<std::string> configurations;
|
||
|
std::string working_directory;
|
||
|
std::string command;
|
||
|
std::vector<std::string> arguments;
|
||
4 years ago
|
};
|
||
|
|
||
4 years ago
|
struct Install {
|
||
|
std::vector<std::string> targets;
|
||
|
std::vector<std::string> files;
|
||
|
std::vector<std::string> dirs;
|
||
|
std::vector<std::string> configs;
|
||
|
std::string destination;
|
||
|
};
|
||
|
|
||
3 years ago
|
struct Project {
|
||
4 years ago
|
// This is the CMake version required to use all cmkr versions.
|
||
|
std::string cmake_version = "3.15";
|
||
|
std::string cmkr_include = "cmkr.cmake";
|
||
4 years ago
|
std::string build_dir = "build";
|
||
4 years ago
|
std::string generator;
|
||
4 years ago
|
std::string config;
|
||
4 years ago
|
Condition<std::vector<std::string>> subdirs;
|
||
4 years ago
|
std::vector<std::string> cppflags;
|
||
|
std::vector<std::string> cflags;
|
||
|
std::vector<std::string> linkflags;
|
||
|
std::vector<std::string> gen_args;
|
||
|
std::vector<std::string> build_args;
|
||
4 years ago
|
std::string project_name;
|
||
|
std::string project_version;
|
||
4 years ago
|
std::string project_description;
|
||
|
std::vector<std::string> project_languages;
|
||
4 years ago
|
Condition<std::string> cmake_before;
|
||
|
Condition<std::string> cmake_after;
|
||
|
ConditionVector include_before;
|
||
|
ConditionVector include_after;
|
||
4 years ago
|
std::vector<Setting> settings;
|
||
4 years ago
|
std::vector<Option> options;
|
||
|
std::vector<Package> packages;
|
||
4 years ago
|
Vcpkg vcpkg;
|
||
4 years ago
|
tsl::ordered_map<std::string, std::map<std::string, std::string>> contents;
|
||
4 years ago
|
std::vector<Target> targets;
|
||
4 years ago
|
std::vector<Test> tests;
|
||
4 years ago
|
std::vector<Install> installs;
|
||
4 years ago
|
tsl::ordered_map<std::string, std::string> conditions;
|
||
|
|
||
3 years ago
|
Project(const std::string &path, bool build);
|
||
4 years ago
|
};
|
||
|
|
||
3 years ago
|
} // namespace parser
|
||
4 years ago
|
} // namespace cmkr
|