random updates including various forms of compiled libmaxminddb files for different operating systems
This commit is contained in:
@@ -26,7 +26,7 @@ target_include_directories(LumberJack_core PRIVATE
|
||||
${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(MSVC)
|
||||
# Windows via Visual Studio Compiler
|
||||
@@ -34,7 +34,7 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/maxminddb.lib
|
||||
)
|
||||
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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/mingw_libmaxminddb.a
|
||||
)
|
||||
@@ -44,26 +44,35 @@ if(WIN32)
|
||||
target_link_libraries(LumberJack_core PRIVATE ws2_32)
|
||||
|
||||
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)
|
||||
|
||||
if(MAXMIND_LIB)
|
||||
target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LIB})
|
||||
else()
|
||||
# Fallback to local static file repository boundary if brew package is missing
|
||||
target_link_libraries(LumberJack_core PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a
|
||||
)
|
||||
endif()
|
||||
|
||||
else()
|
||||
# Standard Linux (Ubuntu, Arch Linux, Fedora, etc.)
|
||||
# OPTIMIZATION: Try finding system-installed libmaxminddb first, fallback to local file if missing
|
||||
find_library(MAXMIND_LINUX maxminddb)
|
||||
if(MAXMIND_LINUX)
|
||||
target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LINUX})
|
||||
# Standard Linux (Ubuntu, Arch Linux, Fedora, or Cross-Compiling to Raspberry Pi)
|
||||
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()
|
||||
target_link_libraries(LumberJack_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a)
|
||||
# ─────────────── NATIVE ARCH LINUX HOST MODE ───────────────
|
||||
# Standard configuration behavior when compiling to run on your local Arch computer
|
||||
find_library(MAXMIND_LINUX maxminddb)
|
||||
if(MAXMIND_LINUX)
|
||||
target_link_libraries(LumberJack_core PRIVATE ${MAXMIND_LINUX})
|
||||
else()
|
||||
target_link_libraries(LumberJack_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lib/libmaxminddb.a)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -106,18 +115,30 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
elseif(APPLE)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES)
|
||||
else()
|
||||
target_link_options(LumberJack PRIVATE -static-libgcc -static-libstdc++)
|
||||
# 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++)
|
||||
else()
|
||||
target_link_options(LumberJack PRIVATE -static-libgcc -static-libstdc++)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fourth: Set directory runtime properties
|
||||
set_target_properties(LumberJack PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/bin/debug"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/bin/release"
|
||||
)
|
||||
|
||||
# ==========================================
|
||||
# 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()
|
||||
Reference in New Issue
Block a user