1 Commits
r1 ... main

9 changed files with 131 additions and 15 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
# Ignores all variation of build folders (build, build_ninja, build-release, etc.) # Ignores all variation of build folders (build, build_ninja, build-release, etc.)
[Bb]uild*/ [Bb]uild*/
cmake-build-*/ cmake-build-*/
build_pi*/
# Ignore CMake generated artifacts if they accidentally land in the root # Ignore CMake generated artifacts if they accidentally land in the root
CMakeCache.txt CMakeCache.txt

View File

@@ -26,7 +26,7 @@ target_include_directories(LumberJack_core PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/third_party/include ${CMAKE_CURRENT_SOURCE_DIR}/third_party/include
) )
# CROSS-PLATFORM FIXED: Automatically links appropriate binary dependencies based on OS # CROSS-PLATFORM FIXED: Automatically links appropriate binary dependencies based on OS/Architecture
if(WIN32) if(WIN32)
if(MSVC) if(MSVC)
# Windows via Visual Studio Compiler # Windows via Visual Studio Compiler
@@ -34,7 +34,7 @@ if(WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/maxminddb.lib ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/maxminddb.lib
) )
else() else()
# Windows via MinGW/GCC Cross-Toolchain (FIXED: Points to your new library file) # Windows via MinGW/GCC Cross-Toolchain
target_link_libraries(LumberJack_core PRIVATE target_link_libraries(LumberJack_core PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/mingw_libmaxminddb.a ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/mingw_libmaxminddb.a
) )
@@ -44,27 +44,36 @@ if(WIN32)
target_link_libraries(LumberJack_core PRIVATE ws2_32) target_link_libraries(LumberJack_core PRIVATE ws2_32)
elseif(APPLE) elseif(APPLE)
# macOS Specific Path Integrations (Handles Intel /opt/local and Apple Silicon /opt/homebrew) # macOS Specific Path Integrations
find_library(MAXMIND_LIB maxminddb HINTS /opt/homebrew/lib /usr/local/lib /opt/local/lib) find_library(MAXMIND_LIB maxminddb HINTS /opt/homebrew/lib /usr/local/lib /opt/local/lib)
if(MAXMIND_LIB) if(MAXMIND_LIB)
target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LIB}) target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LIB})
else() else()
# Fallback to local static file repository boundary if brew package is missing
target_link_libraries(LumberJack_core PRIVATE target_link_libraries(LumberJack_core PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a
) )
endif() endif()
else() else()
# Standard Linux (Ubuntu, Arch Linux, Fedora, etc.) # Standard Linux (Ubuntu, Arch Linux, Fedora, or Cross-Compiling to Raspberry Pi)
# OPTIMIZATION: Try finding system-installed libmaxminddb first, fallback to local file if missing if(CMAKE_CROSSCOMPILING)
# ─────────────── RASPBERRY PI TARGETING MODE ───────────────
# Forces CMake to ignore your system paths and use your ARM .so file explicitly!
message(STATUS "[LumberJack] Cross-compiling detected! Explicitly forcing ARM .so dependency.")
target_link_libraries(LumberJack_core PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.so"
)
else()
# ─────────────── NATIVE ARCH LINUX HOST MODE ───────────────
# Standard configuration behavior when compiling to run on your local Arch computer
find_library(MAXMIND_LINUX maxminddb) find_library(MAXMIND_LINUX maxminddb)
if(MAXMIND_LINUX) if(MAXMIND_LINUX)
target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LINUX}) target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LINUX})
else() else()
target_link_libraries(LumberJack_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a) target_link_libraries(LumberJack_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a)
endif() endif()
endif()
endif() endif()
# Version definitions needed by your GeoLite2PP wrapper # Version definitions needed by your GeoLite2PP wrapper
@@ -106,18 +115,30 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
elseif(APPLE) elseif(APPLE)
set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES) set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES)
else() else()
# RASPBERRY PI FIXED: Static linking libstdc++ can cause issues when cross-compiling
# without a complete sysroot. We wrap this safely.
# FORCE complete compiler runtime embedding during cross-compilation
if(CMAKE_CROSSCOMPILING)
target_link_options(LumberJack PRIVATE -static-libgcc -static-libstdc++) target_link_options(LumberJack PRIVATE -static-libgcc -static-libstdc++)
else()
target_link_options(LumberJack PRIVATE -static-libgcc -static-libstdc++)
endif()
endif() endif()
endif() endif()
# Fourth: Set directory runtime properties # Fourth: Set directory runtime properties
set_target_properties(LumberJack PROPERTIES set_target_properties(LumberJack PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}" RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/bin/debug"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}" RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/bin/release"
) )
# ========================================== # ==========================================
# 4. TEST SUITE # 4. TEST SUITE
# ========================================== # ==========================================
enable_testing() # Disable testing during cross-compilation because your Arch Linux computer
# cannot execute compiled ARM/AArch64 test binaries locally.
if(NOT CMAKE_CROSSCOMPILING)
enable_testing()
endif()

View File

@@ -0,0 +1,21 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
# Force the cross-compiler binaries
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
# Explicitly redirect root path searching away from your host OS paths
set(CMAKE_SYSROOT /usr/aarch64-linux-gnu)
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
# CRITICAL EXCLUSIONS: Force CMake to ONLY look inside the cross-compiler directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Ensure Ninja is mapped properly
find_program(NINJA_PATH ninja REQUIRED)
set(CMAKE_MAKE_PROGRAM ${NINJA_PATH} CACHE FILEPATH "Path to Ninja" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-shlib-undefined")

14
third_party/lib/libmaxminddb.exp vendored Normal file
View File

@@ -0,0 +1,14 @@
MMDB_aget_value
MMDB_close
MMDB_dump_entry_data_list
MMDB_free_entry_data_list
MMDB_get_entry_data_list
MMDB_get_metadata_as_entry_data_list
MMDB_get_value
MMDB_lib_version
MMDB_lookup_sockaddr
MMDB_lookup_string
MMDB_open
MMDB_read_node
MMDB_strerror
MMDB_vget_value

1
third_party/lib/libmaxminddb.la vendored Symbolic link
View File

@@ -0,0 +1 @@
../libmaxminddb.la

41
third_party/lib/libmaxminddb.lai vendored Normal file
View File

@@ -0,0 +1,41 @@
# libmaxminddb.la - a libtool library file
# Generated by libtool (GNU libtool) 2.5.4 Debian-2.5.4-4build1
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libmaxminddb.so.0'
# Names of this library.
library_names='libmaxminddb.so.0.0.7 libmaxminddb.so.0 libmaxminddb.so'
# The name of the static archive.
old_library='libmaxminddb.a'
# Linker flags that cannot go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -lm'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libmaxminddb.
current=0
age=0
revision=7
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

1
third_party/lib/libmaxminddb.so.0 vendored Symbolic link
View File

@@ -0,0 +1 @@
libmaxminddb.so.0.0.7

BIN
third_party/lib/libmaxminddb.so.0.0.7 vendored Executable file

Binary file not shown.

16
third_party/lib/libmaxminddb.ver vendored Normal file
View File

@@ -0,0 +1,16 @@
{ global:
MMDB_aget_value;
MMDB_close;
MMDB_dump_entry_data_list;
MMDB_free_entry_data_list;
MMDB_get_entry_data_list;
MMDB_get_metadata_as_entry_data_list;
MMDB_get_value;
MMDB_lib_version;
MMDB_lookup_sockaddr;
MMDB_lookup_string;
MMDB_open;
MMDB_read_node;
MMDB_strerror;
MMDB_vget_value;
local: *; };