From 79c321197a97b766b983f23f3733e515c30ee2cc Mon Sep 17 00:00:00 2001 From: Krishna Ayyalasomayajula Date: Wed, 18 Feb 2026 19:02:57 -0600 Subject: [PATCH] base with spdlog --- .gitmodules | 3 ++ CMakeLists.txt | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ external/spdlog | 1 + 3 files changed, 78 insertions(+) create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 160000 external/spdlog diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6c66587 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/spdlog"] + path = external/spdlog + url = https://github.com/gabime/spdlog.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..20cbe4b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,74 @@ +cmake_minimum_required(VERSION 3.20) + +# -------------------------------------------------- +# Project +# -------------------------------------------------- +project(wolfram-engine-wrapper-client LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Default to Release if not specified +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# -------------------------------------------------- +# External dependency: spdlog +# -------------------------------------------------- +add_subdirectory(external/spdlog) + +# -------------------------------------------------- +# Executable +# -------------------------------------------------- +add_executable(${PROJECT_NAME} src/main.cpp) + +# -------------------------------------------------- +# Auto-discover include dirs under src/ +# -------------------------------------------------- +file(GLOB_RECURSE SRC_SUBDIRS LIST_DIRECTORIES true + "${CMAKE_CURRENT_SOURCE_DIR}/src/*" +) + +set(SRC_INCLUDES "") +foreach(dir ${SRC_SUBDIRS}) + if(IS_DIRECTORY ${dir}) + list(APPEND SRC_INCLUDES ${dir}) + endif() +endforeach() + +target_include_directories(${PROJECT_NAME} PRIVATE ${SRC_INCLUDES}) + +# -------------------------------------------------- +# Auto-discover all .cpp except main.cpp +# -------------------------------------------------- +file(GLOB_RECURSE ALL_CPP + "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" +) + +list(REMOVE_ITEM ALL_CPP + "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp" +) + +target_sources(${PROJECT_NAME} PRIVATE ${ALL_CPP}) + +# -------------------------------------------------- +# Link dependencies +# -------------------------------------------------- +target_link_libraries(${PROJECT_NAME} PRIVATE + spdlog::spdlog +) + +# -------------------------------------------------- +# Compiler warnings +# -------------------------------------------------- +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wpedantic + -Wconversion -Wshadow + -Wnull-dereference + -Wdouble-promotion + ) +endif() + diff --git a/external/spdlog b/external/spdlog new file mode 160000 index 0000000..fc7e9c8 --- /dev/null +++ b/external/spdlog @@ -0,0 +1 @@ +Subproject commit fc7e9c8721b95661cc40e2d1d2329677d2a21387