Skip to content

Commit

Permalink
Cleanup Compression Library Linking
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Apr 22, 2024
1 parent 9be4498 commit cc2faec
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 48 deletions.
36 changes: 0 additions & 36 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,3 @@
add_subdirectory(libevents)
add_subdirectory(qtandroidserialport)
add_subdirectory(qmlglsink)

qt_add_library(xz STATIC
xz-embedded/linux/include/linux/xz.h
xz-embedded/linux/include/linux/decompress/unxz.h
# xz-embedded/linux/lib/decompress_unxz.c
xz-embedded/linux/lib/xz/xz_crc32.c
xz-embedded/linux/lib/xz/xz_crc64.c
xz-embedded/linux/lib/xz/xz_dec_bcj.c
xz-embedded/linux/lib/xz/xz_dec_lzma2.c
xz-embedded/linux/lib/xz/xz_dec_stream.c
# xz-embedded/linux/lib/xz/xz_dec_syms.c
# xz-embedded/linux/lib/xz/xz_dec_test.c
xz-embedded/linux/lib/xz/xz_lzma2.h
xz-embedded/linux/lib/xz/xz_private.h
xz-embedded/linux/lib/xz/xz_stream.h
# xz-embedded/userspace/boottest.c
# xz-embedded/userspace/buftest.c
# xz-embedded/userspace/bytetest.c
xz-embedded/userspace/xz_config.h
# xz-embedded/userspace/xzminidec.c
)

target_include_directories(xz
PUBLIC
xz-embedded/linux/include
xz-embedded/linux/include/linux
xz-embedded/linux/include/linux/decompress
xz-embedded/linux/lib/xz
xz-embedded/userspace
)

target_compile_definitions(xz
PUBLIC
XZ_DEC_ANY_CHECK
XZ_USE_CRC64
)
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ target_link_libraries(qgc
AutoPilotPlugins
Camera
comm
compression
FactSystem
FirmwarePlugin
FlightMap
Expand Down
2 changes: 2 additions & 0 deletions src/Camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ qt_add_library(Camera STATIC
)

target_link_libraries(Camera
PRIVATE
Compression
PUBLIC
qgc
)
Expand Down
44 changes: 40 additions & 4 deletions src/Compression/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(compression STATIC
qt_add_library(Compression STATIC
QGCLZMA.cc
QGCLZMA.h
QGCZlib.cc
QGCZlib.h
)

############### ZLIB

set(ZLIB_BUILD_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
set(SKIP_INSTALL_FILES ON CACHE INTERNAL "")
set(SKIP_INSTALL_LIBRARIES ON CACHE INTERNAL "")

include(FetchContent)
FetchContent_Declare(zlib
Expand All @@ -19,12 +22,45 @@ FetchContent_Declare(zlib
)
FetchContent_MakeAvailable(zlib)

target_link_libraries(compression
############### XZ

set(XZ_EMBEDDED_DIR ${CMAKE_SOURCE_DIR}/libs/xz-embedded)

qt_add_library(xz STATIC
${XZ_EMBEDDED_DIR}/linux/include/linux/xz.h
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_crc32.c
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_crc64.c
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_dec_lzma2.c
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_dec_stream.c
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_lzma2.h
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_private.h
${XZ_EMBEDDED_DIR}/linux/lib/xz/xz_stream.h
${XZ_EMBEDDED_DIR}/userspace/xz_config.h
)

target_include_directories(xz
PUBLIC
${XZ_EMBEDDED_DIR}/linux/include/linux
PRIVATE
${XZ_EMBEDDED_DIR}/linux/lib/xz
${XZ_EMBEDDED_DIR}/userspace
)

target_compile_definitions(xz
PRIVATE
XZ_DEC_ANY_CHECK
PUBLIC
XZ_USE_CRC64
)

###############

target_link_libraries(Compression
PRIVATE
zlib
zlibstatic
xz
PUBLIC
Qt6::Core
)

target_include_directories(compression PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(Compression PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
4 changes: 2 additions & 2 deletions src/Compression/QGCLZMA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "QGCLZMA.h"

#include <QFile>
#include <QtDebug>
#include <QtCore/QFile>
#include <QtCore/QtDebug>

#include <mutex>

Expand Down
4 changes: 2 additions & 2 deletions src/Compression/QGCZlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "QGCZlib.h"

#include <QFile>
#include <QtDebug>
#include <QtCore/QFile>
#include <QtCore/QtDebug>

#include "zlib.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Compression/QGCZlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#pragma once

#include <QString>
#include <QtCore/QString>

class QGCZlib
{
Expand Down
2 changes: 1 addition & 1 deletion src/Vehicle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ qt_add_library(Vehicle STATIC
target_link_libraries(Vehicle
PRIVATE
Audio
compression
Compression
PUBLIC
qgc
libevents
Expand Down
2 changes: 1 addition & 1 deletion src/VehicleSetup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ add_custom_target(VehicleSetupQml

target_link_libraries(VehicleSetup
PRIVATE
compression
Compression
PUBLIC
qgc
)
Expand Down

0 comments on commit cc2faec

Please sign in to comment.