1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
From: Alec Leamas <leamas.alec@gmail.com>
Date: Mon, 10 Jun 2024 09:58:18 +0200
Subject: Add missing libs like tinyxml Debian work-around
Since we remove some bundled libs when repacking the sources,
references to these libs causes build problems which must
be patched in the cmake files.
Not acceptable upstream, it's our problem that we remove stuff from
the sources.
Forwarded: not-needed
---
CMakeLists.txt | 1 -
cmake/SystemLibs.cmake | 28 ++++++++++++++++++++++++++++
cmake/in-files/config.h.in | 1 +
3 files changed, 29 insertions(+), 1 deletion(-)
create mode 100644 cmake/SystemLibs.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9c772d..44d6e1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1494,7 +1494,6 @@ message(STATUS " Adding local LIBTESS2")
add_subdirectory(libs/libtess2)
target_link_libraries(${PACKAGE_NAME} PRIVATE ocpn::tess2)
-add_subdirectory(libs/tinyxml)
target_link_libraries(${PACKAGE_NAME} PRIVATE ocpn::tinyxml)
message(STATUS " Adding local wxserverdisc")
diff --git a/cmake/SystemLibs.cmake b/cmake/SystemLibs.cmake
new file mode 100644
index 0000000..473722c
--- /dev/null
+++ b/cmake/SystemLibs.cmake
@@ -0,0 +1,28 @@
+# Dummy definitions for systems like Debian which removes some bundled libs
+# in the packaging
+
+find_package(TinyXML REQUIRED)
+message(STATUS "Building with system tinyxml")
+add_library(TINYXML INTERFACE)
+target_include_directories(TINYXML INTERFACE ${TINYXML_INCLUDE_DIR})
+target_link_libraries(TINYXML INTERFACE ${TINYXML_LIBRARIES})
+add_library(ocpn::tinyxml ALIAS TINYXML)
+
+message(STATUS "Building with system serial lib")
+add_library(SERIAL_IF INTERFACE)
+find_library(LibSerial cxx-serial REQUIRED)
+find_file(SerialHeader NAME serial.h REQUIRED)
+target_link_libraries(SERIAL_IF INTERFACE ${LibSerial})
+add_library(ocpn::serial ALIAS SERIAL_IF)
+set(HAVE_SYS_SERIAL_LIB ON CACHE BOOL "")
+
+# The system libserial serial.h lives in /usr/include, not
+# /usr/includ/7serial. Create a link which make the source code using
+# "#include serial/serial.h" work.
+if (NOT EXISTS ${CMAKE_BINARY_DIR}/include)
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
+endif ()
+execute_process(COMMAND ln -s /usr/include ${CMAKE_BINARY_DIR}/include/serial)
+
+find_path(HAVE_STDINT_H NAMES stdint.h)
+find_path(HAVE_SYS_SERIAL_LIB NAMES serial.h)
diff --git a/cmake/in-files/config.h.in b/cmake/in-files/config.h.in
index 993fcdb..b801944 100644
--- a/cmake/in-files/config.h.in
+++ b/cmake/in-files/config.h.in
@@ -47,6 +47,7 @@
#cmakedefine HAVE_SYS_TYPES_H
#cmakedefine HAVE_SYS_FCNTL_H
#cmakedefine HAVE_SYS_IOCTL_H
+#cmakedefine HAVE_STDINT_H
#cmakedefine OCPN_DISTRO_BUILD
// The os compatible plugins are are built for
|