@@ -26,7 +26,7 @@ if(SUBMODULE_CHECK)
2626 message (STATUS "Checking submodules" )
2727 check_submodule(ios-cmake)
2828 check_submodule(libsodium-internal )
29- check_submodule(oxen-encoding )
29+ check_submodule(oxen-libquic external/oxen-logging external/oxen- encoding )
3030 check_submodule(nlohmann-json)
3131 check_submodule(zstd)
3232 check_submodule(protobuf)
@@ -37,7 +37,7 @@ if(NOT BUILD_STATIC_DEPS AND NOT FORCE_ALL_SUBMODULES)
3737 find_package (PkgConfig REQUIRED)
3838endif ()
3939
40- macro (system_or_submodule BIGNAME smallname pkgconf subdir)
40+ macro (libsession_system_or_submodule BIGNAME smallname pkgconf subdir)
4141 option (FORCE_${BIGNAME} _SUBMODULE "force using ${smallname} submodule" OFF )
4242 if (NOT BUILD_STATIC_DEPS AND NOT FORCE_${BIGNAME} _SUBMODULE AND NOT FORCE_ALL_SUBMODULES)
4343 pkg_check_modules(${BIGNAME} ${pkgconf} IMPORTED_TARGET GLOBAL )
@@ -57,6 +57,9 @@ macro(system_or_submodule BIGNAME smallname pkgconf subdir)
5757 if (TARGET ${smallname} AND NOT TARGET ${smallname} ::${smallname} )
5858 add_library (${smallname} ::${smallname} ALIAS ${smallname} )
5959 endif ()
60+ if (BUILD_STATIC_DEPS AND STATIC_BUNDLE)
61+ libsession_static_bundle(${smallname} ::${smallname} )
62+ endif ()
6063endmacro ()
6164
6265
@@ -65,11 +68,6 @@ set(cross_host "")
6568set (cross_rc "" )
6669if (CMAKE_CROSSCOMPILING )
6770 if (APPLE_TARGET_TRIPLE)
68- if (PLATFORM MATCHES "OS64" OR PLATFORM MATCHES "SIMULATORARM64" )
69- set (APPLE_TARGET_TRIPLE aarch64-apple -ios)
70- elseif (PLATFORM MATCHES "SIMULATOR64" )
71- set (APPLE_TARGET_TRIPLE x86_64-apple -ios)
72- endif ()
7371 set (cross_host "--host=${APPLE_TARGET_TRIPLE} " )
7472 elseif (ANDROID)
7573 if (CMAKE_ANDROID_ARCH_ABI MATCHES x86_64)
@@ -102,8 +100,31 @@ if(CMAKE_CROSSCOMPILING)
102100 endif ()
103101endif ()
104102
103+ set (LIBQUIC_BUILD_TESTS OFF CACHE BOOL "" )
104+ if (ENABLE_ONIONREQ)
105+ libsession_system_or_submodule(OXENQUIC quic liboxenquic>=1.1.0 oxen-libquic)
106+ endif ()
107+
108+ if (NOT TARGET oxenc::oxenc)
109+ # The oxenc target will already exist if we load libquic above via submodule
110+ set (OXENC_BUILD_TESTS OFF CACHE BOOL "" )
111+ set (OXENC_BUILD_DOCS OFF CACHE BOOL "" )
112+ libsession_system_or_submodule(OXENC oxenc liboxenc>=1.1.0 oxen-libquic/external/oxen-encoding )
113+ endif ()
105114
106- system_or_submodule(OXENC oxenc liboxenc>=1.0.10 oxen-encoding )
115+ if (NOT TARGET oxen::logging)
116+ add_subdirectory (oxen-libquic/external/oxen-logging)
117+ endif ()
118+
119+ oxen_logging_add_source_dir("${PROJECT_SOURCE_DIR} " )
120+
121+ # Apple xcode 15 has a completely broken std::source_location; we can't fix it, but at least we can
122+ # hack up the source locations to hide the path that it uses (which is the useless path to
123+ # oxen/log.hpp where the info/critical/etc. bodies are).
124+ if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
125+ message (WARNING "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is broken: filenames in logging statements will not display properly" )
126+ oxen_logging_add_source_dir("${CMAKE_CURRENT_SOURCE_DIR} /oxen-libquic/external/oxen-logging/include/oxen" )
127+ endif ()
107128
108129
109130if (CMAKE_C_COMPILER_LAUNCHER)
@@ -143,7 +164,7 @@ set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
143164set (protobuf_ABSL_PROVIDER "module" CACHE STRING "" FORCE)
144165set (protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "" )
145166set (protobuf_BUILD_PROTOBUF_BINARIES ON CACHE BOOL "" FORCE)
146- system_or_submodule (PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
167+ libsession_system_or_submodule (PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
147168if (TARGET PkgConfig::PROTOBUF_LITE AND NOT TARGET protobuf::libprotobuf-lite)
148169 add_library (protobuf::libprotobuf-lite ALIAS PkgConfig::PROTOBUF_LITE)
149170endif ()
@@ -172,4 +193,4 @@ libsession_static_bundle(libzstd_static)
172193
173194set (JSON_BuildTests OFF CACHE INTERNAL "" )
174195set (JSON_Install ON CACHE INTERNAL "" ) # Required to export targets that we use
175- system_or_submodule (NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
196+ libsession_system_or_submodule (NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
0 commit comments