Skip to content

Commit

Permalink
Fetch zsync2 using FetchContent
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Mar 4, 2023
1 parent a406be3 commit 0b20011
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "lib/zsync2"]
path = lib/zsync2
url = https://github.com/AppImage/zsync2
[submodule "lib/fltk"]
path = lib/fltk
url = https://github.com/TheAssassin/fltk-1.3.4
Expand Down
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ option(ENABLE_SANITIZERS "Enable builds using sanitizers" off)
# install into proper dirs on Linux
include(GNUInstallDirs)

include(FetchContent)

option(USE_SYSTEM_ZSYNC2 OFF "Use existing libzsync2 installed on system (or inside CMAKE_PREFIX_PATH)")
if(USE_SYSTEM_ZSYNC2)
set(USE_SYSTEM_CPR ON)
Expand All @@ -46,6 +48,16 @@ if(USE_SYSTEM_ZSYNC2)

# note: find_package calls must be made in the same or a parent scope
find_package(zsync2 REQUIRED)
else()
function(import_zsync2)
FetchContent_Declare(zsync2
GIT_REPOSITORY https://github.com/AppImageCommunity/zsync2
GIT_TAG 2.0.0-alpha-1-20230304
)
FetchContent_MakeAvailable(zsync2)
endfunction()

import_zsync2()
endif()

option(USE_SYSTEM_LIBAPPIMAGE OFF "Use existing libappimage installed on system (or inside CMAKE_PREFIX_PATH)")
Expand All @@ -54,8 +66,6 @@ if(USE_SYSTEM_LIBAPPIMAGE)
find_package(libappimage REQUIRED)
else()
function(import_libappimage)
include(FetchContent)

FetchContent_Declare(libappimage
GIT_REPOSITORY https://github.com/AppImageCommunity/libappimage
GIT_TAG 3467b20
Expand All @@ -77,9 +87,6 @@ if(NOT BUILD_LIBAPPIMAGEUPDATE_ONLY)
endif()
endif()

# include external libraries
add_subdirectory(lib)

# core source directory, contains its own CMakeLists.txt
add_subdirectory(src)

Expand Down
3 changes: 3 additions & 0 deletions ci/Dockerfile.i386
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ RUN apt-get update && \
libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev argagg-dev libgcrypt20-dev libboost-dev && \
wget -qO- https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.24.0-ubuntu_"$DIST"-"$ARCH".tar.gz | tar xzv -C/usr --strip-components=1

COPY ./install-gtest.sh /
RUN bash /install-gtest.sh

COPY pkgconfig/*.pc /usr/lib/i386-linux-gnu/pkgconfig/
RUN sed -i 's|x86_64|i386|g' /usr/lib/i386-linux-gnu/pkgconfig/*.pc

Expand Down
3 changes: 3 additions & 0 deletions ci/Dockerfile.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ RUN apt-get update && \
libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev argagg-dev libgcrypt20-dev libboost-dev && \
wget -qO- https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.24.0-ubuntu_"$DIST"-"$ARCH".tar.gz | tar xzv -C/usr --strip-components=1

COPY ./install-gtest.sh /
RUN bash /install-gtest.sh

COPY pkgconfig/*.pc /usr/lib/x86_64-linux-gnu/pkgconfig/

COPY entrypoint.sh /
Expand Down
21 changes: 21 additions & 0 deletions ci/install-gtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /bin/bash

set -euxo pipefail

tempdir="$(mktemp -d)"

_cleanup() {
[[ -d "$tempdir" ]] && rm -r "$tempdir"
}
trap _cleanup EXIT

cd "$tempdir"

git clone https://github.com/google/googletest -b v1.13.0 .

mkdir build
cd build

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
make -j6
make install
3 changes: 0 additions & 3 deletions lib/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/zsync2
Submodule zsync2 deleted from 4e549b

0 comments on commit 0b20011

Please sign in to comment.