🎉 cmake cxx project.
parent
054e4b0df0
commit
cb314918f4
|
@ -0,0 +1,3 @@
|
||||||
|
*~*
|
||||||
|
*\#*
|
||||||
|
build
|
|
@ -0,0 +1,9 @@
|
||||||
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
|
project(gark-project
|
||||||
|
LANGUAGES CXX
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(lib)
|
||||||
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(tests)
|
|
@ -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,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
|
||||||
|
)
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "Module.hpp"
|
||||||
|
|
||||||
|
namespace gk
|
||||||
|
{
|
||||||
|
/*explicit*/ Module::Module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*virtual*/ Module::~Module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef gk_MODULE_HPP
|
||||||
|
#define gk_MODULE_HPP
|
||||||
|
|
||||||
|
namespace gk
|
||||||
|
{
|
||||||
|
class Module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Module();
|
||||||
|
virtual ~Module();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -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)
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -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
|
||||||
|
)
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
|
class trivialTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit trivialTest() {}
|
||||||
|
virtual ~trivialTest() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_CASE_METHOD(trivialTest, "trivial_")
|
||||||
|
{
|
||||||
|
REQUIRE(0 == 0);
|
||||||
|
}
|
Reference in New Issue