Page MenuHomePhorge

D381.1794950687.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D381.1794950687.diff

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,8 +15,22 @@
script:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
- - DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends rustup build-essential g++ libolm-dev libboost-json-dev wget cmake ca-certificates catch2 corrosion
+ - DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends rustup build-essential g++ libolm-dev libboost-json-dev wget cmake ca-certificates catch2
- rustup default stable
+ - |
+ if [ -z "$CUSTOM_CORROSION_VERSION" ]; then
+ DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends corrosion || exit 1
+ else
+ wget -Ocorrosion.tar.gz https://github.com/corrosion-rs/corrosion/archive/refs/tags/"$CUSTOM_CORROSION_VERSION".tar.gz && \
+ tar -xf corrosion.tar.gz && \
+ cd corrosion-* && \
+ mkdir build && cd build && \
+ cmake .. && \
+ make -j$(($(nproc) / 2)) && \
+ make install && \
+ cd ../.. && \
+ rm -rf corrosion-* corrosion.tar.gz || exit 1
+ fi
- mkdir build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE="$BUILD_TYPE"
@@ -34,3 +48,17 @@
- .build
before_script:
- BUILD_TYPE=Debug
+
+build-corrosion0.6.1:release:
+ extends:
+ - .build
+ before_script:
+ - BUILD_TYPE=Release
+ - CUSTOM_CORROSION_VERSION=v0.6.1
+
+build-corrosion0.6.1:debug:
+ extends:
+ - .build
+ before_script:
+ - BUILD_TYPE=Debug
+ - CUSTOM_CORROSION_VERSION=v0.6.1
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,14 @@
find_package(Perl REQUIRED)
find_package(Corrosion REQUIRED)
+set(BUILD_OUTPUT_DIR "${CMAKE_BINARY_DIR}/cargo/build/${Rust_CARGO_TARGET}")
+if("${Corrosion_VERSION}" VERSION_GREATER_EQUAL 0.6)
+ # From Corrosion.cmake
+ string(SHA1 cargo_path_hash "${CMAKE_SOURCE_DIR}/cpp/Cargo.toml")
+ string(SUBSTRING "${cargo_path_hash}" 0 5 cargo_path_hash)
+ set(BUILD_OUTPUT_DIR "${CMAKE_BINARY_DIR}/cargo/cpp_${cargo_path_hash}/${Rust_CARGO_TARGET}")
+endif()
+
# corrosion_import_crate requires that lib.rs exist, so we must generate it right now when configuring
message(STATUS "Generating lib.rs")
execute_process(COMMAND "${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/cpp/inject-maybe"
@@ -24,7 +32,7 @@
COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_BINARY_DIR}/vodozemac-dummy.cpp" VERBATIM)
# copy the header. if we install the lib.rs.h directly, we will install a symlink.
add_custom_target(vodezemac-header ALL
- "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_BINARY_DIR}/cargo/build/${Rust_CARGO_TARGET}/cxxbridge/vodozemac/src/lib.rs.h" "${CMAKE_BINARY_DIR}/vodozemac.h"
+ "${CMAKE_COMMAND}" -E copy_if_different "${BUILD_OUTPUT_DIR}/cxxbridge/vodozemac/src/lib.rs.h" "${CMAKE_BINARY_DIR}/vodozemac.h"
VERBATIM
BYPRODUCTS "${CMAKE_BINARY_DIR}/vodozemac.h"
DEPENDS vodozemac-static

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 17, 1:24 PM (11 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1836403
Default Alt Text
D381.1794950687.diff (2 KB)

Event Timeline