From 0f02486d79010d7ae3859aa2820540daeee5965f Mon Sep 17 00:00:00 2001 From: Pagwin Date: Mon, 8 Apr 2024 13:46:02 -0400 Subject: [PATCH] initial commit --- .gitignore | 14 ++++++++++++++ CMakeLists.txt | 23 +++++++++++++++++++++++ apps/CMakeLists.txt | 8 ++++++++ apps/exe_entry.cpp | 4 ++++ src/CMakeLists.txt | 20 ++++++++++++++++++++ src/lib.cpp | 0 6 files changed, 69 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 apps/CMakeLists.txt create mode 100644 apps/exe_entry.cpp create mode 100644 src/CMakeLists.txt create mode 100644 src/lib.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..297406a --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +CMakeCache.txt +CMakeFiles/ +_deps/ +*.a +*.o +Makefile +apps/cmake_install.cmake +cmake_install.cmake +src/cmake_install.cmake +.ninja_deps +.ninja_log +build.ninja +build +.cache diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3171649 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +# This is a template I intend to use to create C++ cmake projects going forwards +# the structure takes heavily after https://cliutils.gitlab.io/modern-cmake/chapters/basics/structure.html +# This file takes heavily from https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/CMakeLists.txt + +cmake_minimum_required(VERSION 3.10) + +project(project_name_here + VERSION 0.1 + LANGUAGES CXX) + +# setting this so compile_commands.json is generated for clangd +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# for convenience if they're needed +#find_package(Boost REQUIRED) +#find_package(fmt REQUIRED) + +# lib src code +add_subdirectory(src) + +# app source code +add_subdirectory(apps) + diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt new file mode 100644 index 0000000..db89bb3 --- /dev/null +++ b/apps/CMakeLists.txt @@ -0,0 +1,8 @@ +# based heavily on https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/apps/CMakeLists.txt + +add_executable(exe_name exe_entry.cpp) + +# example library link +#target_link_libraries(exe_name fmt::fmt) + +target_compile_features(exe_name PRIVATE cxx_std_20) diff --git a/apps/exe_entry.cpp b/apps/exe_entry.cpp new file mode 100644 index 0000000..fe5388f --- /dev/null +++ b/apps/exe_entry.cpp @@ -0,0 +1,4 @@ +int main(void){ + + return 0; +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..b171187 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,20 @@ +# based heavily on https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt + +# example from when I was doing raft cpp impl +#set(HEADER_LIST "${raft_cpp_impl_SOURCE_DIR}/include/raft/lib.hpp") + +add_library(example_lib lib.cpp ${HEADER_LIST}) + +# We need this directory, and users of our library will need it too +target_include_directories(exaple_lib PUBLIC ../include) + + +#target_link_libraries(example_lib PRIVATE Boost::boost) + +target_compile_features(example_lib PUBLIC cxx_std_17) + +# IDEs should put the headers in a nice place +source_group( + TREE "${PROJECT_SOURCE_DIR}/include" + PREFIX "Header Files" + FILES ${HEADER_LIST}) diff --git a/src/lib.cpp b/src/lib.cpp new file mode 100644 index 0000000..e69de29