🎉 cmake cxx project.

main
bog 2024-02-21 20:48:17 +01:00
parent 054e4b0df0
commit cb314918f4
11 changed files with 129 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*~*
*\#*
build

9
CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.2)
project(gark-project
LANGUAGES CXX
)
add_subdirectory(lib)
add_subdirectory(src)
add_subdirectory(tests)

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
.PHONY: build tests install
build:
cmake -B build
cmake --build build
tests: build
build/gark-tests
install: tests
sudo cmake --install build
force-install:
sudo cmake --install build

0
doc/grammar.bnf Normal file
View File

15
lib/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.2)
project(gark-lib
LANGUAGES CXX
)
add_library(gark-lib
Module.cpp
)
set_property(TARGET gark-lib PROPERTY CXX_STANDARD 17)
target_compile_options(gark-lib
PUBLIC -Wall -Wextra
)

12
lib/Module.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "Module.hpp"
namespace gk
{
/*explicit*/ Module::Module()
{
}
/*virtual*/ Module::~Module()
{
}
}

16
lib/Module.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef gk_MODULE_HPP
#define gk_MODULE_HPP
namespace gk
{
class Module
{
public:
explicit Module();
virtual ~Module();
private:
};
}
#endif

19
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.2)
project(gark
LANGUAGES CXX
)
add_executable(gark
main.cpp
)
add_dependencies(gark gark-lib)
set_property(TARGET gark PROPERTY CXX_STANDARD 17)
target_link_libraries(gark
PRIVATE gark-lib
)
install(TARGETS gark)

6
src/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main()
{
return 0;
}

20
tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.2)
project(gark-tests
LANGUAGES CXX
)
add_executable(gark-tests
trivial.cpp
)
add_dependencies(gark-tests gark-lib)
set_property(TARGET gark-tests PROPERTY CXX_STANDARD 17)
find_package(Catch2 REQUIRED)
target_link_libraries(gark-tests
PRIVATE gark-lib
PRIVATE Catch2::Catch2WithMain
)

15
tests/trivial.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <catch2/catch.hpp>
class trivialTest
{
public:
explicit trivialTest() {}
virtual ~trivialTest() {}
protected:
};
TEST_CASE_METHOD(trivialTest, "trivial_")
{
REQUIRE(0 == 0);
}