Skip to content

Commit 3774195

Browse files
authored
Support vcpkg dependency management (#463)
First step towards transitioning away from cxx-common's `pkgman.py` dependency management system towards compatibility with and use of vcpkg (https://github.com/microsoft/vcpkg) to manage dependencies. This commit attempts to support both the new and old build systems until we can phase out the old completely. Please see the updated trailofbits/cxx-common repository or run the `./scripts/build.sh` script to fetch the required dependencies.
1 parent 9fcc1c5 commit 3774195

23 files changed

+1025
-110
lines changed

.github/workflows/vcpkg_ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: VCPKG Continuous Integration
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
schedule:
8+
# run CI every day even if no PRs/merges occur
9+
- cron: '0 6 * * *'
10+
11+
jobs:
12+
build_linux:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
image:
17+
- { name: 'ubuntu', tag: '18.04' }
18+
- { name: 'ubuntu', tag: '20.04' }
19+
llvm: [
20+
'9',
21+
'10',
22+
'11'
23+
]
24+
25+
runs-on: ubuntu-20.04
26+
container:
27+
image: docker.pkg.github.com/trailofbits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
28+
credentials:
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
- name: Install utility tools
35+
shell: bash
36+
run: |
37+
# TODO some of these should probably live in the Docker build image
38+
apt-get update
39+
apt-get install -y pixz xz-utils make
40+
41+
- name: Build with build script
42+
shell: bash
43+
run: ./scripts/build.sh --llvm-version ${{ matrix.llvm }}
44+
- name: Run tests
45+
shell: bash
46+
working-directory: remill-build
47+
run: |
48+
cmake --build . --target install -- -j "$(nproc)"
49+
cmake --build . --target test_dependencies -- -j "$(nproc)"
50+
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test -- -j "$(nproc)"
51+
- name: Smoketests with installed executable
52+
shell: bash
53+
run: |
54+
remill-lift-${{ matrix.llvm }} --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
55+
remill-lift-${{ matrix.llvm }} --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
56+
57+
build_mac:
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
os: [
62+
'macos-10.15',
63+
'macos-11.0'
64+
]
65+
llvm: [
66+
'9',
67+
'10',
68+
'11'
69+
]
70+
71+
runs-on: ${{ matrix.os }}
72+
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: Build with build script
76+
shell: bash
77+
run: ./scripts/build.sh --llvm-version ${{ matrix.llvm }}
78+
- name: Run tests
79+
shell: bash
80+
working-directory: remill-build
81+
run: |
82+
cmake --build . --target install -- -j "$(sysctl -n hw.logicalcpu)"
83+
cmake --build . --target test_dependencies -- -j "$(sysctl -n hw.logicalcpu)"
84+
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test -- -j "$(sysctl -n hw.logicalcpu)"
85+
- name: Smoketests with installed executable
86+
shell: bash
87+
run: |
88+
remill-lift-${{ matrix.llvm }} --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
89+
remill-lift-${{ matrix.llvm }} --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ cmake-build-release
2727
compile_commands.json
2828

2929
bin/*
30-
lib/*
3130

3231
third_party/*
3332
build/*

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
16-
if (POLICY CMP0025)
17-
cmake_policy(SET CMP0025 NEW)
18-
endif ()
15+
if (NOT DEFINED ENV{TRAILOFBITS_LIBRARIES})
16+
message(STATUS "Using new vcpkg build system")
17+
include(CMakeLists_vcpkg.txt)
18+
return()
19+
endif()
1920

2021
project(remill)
21-
cmake_minimum_required(VERSION 3.2)
22+
cmake_minimum_required(VERSION 3.14)
23+
24+
include(GNUInstallDirs)
2225

2326
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/settings.cmake")
2427
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake")

0 commit comments

Comments
 (0)