init
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.idea
|
||||||
|
cmake-build-*
|
||||||
16
CMakeLists.txt
Normal file
16
CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
cmake_minimum_required(VERSION 4.0)
|
||||||
|
project(edbg LANGUAGES CXX)
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(libedit REQUIRED IMPORTED_TARGET libedit)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(tools)
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
find_package(Catch2 CONFIG REQUIRED)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
8
include/libedbg/libedbg.hpp
Normal file
8
include/libedbg/libedbg.hpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef LIBEDBG_INCLUDE_LIBEDBG_H
|
||||||
|
#define LIBEDBG_INCLUDE_LIBEDBG_H
|
||||||
|
|
||||||
|
namespace edbg {
|
||||||
|
void hello();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //LIBEDBG_INCLUDE_LIBEDBG_H
|
||||||
39
src/CMakeLists.txt
Normal file
39
src/CMakeLists.txt
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
add_library(libedbg libedbg.cpp)
|
||||||
|
add_library(edbg::libedbg ALIAS libedbg)
|
||||||
|
|
||||||
|
set_target_properties(
|
||||||
|
libedbg
|
||||||
|
PROPERTIES OUTPUT_NAME edbg
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_features(libedbg PUBLIC cxx_std_20)
|
||||||
|
|
||||||
|
target_include_directories(
|
||||||
|
libedbg
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE::include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/src/include
|
||||||
|
)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(TARGETS libedbg
|
||||||
|
EXPORT edbg-targets
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
EXPORT edbg-targets
|
||||||
|
FILE edbg-config.cmake
|
||||||
|
NAMESPACE edbg::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/edbg
|
||||||
|
)
|
||||||
6
src/libedbg.cpp
Normal file
6
src/libedbg.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <libedbg/libedbg.hpp>
|
||||||
|
|
||||||
|
void edbg::hello() {
|
||||||
|
std::cout << "Hello edbg!\n";
|
||||||
|
}
|
||||||
2
test/CMakeLists.txt
Normal file
2
test/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
add_executable(tests tests.cpp)
|
||||||
|
target_link_libraries(tests PRIVATE edbg::libedbg Catch2::Catch2WithMain)
|
||||||
5
test/tests.cpp
Normal file
5
test/tests.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("validate environment") {
|
||||||
|
REQUIRE(true);
|
||||||
|
}
|
||||||
10
tools/CMakeLists.txt
Normal file
10
tools/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
add_executable(edbg edbg.cpp)
|
||||||
|
target_link_libraries(edbg PRIVATE edbg::libedbg)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(
|
||||||
|
TARGETS edbg
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(edbg PRIVATE edbg::libedbg PkgConfig::libedit)
|
||||||
5
tools/edbg.cpp
Normal file
5
tools/edbg.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include <libedbg/libedbg.hpp>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
edbg::hello();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user