commit 4910cb43e525e1fc924c779d6803e13b73f7e3a7 Author: Green Sky Date: Sat Oct 21 23:16:20 2023 +0200 initial setup with deps diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56f48bf --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +.vs/ +*.o +*.swp +~* +*~ +.idea/ +cmake-build-debug/ +cmake-build-debugandtest/ +cmake-build-release/ +*.stackdump +*.coredump +compile_commands.json +/build* +/result* +.clangd +.cache + +.DS_Store +.AppleDouble +.LSOverride + +CMakeLists.txt.user* +CMakeCache.txt + +*.tox +imgui.ini diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..57e906f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "external/solanaceae_message3"] + path = external/solanaceae_message3 + url = https://github.com/Green-Sky/solanaceae_message3.git +[submodule "external/entt/entt"] + path = external/entt/entt + url = https://github.com/skypjack/entt.git +[submodule "external/solanaceae_util"] + path = external/solanaceae_util + url = https://github.com/Green-Sky/solanaceae_util.git +[submodule "external/solanaceae_contact"] + path = external/solanaceae_contact + url = https://github.com/Green-Sky/solanaceae_contact.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..120714b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +# cmake setup begin +project(solanaceae_clamav) + +if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(SOLANACEAE_CLAMAV_STANDALONE ON) +else() + set(SOLANACEAE_CLAMAV_STANDALONE OFF) +endif() + +if (SOLANACEAE_CLAMAV_STANDALONE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # defaulting to debug mode, if not specified + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") + endif() + + # setup my vim ycm :D + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + + # more paths + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +endif() + +# external libs +add_subdirectory(./external) # before increasing warn levels, sad :( + +if (SOLANACEAE_CLAMAV_STANDALONE) + + set(CMAKE_CXX_EXTENSIONS OFF) + + # bump up warning levels appropriately for clang, gcc & msvc + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + add_compile_options( + -Wall -Wextra # Reasonable and standard + -Wpedantic # Warn if non-standard C++ is used + -Wunused # Warn on anything being unused + #-Wconversion # Warn on type conversions that may lose data + #-Wsign-conversion # Warn on sign conversions + -Wshadow # Warn if a variable declaration shadows one from a parent context + ) + + if (NOT WIN32) + #link_libraries(-fsanitize=address,undefined) + #link_libraries(-fsanitize=undefined) + endif() + elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") + if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() + endif() + +endif() + +# cmake setup end + +add_subdirectory(./src) +#add_subdirectory(./plugins) + diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 0000000..1c00676 --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.24 FATAL_ERROR) + + +add_subdirectory(./solanaceae_util) +#add_subdirectory(./solanaceae_plugin) + +add_subdirectory(./entt) + +add_subdirectory(./solanaceae_contact) +add_subdirectory(./solanaceae_message3) + +# TODO: move to clamav.cmake +find_package(PkgConfig QUIET) +if (PKG_CONFIG_FOUND) + pkg_check_modules(PKGC_CLAMAV QUIET IMPORTED_TARGET libclamav) + + if (PKGC_CLAMAV_FOUND) + add_library(libclamav ALIAS PkgConfig::PKGC_CLAMAV) + message("II libclamav found using pkg-config") + endif() +endif() + +if (NOT TARGET libclamav) + include(FetchContent) + set(ENABLE_LIBCLAMAV_ONLY ON) + set(ENABLE_APP OFF) + set(ENABLE_TESTS OFF) + FetchContent_Declare(clamav + GIT_REPOSITORY https://github.com/Cisco-Talos/clamav.git + GIT_TAG clamav-1.2.0 + + # find_package is tried first + FIND_PACKAGE_ARGS NAMES libclamav + ) + + FetchContent_MakeAvailable(clamav) +endif() + diff --git a/external/entt/CMakeLists.txt b/external/entt/CMakeLists.txt new file mode 100644 index 0000000..abbae8d --- /dev/null +++ b/external/entt/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +add_subdirectory(./entt EXCLUDE_FROM_ALL) + diff --git a/external/entt/entt b/external/entt/entt new file mode 160000 index 0000000..344e03a --- /dev/null +++ b/external/entt/entt @@ -0,0 +1 @@ +Subproject commit 344e03ac64a1f78424ab1150e2d4778e8df8431d diff --git a/external/solanaceae_contact b/external/solanaceae_contact new file mode 160000 index 0000000..5ff7d1c --- /dev/null +++ b/external/solanaceae_contact @@ -0,0 +1 @@ +Subproject commit 5ff7d1cee0c3ed22f9fe7d66021d95ad1c5a3f04 diff --git a/external/solanaceae_message3 b/external/solanaceae_message3 new file mode 160000 index 0000000..48fb5f0 --- /dev/null +++ b/external/solanaceae_message3 @@ -0,0 +1 @@ +Subproject commit 48fb5f0889404370006ae12b3637a77d7d4ba485 diff --git a/external/solanaceae_util b/external/solanaceae_util new file mode 160000 index 0000000..92eee15 --- /dev/null +++ b/external/solanaceae_util @@ -0,0 +1 @@ +Subproject commit 92eee153f2c14f97e50f44b10e2a0aeb5f8b190d diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..87b9b8a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +add_library(solanaceae_clamav + ./solanaceae/clamav/test_lib.cpp +) +target_include_directories(solanaceae_clamav PUBLIC .) +target_compile_features(solanaceae_clamav PUBLIC cxx_std_17) +target_link_libraries(solanaceae_clamav PUBLIC + libclamav + #solanaceae_util +) + diff --git a/src/solanaceae/clamav/test_lib.cpp b/src/solanaceae/clamav/test_lib.cpp new file mode 100644 index 0000000..9f0a279 --- /dev/null +++ b/src/solanaceae/clamav/test_lib.cpp @@ -0,0 +1 @@ +#include