initial setup with deps

This commit is contained in:
Green Sky 2023-10-21 23:16:20 +02:00
commit 4910cb43e5
No known key found for this signature in database
11 changed files with 162 additions and 0 deletions

26
.gitignore vendored Normal file
View File

@ -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

12
.gitmodules vendored Normal file
View File

@ -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

65
CMakeLists.txt Normal file
View File

@ -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)

38
external/CMakeLists.txt vendored Normal file
View File

@ -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()

4
external/entt/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
add_subdirectory(./entt EXCLUDE_FROM_ALL)

1
external/entt/entt vendored Submodule

@ -0,0 +1 @@
Subproject commit 344e03ac64a1f78424ab1150e2d4778e8df8431d

1
external/solanaceae_contact vendored Submodule

@ -0,0 +1 @@
Subproject commit 5ff7d1cee0c3ed22f9fe7d66021d95ad1c5a3f04

1
external/solanaceae_message3 vendored Submodule

@ -0,0 +1 @@
Subproject commit 48fb5f0889404370006ae12b3637a77d7d4ba485

1
external/solanaceae_util vendored Submodule

@ -0,0 +1 @@
Subproject commit 92eee153f2c14f97e50f44b10e2a0aeb5f8b190d

12
src/CMakeLists.txt Normal file
View File

@ -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
)

View File

@ -0,0 +1 @@
#include <clamav.h>