rnp icon indicating copy to clipboard operation
rnp copied to clipboard

use vcpkg for all platforms

Open CAMOBAP opened this issue 4 years ago • 13 comments
trafficstars

Description

It will be nice to use vcpkg for all our platforms to reduce the amount of shell script

Expected Behavior

This will simplify and unify the build process

Actual Behavior

For now, we have a huge amount of shell scripts related to the compilation

CAMOBAP avatar Oct 13 '21 16:10 CAMOBAP

Agree with @CAMOBAP on vcpkg, will streamline our dependency management. Let’s get this done.

ronaldtse avatar Nov 12 '21 07:11 ronaldtse

@ronaldtse yep I already have some progress in this direction and will push first PR in next 1-2 days

CAMOBAP avatar Nov 12 '21 07:11 CAMOBAP

Thank you @CAMOBAP! Sorry didn't know you were working on it already...

ronaldtse avatar Nov 12 '21 07:11 ronaldtse

@ronaldtse for the next time I will add a comment that it's in progress, to not confuse others

In Progress

CAMOBAP avatar Nov 12 '21 07:11 CAMOBAP

I am still in the middle, here are some findings which I have so far:

  • local I tested building dependencies as static libraries and shared libraries

For static deps:

  • vcpkg install --triplet x64-linux $(cat vcpkg.txt)
  • cmake -B ./build -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake .

For shared deps: Create proper triplet file ${VCPKG_ROOT}/triplets/x64-linux-dynamic.cmake with content:

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)
  • vcpkg install --triplet x64-linux-dynamic $(cat vcpkg.txt)
  • cmake -B ./build -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-linux-dynamic -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake .

All this above is just for information, I will automate this in CI anyway

CAMOBAP avatar Nov 14 '21 17:11 CAMOBAP

https://github.com/microsoft/vcpkg/issues/21461 - reported

CAMOBAP avatar Nov 16 '21 12:11 CAMOBAP

Quick status update:

  • ubuntu dynamic linking with so works tested [GCC, clang], [Debug, Release], tests passing
  • https://github.com/microsoft/vcpkg/issues/21461 ready for review to fix compilation with a static library

I will wait for vcpkg's PR to approve before moving to other platforms

CAMOBAP avatar Nov 19 '21 05:11 CAMOBAP

Thanks @CAMOBAP !

ronaldtse avatar Nov 19 '21 06:11 ronaldtse

The issue with centos7 https://github.com/openssl/openssl/issues/16449 - which are probably not released yet. I will check if possible to not use openssl from vcpkg but use a system one

CAMOBAP avatar Nov 21 '21 19:11 CAMOBAP

@CAMOBAP agree to use system OpenSSL on CentOS 7.

ronaldtse avatar Nov 22 '21 01:11 ronaldtse

Just found that vcpkg has VCPKG_SYSTEM_LIBRARIES looks like exactly what we need

CAMOBAP avatar Nov 22 '21 06:11 CAMOBAP

Just found that vcpkg has VCPKG_SYSTEM_LIBRARIES looks like exactly what we need

It's internal and doesn't allow to use system library instead portlet, thingking about other approach

CAMOBAP avatar Nov 25 '21 11:11 CAMOBAP

@CAMOBAP openssl/openssl#16449 has been merged, can we carry on with this task?

ronaldtse avatar Jan 04 '22 06:01 ronaldtse