From 3b09103d9832c34023163d51dc9126853f2dfc1d Mon Sep 17 00:00:00 2001 From: MoAlyousef Date: Mon, 14 Sep 2020 15:22:41 +0300 Subject: [PATCH] add globbing, package components and options --- CHANGELOG.md | 6 ++++++ CMakeLists.txt | 19 ++++++++++--------- README.md | 8 ++++++-- include/cmake.hpp | 15 ++++++++++++++- include/literals.h | 2 ++ src/cmake.cpp | 36 ++++++++++++++++++++++++++++++++++-- src/gen.cpp | 40 +++++++++++++++++++++++++++++++++------- 7 files changed, 105 insertions(+), 21 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ababb85 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +## 0.1.0 - Unreleased +- Add support for globbing. +- Add support for find_package components. +- Add options. \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fbd3e8..60a50ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,19 +6,20 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) project(cmkr VERSION 0.1.0) + set(CMKRLIB_SOURCES - src/cmake.cpp - src/gen.cpp - src/help.cpp - src/build.cpp - src/error.cpp + "src/cmake.cpp" + "src/gen.cpp" + "src/help.cpp" + "src/build.cpp" + "src/error.cpp" ) add_library(cmkrlib STATIC ${CMKRLIB_SOURCES}) target_include_directories(cmkrlib PUBLIC - include - vendor + "include" + "vendor" ) target_compile_features(cmkrlib PUBLIC @@ -26,8 +27,8 @@ target_compile_features(cmkrlib PUBLIC ) set(CMKR_SOURCES - src/main.cpp - src/args.cpp + "src/main.cpp" + "src/args.cpp" ) add_executable(cmkr ${CMKR_SOURCES}) diff --git a/README.md b/README.md index 4828f98..514c2b8 100644 --- a/README.md +++ b/README.md @@ -68,15 +68,19 @@ name = "app" # required version = "0.1.0" # required [find-package] # optional, runs find_package, use "*" to ignore version -Boost = "1.74.0" # optional +Boost = { version = "1.74.0", required = false, components = ["system"] } # optional +spdlog = "*" [fetch-content] # optional, runs fetchContent toml11 = { GIT_REPOSITORY = "https://github.com/ToruNiina/toml11", GIT_TAG = "v3.5.0" } # optional +[options] # optional +APP_BUILD_STUFF = false # optional + [[bin]] # required, can define several binaries name = "app" # required type = "exe" # required (exe || shared || static) -sources = ["src/main.cpp"] # required +sources = ["src/*.cpp"] # required, supports globbing include-dirs = [] # optional features = [] # optional defines = [] # optional diff --git a/include/cmake.hpp b/include/cmake.hpp index 04c689a..c784b6a 100644 --- a/include/cmake.hpp +++ b/include/cmake.hpp @@ -6,6 +6,18 @@ namespace cmkr::cmake { +struct Option { + std::string name; + bool val; +}; + +struct Package { + std::string name; + std::string version; + bool required = true; + std::vector components; +}; + struct Bin { std::string name; std::string type; @@ -28,7 +40,8 @@ struct CMake { std::vector build_args; std::string proj_name; std::string proj_version; - std::map packages; + std::vector