Skip to content

Commit

Permalink
Support vcpkg dependency management (#463)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekilmer authored Dec 10, 2020
1 parent 9fcc1c5 commit 3774195
Show file tree
Hide file tree
Showing 23 changed files with 1,025 additions and 110 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/vcpkg_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: VCPKG Continuous Integration
on:
push:
branches:
- master
pull_request:
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 6 * * *'

jobs:
build_linux:
strategy:
fail-fast: false
matrix:
image:
- { name: 'ubuntu', tag: '18.04' }
- { name: 'ubuntu', tag: '20.04' }
llvm: [
'9',
'10',
'11'
]

runs-on: ubuntu-20.04
container:
image: docker.pkg.github.com/trailofbits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- name: Install utility tools
shell: bash
run: |
# TODO some of these should probably live in the Docker build image
apt-get update
apt-get install -y pixz xz-utils make
- name: Build with build script
shell: bash
run: ./scripts/build.sh --llvm-version ${{ matrix.llvm }}
- name: Run tests
shell: bash
working-directory: remill-build
run: |
cmake --build . --target install -- -j "$(nproc)"
cmake --build . --target test_dependencies -- -j "$(nproc)"
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test -- -j "$(nproc)"
- name: Smoketests with installed executable
shell: bash
run: |
remill-lift-${{ matrix.llvm }} --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
remill-lift-${{ matrix.llvm }} --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
build_mac:
strategy:
fail-fast: false
matrix:
os: [
'macos-10.15',
'macos-11.0'
]
llvm: [
'9',
'10',
'11'
]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Build with build script
shell: bash
run: ./scripts/build.sh --llvm-version ${{ matrix.llvm }}
- name: Run tests
shell: bash
working-directory: remill-build
run: |
cmake --build . --target install -- -j "$(sysctl -n hw.logicalcpu)"
cmake --build . --target test_dependencies -- -j "$(sysctl -n hw.logicalcpu)"
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test -- -j "$(sysctl -n hw.logicalcpu)"
- name: Smoketests with installed executable
shell: bash
run: |
remill-lift-${{ matrix.llvm }} --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
remill-lift-${{ matrix.llvm }} --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ cmake-build-release
compile_commands.json

bin/*
lib/*

third_party/*
build/*
Expand Down
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

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

project(remill)
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.14)

include(GNUInstallDirs)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/settings.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake")
Expand Down
Loading

0 comments on commit 3774195

Please sign in to comment.