Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CMakeLists.txt linguist-generated
12 changes: 11 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push, pull_request]

jobs:
build:
# Skip building pull requests from the same repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != '${{ github.repository }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -14,10 +16,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install"
cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
cmake --install build --config ${{ env.BUILD_TYPE }}

- name: Check if cmkr was run
run: |
./install/bin/cmkr gen
git diff --exit-code

- name: Test
run: |
cd build/tests
Expand Down
76 changes: 27 additions & 49 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 3 additions & 13 deletions cmake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@
version = "2.8...3.8"

[project]
cmake-before = """
# Hack to hide a warning during cmkr bootstrapping on Windows
if(CMAKE_BUILD_TYPE)
endif()
"""
name = "cmkr"
version = "0.1.4"
description = "CMakeLists generator from TOML"
languages = ["CXX"]
subdirs = ["third_party", "tests"]

[target.cmkrlib]
type = "static"
sources = ["src/cmkrlib/*.cpp", "src/cmkrlib/*.hpp", "include/*.h"]
[target.cmkr]
type = "executable"
sources = ["src/*.cpp", "include/*.hpp"]
include-directories = ["include"]
compile-features = ["cxx_std_11"]
link-libraries = ["toml11", "ghc_filesystem", "mpark_variant", "ordered_map"]

[target.cmkr]
type = "executable"
sources = ["src/main.cpp"]
link-libraries = ["cmkrlib"]

[[install]]
targets = ["cmkr"]
destination = "${CMAKE_INSTALL_PREFIX}/bin"
1 change: 1 addition & 0 deletions cmake/cmkr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ else()
)
message(STATUS "[cmkr] Building cmkr...")
cmkr_exec("${CMAKE_COMMAND}"
--no-warn-unused-cli
"${CMKR_DIRECTORY}"
"-B${CMKR_DIRECTORY}/build"
"-DCMAKE_BUILD_TYPE=Release"
Expand Down
8 changes: 0 additions & 8 deletions include/args.h → include/args.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#ifdef __cplusplus
namespace cmkr {
namespace args {

Expand All @@ -9,11 +8,4 @@ const char *handle_args(int argc, char **argv);
} // namespace args
} // namespace cmkr

extern "C" {
#endif

const char *cmkr_args_handle_args(int, char **);

#ifdef __cplusplus
}
#endif
12 changes: 2 additions & 10 deletions include/build.h → include/build.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#ifdef __cplusplus

namespace cmkr {
namespace build {

Expand All @@ -13,15 +11,9 @@ int install();

} // namespace build
} // namespace cmkr
extern "C" {
#endif

int cmkr_build_run(int argc, char **argv);

int cmkr_build_clean(void);

int cmkr_build_install(void);
int cmkr_build_clean();

#ifdef __cplusplus
}
#endif
int cmkr_build_install();
File renamed without changes.
File renamed without changes.
8 changes: 0 additions & 8 deletions include/error.h → include/error.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#ifdef __cplusplus
namespace cmkr {
namespace error {

Expand All @@ -25,11 +24,4 @@ struct Status {
} // namespace error
} // namespace cmkr

extern "C" {
#endif

const char *cmkr_error_status_string(int);

#ifdef __cplusplus
}
#endif
File renamed without changes.
8 changes: 0 additions & 8 deletions include/gen.h → include/gen.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#ifdef __cplusplus
namespace cmkr {
namespace gen {

Expand All @@ -11,13 +10,6 @@ int generate_cmake(const char *path, bool root = true);
} // namespace gen
} // namespace cmkr

extern "C" {
#endif

int cmkr_gen_generate_project(const char *typ);

int cmkr_gen_generate_cmake(const char *path);

#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions include/help.h → include/help.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#ifdef __cplusplus
namespace cmkr {
namespace help {

Expand All @@ -11,13 +10,6 @@ const char *message() noexcept;
} // namespace help
} // namespace cmkr

extern "C" {
#endif

const char *cmkr_help_version(void);

const char *cmkr_help_message(void);

#ifdef __cplusplus
}
#endif
File renamed without changes.
8 changes: 4 additions & 4 deletions src/cmkrlib/args.cpp → src/args.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "args.h"
#include "build.h"
#include "gen.h"
#include "help.h"
#include "args.hpp"
#include "build.hpp"
#include "gen.hpp"
#include "help.hpp"

#include "fs.hpp"
#include <exception>
Expand Down
8 changes: 4 additions & 4 deletions src/cmkrlib/build.cpp → src/build.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "build.h"
#include "build.hpp"
#include "cmake.hpp"
#include "error.h"
#include "gen.h"
#include "error.hpp"
#include "gen.hpp"

#include "fs.hpp"
#include <sstream>
Expand All @@ -16,7 +16,7 @@ namespace build {
int run(int argc, char **argv) {
cmake::CMake cmake(".", true);
if (argc > 2) {
for (size_t i = 2; i < argc; ++i) {
for (int i = 2; i < argc; ++i) {
cmake.build_args.push_back(argv[i]);
}
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cmkrlib/error.cpp → src/error.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "error.h"
#include "error.hpp"

#include <assert.h>

Expand Down
6 changes: 3 additions & 3 deletions src/cmkrlib/gen.cpp → src/gen.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "gen.h"
#include "gen.hpp"
#include "cmake.hpp"
#include "error.h"
#include "literals.h"
#include "error.hpp"
#include "literals.hpp"

#include "fs.hpp"
#include <cassert>
Expand Down
2 changes: 1 addition & 1 deletion src/cmkrlib/help.cpp → src/help.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "help.h"
#include "help.hpp"

namespace cmkr {
namespace help {
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "args.h"
#include "args.hpp"

#include <cstdio>
#include <cstdlib>
Expand Down