manywaypark's Blog
개발, 검색, 함수

vcpkg는 다 좋은데 특정 버전/이전 버전의 라이브러리를 쓰려면 명시적인 명령어가 없어서 좀 번거롭다.
다음의 과정을 거쳐서 특정버전의 라이브러리를 쓸 수 있다.

  1. 라이브러리의 특정 버전 commit id(sha)를 알아낸다.
  2. ports/ 디렉토리의 파일들을 sha를 사용해서 가져온다(checkout).
  3. 라이브러리를 (재)설치한다

현재 설치된 최신의 protobuf(3.9.1)를 3.8.0로 교체하는 예를 들어보겠다.

C:\libs\vcpkg>git log ports/protobuf
......
commit 1a63672f8fa796b044c839c777f7113ccea6e635
Author: myd7349 <myd7349@gmail.com>
Date:   Wed Jun 19 04:34:43 2019 +0800

    [protobuf] Update to 3.8.0 (#6739)

    * [protobuf] Update to 3.8.0

    * [nlopt] set options off

    * [shogun] should not use CMAKE_SYSTEM_PROCESSOR in port file

    * [protobuf] Add Homepage

    * [protobuf] turn warning flag off
......
C:\libs\vcpkg>git checkout 1a63672f8fa796b044c839c777f7113ccea6e635 -- ports/protobuf
C:\libs\vcpkg>vcpkg remove protobuf:x86-windows
The following packages will be removed:
    protobuf:x86-windows
Removing package protobuf:x86-windows...
Removing package protobuf:x86-windows... done
Purging package protobuf:x86-windows...
Purging package protobuf:x86-windows... done

C:\libs\vcpkg>vcpkg install protobuf:x86-windows
The following packages will be built and installed:
    protobuf[core]:x86-windows
Starting package 1/1: protobuf:x86-windows
Building package protobuf[core]:x86-windows...
-- Downloading https://github.com/google/protobuf/archive/v3.8.0.tar.gz...
-- Extracting source C:/libs/vcpkg/downloads/google-protobuf-v3.8.0.tar.gz
-- Applying patch fix-uwp.patch
-- Applying patch disable-lite.patch
-- Using source at C:/libs/vcpkg/buildtrees/protobuf/src/v3.8.0-f0fa939850
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: C:/libs/vcpkg/packages/protobuf_x86-windows/tools/protobuf/protoc.exe
-- Installing: C:/libs/vcpkg/packages/protobuf_x86-windows/share/protobuf/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package protobuf[core]:x86-windows... done
Installing package protobuf[core]:x86-windows...
Installing package protobuf[core]:x86-windows... done
Elapsed time for package protobuf:x86-windows: 9.415 min

Total elapsed time: 9.415 min

The package protobuf:x86-windows provides CMake targets:

    find_package(protobuf CONFIG REQUIRED)
    target_link_libraries(main PRIVATE protobuf::libprotoc protobuf::libprotobuf)


C:\libs\vcpkg>cat ports/protobuf/CONTROL
Source: protobuf
Version: 3.8.0
Homepage: https://github.com/google/protobuf
Description: Protocol Buffers - Google's data interchange format

Feature: zlib
Description: ZLib based features like Gzip streams
Build-Depends: zlib
C:\libs\vcpkg>

현재 설치되어 있지 않은 라이브러리라면 remove를 할 필요는 없다.

ref: https://github.com/Microsoft/vcpkg/issues/1681

happy hackin'

분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-20 02:28