Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 24db01c

Browse files
authoredDec 11, 2020
Support vcpkg build system (#717)
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 remill, anvill, and trailofbits/cxx-common repositories to learn how to fetch the required dependencies.
1 parent 5dec010 commit 24db01c

File tree

6 files changed

+482
-5
lines changed

6 files changed

+482
-5
lines changed
 

‎.github/workflows/vcpkg_ci.yml

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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+
]
23+
24+
runs-on: ubuntu-20.04
25+
container:
26+
image: docker.pkg.github.com/trailofbits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
27+
credentials:
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Install utility tools
34+
shell: bash
35+
run: |
36+
# TODO some of these should probably live in the Docker build image
37+
apt-get update
38+
apt-get install -y pixz xz-utils make
39+
40+
- name: Build and install remill
41+
shell: bash
42+
run: |
43+
# Change to master after testing
44+
git clone --depth=1 --branch master https://github.com/lifting-bits/remill.git
45+
cd remill
46+
./scripts/build.sh --llvm-version ${{ matrix.llvm }}
47+
cmake --build remill-build --target install -- -j "$(nproc)"
48+
- name: Build and install anvill
49+
shell: bash
50+
run: |
51+
# Change to master after testing
52+
git clone --depth=1 --branch master https://github.com/lifting-bits/anvill.git
53+
mkdir -p anvill/build && cd anvill/build
54+
cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
55+
cmake --build . --target install -- -j "$(nproc)"
56+
- name: Build mcsema
57+
shell: bash
58+
run: |
59+
mkdir build && cd build
60+
cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
61+
cmake --build . --target install -- -j "$(nproc)"
62+
- name: Smoke Test
63+
shell: bash
64+
run: |
65+
# --help return non-zero and fails...
66+
mcsema-lift-${{ matrix.llvm }}.0 --version
67+
mcsema-disass-2 --help
68+
69+
build_mac:
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
os: [
74+
'macos-10.15',
75+
'macos-11.0'
76+
]
77+
llvm: [
78+
'9',
79+
'10'
80+
]
81+
82+
runs-on: ${{ matrix.os }}
83+
84+
steps:
85+
- uses: actions/checkout@v2
86+
- name: Build and install remill
87+
shell: bash
88+
run: |
89+
# Change to master after testing
90+
git clone --depth=1 --branch master https://github.com/lifting-bits/remill.git
91+
cd remill
92+
./scripts/build.sh --llvm-version ${{ matrix.llvm }}
93+
cmake --build remill-build --target install -- -j "$(sysctl -n hw.logicalcpu)"
94+
- name: Build and install anvill
95+
shell: bash
96+
run: |
97+
# Change to master after testing
98+
git clone --depth=1 --branch master https://github.com/lifting-bits/anvill.git
99+
mkdir -p anvill/build && cd anvill/build
100+
cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
101+
cmake --build . --target install -- -j "$(sysctl -n hw.logicalcpu)"
102+
- name: Build mcsema
103+
shell: bash
104+
run: |
105+
mkdir build && cd build
106+
cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
107+
cmake --build . --target install -- -j "$(sysctl -n hw.logicalcpu)"
108+
- name: Smoke Test
109+
shell: bash
110+
run: |
111+
# --help return non-zero and fails...
112+
mcsema-lift-${{ matrix.llvm }}.0 --version
113+
mcsema-disass-2 --help

‎CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313
# You should have received a copy of the GNU Affero General Public License
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
if (NOT DEFINED ENV{TRAILOFBITS_LIBRARIES})
17+
message(STATUS "Using new vcpkg build system")
18+
include(CMakeLists_vcpkg.txt)
19+
return()
20+
endif()
21+
1622
project(mcsema)
17-
cmake_minimum_required(VERSION 3.2)
23+
cmake_minimum_required(VERSION 3.14)
1824

1925
# remill
2026
if("${PLATFORM_NAME}" STREQUAL "windows")

‎CMakeLists_vcpkg.txt

+305
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
# Copyright (c) 2020 Trail of Bits, Inc.
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU Affero General Public License as
5+
# published by the Free Software Foundation, either version 3 of the
6+
# License, or (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU Affero General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Affero General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
# Find remill first because its config has useful dependency-finding info that
17+
# needs to be found before the CMake `project` declaration
18+
find_package(remill COMPONENTS VCPKG_DEPS QUIET)
19+
20+
include(cmake/vcpkg_helper.cmake)
21+
22+
project(mcsema)
23+
include(GNUInstallDirs)
24+
cmake_minimum_required(VERSION 3.14)
25+
26+
27+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/settings.cmake")
28+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake")
29+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/BCCompiler.cmake")
30+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/ccache.cmake")
31+
32+
configureCcache()
33+
FindAndSelectClangCompiler()
34+
35+
set(MCSEMA_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
36+
37+
option(MCSEMA_ENABLE_RUNTIME "Should runtimes for re-compilation of bitcode be produced?" ON)
38+
39+
find_package(Python2 QUIET)
40+
if(Python2_FOUND)
41+
option(MCSEMA_INSTALL_PYTHON2_LIBS "Install Python 2 libraries" ON)
42+
else()
43+
option(MCSEMA_INSTALL_PYTHON2_LIBS "Install Python 2 libraries")
44+
endif()
45+
46+
find_package(Python3 QUIET)
47+
if(Python3_FOUND)
48+
option(MCSEMA_INSTALL_PYTHON3_LIBS "Install Python 3 libraries" ON)
49+
else()
50+
option(MCSEMA_INSTALL_PYTHON3_LIBS "Install Python 3 libraries")
51+
endif()
52+
53+
# warnings and compiler settings
54+
if(NOT DEFINED WIN32)
55+
set(PROJECT_CXXFLAGS
56+
${GLOBAL_CXXFLAGS}
57+
-Wconversion
58+
-pedantic
59+
-Wno-unreachable-code-return
60+
)
61+
endif()
62+
63+
#
64+
# libraries
65+
#
66+
67+
find_package(remill CONFIG REQUIRED)
68+
list(APPEND PROJECT_LIBRARIES remill)
69+
get_target_property(REMILL_INCLUDE_LOCATION remill_settings INTERFACE_INCLUDE_DIRECTORIES)
70+
71+
# protobuf
72+
# Compatibility since we use older protobuf CMake functions
73+
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "" FORCE)
74+
find_package(Protobuf CONFIG REQUIRED)
75+
list(APPEND PROJECT_LIBRARIES ${Protobuf_LIBRARIES})
76+
list(APPEND PROJECT_INCLUDEDIRECTORIES ${Protobuf_INCLUDE_DIR})
77+
list(APPEND PROJECT_DEFINITIONS "GOOGLE_PROTOBUF_NO_RTTI")
78+
79+
#
80+
# protobuf file generation
81+
#
82+
83+
# this function can't be told where to store the output files! we have to add the whole binary directory
84+
# to the include directories (or change it and lose compatibility with the system libraries)
85+
protobuf_generate_cpp(PROJECT_PROTOBUFSOURCEFILES
86+
PROJECT_PROTOBUFHEADERFILES "${CMAKE_CURRENT_SOURCE_DIR}/mcsema/CFG/CFG.proto"
87+
)
88+
89+
list(APPEND PROJECT_INCLUDEDIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
90+
91+
protobuf_generate_python(PROJECT_PROTOBUFPYTHONMODULE
92+
"${CMAKE_CURRENT_SOURCE_DIR}/mcsema/CFG/CFG.proto"
93+
)
94+
95+
add_custom_target(protobuf_python_module_ida
96+
DEPENDS ${PROJECT_PROTOBUFPYTHONMODULE}
97+
)
98+
99+
# disable -Werror on these file since they have been generated
100+
set_source_files_properties(${PROJECT_PROTOBUFSOURCEFILES} PROPERTIES
101+
COMPILE_FLAGS "-Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-conversion"
102+
)
103+
104+
set_source_files_properties(${PROJECT_PROTOBUFHEADERFILES} PROPERTIES
105+
COMPILE_FLAGS "-Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-conversion"
106+
)
107+
108+
#
109+
# target settings
110+
#
111+
112+
set(MCSEMA_LIFT mcsema-lift-${REMILL_LLVM_VERSION})
113+
114+
# for version information
115+
add_subdirectory(mcsema/Version)
116+
117+
add_executable(${MCSEMA_LIFT}
118+
${PROJECT_PROTOBUFSOURCEFILES}
119+
120+
mcsema/Arch/Arch.cpp
121+
122+
mcsema/CFG/CFG.cpp
123+
124+
mcsema/BC/Callback.cpp
125+
mcsema/BC/External.cpp
126+
mcsema/BC/Function.cpp
127+
mcsema/BC/Instruction.cpp
128+
mcsema/BC/Legacy.cpp
129+
mcsema/BC/Lift.cpp
130+
mcsema/BC/Optimize.cpp
131+
mcsema/BC/Segment.cpp
132+
mcsema/BC/Util.cpp
133+
134+
tools/mcsema_lift/Lift.cpp
135+
)
136+
137+
138+
# Copy mcsema-disass in
139+
add_custom_command(
140+
TARGET protobuf_python_module_ida POST_BUILD
141+
DEPENDS {PROJECT_PROTOBUFPYTHONMODULE}
142+
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_PROTOBUFPYTHONMODULE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/mcsema_disass/ida7
143+
)
144+
145+
# this is needed for the #include directives with absolutes paths to work correctly; it must
146+
# also be set to PUBLIC since mcsema-lift includes some files directly
147+
list(APPEND PROJECT_INCLUDEDIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
148+
149+
add_dependencies(${MCSEMA_LIFT}
150+
protobuf_python_module_ida)
151+
152+
#
153+
# libraries
154+
#
155+
156+
# anvill
157+
find_package(anvill CONFIG REQUIRED)
158+
list(APPEND PROJECT_LIBRARIES anvill-${REMILL_LLVM_VERSION})
159+
160+
# mcsema-disass
161+
162+
set(MCSEMA_PYTHON_SOURCES
163+
tools/setup.py
164+
tools/mcsema_disass/__init__.py
165+
tools/mcsema_disass/__main__.py
166+
tools/mcsema_disass/ida7/__init__.py
167+
tools/mcsema_disass/ida7/anvill_compat.py
168+
tools/mcsema_disass/ida7/arm_util.py
169+
tools/mcsema_disass/ida7/CFG_pb2.py
170+
tools/mcsema_disass/ida7/disass.py
171+
tools/mcsema_disass/ida7/exception.py
172+
tools/mcsema_disass/ida7/flow.py
173+
tools/mcsema_disass/ida7/get_cfg.py
174+
tools/mcsema_disass/ida7/refs.py
175+
tools/mcsema_disass/ida7/segment.py
176+
tools/mcsema_disass/ida7/table.py
177+
tools/mcsema_disass/ida7/util.py
178+
tools/mcsema_disass/ida7/x86_util.py
179+
)
180+
181+
if(MCSEMA_INSTALL_PYTHON2_LIBS)
182+
add_custom_target(build_mcsema_disass_python2
183+
DEPENDS ${MCSEMA_PYTHON_SOURCES})
184+
185+
add_custom_command(
186+
TARGET build_mcsema_disass_python2 POST_BUILD
187+
COMMAND which python2 && python2 setup.py build --force
188+
COMMENT "Building McSema Python 2 mcsema-disass"
189+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tools")
190+
191+
add_dependencies(${MCSEMA_LIFT}
192+
build_mcsema_disass_python2)
193+
194+
add_dependencies(build_mcsema_disass_python2
195+
protobuf_python_module_ida)
196+
endif()
197+
198+
if(MCSEMA_INSTALL_PYTHON3_LIBS)
199+
add_custom_target(build_mcsema_disass_python3
200+
DEPENDS ${MCSEMA_PYTHON_SOURCES})
201+
202+
add_custom_command(
203+
TARGET build_mcsema_disass_python3 POST_BUILD
204+
COMMAND which python3 && python3 setup.py build --force
205+
COMMENT "Building McSema Python 3 mcsema-disass"
206+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tools")
207+
208+
add_dependencies(${MCSEMA_LIFT}
209+
build_mcsema_disass_python3)
210+
211+
add_dependencies(build_mcsema_disass_python3
212+
protobuf_python_module_ida)
213+
endif()
214+
215+
#
216+
# target settings
217+
#
218+
219+
target_link_libraries(${MCSEMA_LIFT} PRIVATE ${PROJECT_LIBRARIES} McSemaVersion)
220+
target_include_directories(${MCSEMA_LIFT} SYSTEM PUBLIC ${PROJECT_INCLUDEDIRECTORIES})
221+
target_compile_definitions(${MCSEMA_LIFT} PUBLIC ${PROJECT_DEFINITIONS})
222+
target_compile_options(${MCSEMA_LIFT} PRIVATE ${PROJECT_CXXFLAGS})
223+
224+
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND MCSEMA_ENABLE_RUNTIME)
225+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mcsema/Arch/X86/Runtime)
226+
endif()
227+
228+
#TODO(artem): this may need some logic to select only ABIs compatible with current os/arch
229+
#TODO(kumarak): Disable the ABI libraries build till we don't have script to automate the generation of `ABI_libc.h`. Use pre-build library to test the --abi_libraries flag
230+
function(GetABILibraryList)
231+
file(GLOB abi_library_list RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/mcsema/OS" "${CMAKE_CURRENT_SOURCE_DIR}/mcsema/OS/*")
232+
set(GetABILibraryList_Output ${abi_library_list} PARENT_SCOPE)
233+
endfunction()
234+
235+
if(NOT MCSEMA_ABI_LIBRARY_LIST_INITIALIZED)
236+
GetABILibraryList()
237+
set(MCSEMA_DISABLED_ABI_LIBRARIES ${GetABILibraryList_Output} CACHE
238+
STRING "A semicolon-separated list of disabled ABI libraries"
239+
)
240+
241+
set(MCSEMA_ABI_LIBRARY_LIST_INITIALIZED ON CACHE INTERNAL
242+
"Whether the abi library list has been initialized or not"
243+
)
244+
endif()
245+
246+
message(STATUS "Disabled ABI libraries: ${MCSEMA_DISABLED_ABI_LIBRARIES}")
247+
message(STATUS "You can change this setting with -DMCSEMA_DISABLED_ABI_LIBRARIES:STRING=\"Name1;Name2\"")
248+
249+
GetABILibraryList()
250+
foreach(abi_library_name ${GetABILibraryList_Output})
251+
set(abi_library_path "mcsema/OS/${abi_library_name}")
252+
253+
list(FIND MCSEMA_DISABLED_ABI_LIBRARIES "${abi_library_name}" abi_lib_index)
254+
if(NOT ${abi_lib_index} EQUAL -1)
255+
message(STATUS "Skipping ABI library: ${abi_library_path}")
256+
continue()
257+
endif()
258+
259+
message(STATUS "Adding ABI library: ${abi_library_path}")
260+
add_subdirectory("${abi_library_path}")
261+
endforeach()
262+
263+
if(DEFINED WIN32)
264+
set(install_folder "${CMAKE_INSTALL_PREFIX}/mcsema")
265+
else()
266+
set(install_folder "${CMAKE_INSTALL_PREFIX}")
267+
endif()
268+
269+
install(
270+
TARGETS ${MCSEMA_LIFT}
271+
RUNTIME DESTINATION "${install_folder}/bin"
272+
LIBRARY DESTINATION "${install_folder}/lib"
273+
)
274+
275+
# target for dyninst frontend
276+
if (DEFINED BUILD_MCSEMA_DYNINST_DISASS)
277+
if(${BUILD_MCSEMA_DYNINST_DISASS} EQUAL 1)
278+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/mcsema_disass/dyninst)
279+
endif()
280+
endif()
281+
282+
set(python_package_installer "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup_launcher")
283+
if(DEFINED WIN32)
284+
string(REPLACE "/" "\\" python_package_install_path "${install_folder}")
285+
set(python_package_installer2 "${python_package_installer}.bat")
286+
set(python_package_installer3 "${python_package_installer}.bat")
287+
set(optional_interpreter "cmd.exe /C")
288+
else()
289+
set(python_package_install_path "${install_folder}")
290+
set(python_package_installer2 "${python_package_installer}_py2.sh")
291+
set(python_package_installer3 "${python_package_installer}_py3.sh")
292+
endif()
293+
294+
if(MCSEMA_INSTALL_PYTHON2_LIBS)
295+
install(CODE
296+
"execute_process(COMMAND ${optional_interpreter} \"${python_package_installer2}\" \"${python_package_install_path}\"\nWORKING_DIRECTORY \"${PROJECT_SOURCE_DIR}/tools\"\nRESULT_VARIABLE exit_code2)\n if(NOT exit_code2 EQUAL 0)\n message(FATAL_ERROR \"Failed to install the Python 2 package\")\n endif()")
297+
endif()
298+
299+
if(MCSEMA_INSTALL_PYTHON3_LIBS)
300+
install(CODE
301+
"execute_process(COMMAND ${optional_interpreter} \"${python_package_installer3}\" \"${python_package_install_path}\"\nWORKING_DIRECTORY \"${PROJECT_SOURCE_DIR}/tools\"\nRESULT_VARIABLE exit_code3)\n if(NOT exit_code3 EQUAL 0)\n message(FATAL_ERROR \"Failed to install the Python 3 package\")\n endif()")
302+
endif()
303+
304+
add_subdirectory(examples)
305+

‎Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG LLVM_VERSION=900
1+
ARG LLVM_VERSION=1000
22
ARG ARCH=amd64
33
ARG UBUNTU_VERSION=18.04
44
ARG DISTRO_BASE=ubuntu${UBUNTU_VERSION}

‎cmake/vcpkg_helper.cmake

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
set(USE_SYSTEM_DEPENDENCIES OFF CACHE BOOL "Use system dependencies instead of trying to find vcpkg")
2+
3+
if (NOT USE_SYSTEM_DEPENDENCIES)
4+
set(VCPKG_ROOT "" CACHE FILEPATH "Root directory to use for vcpkg-managed dependencies")
5+
if (VCPKG_ROOT)
6+
if (NOT EXISTS "${VCPKG_ROOT}")
7+
message(FATAL_ERROR "VCPKG_ROOT directory does not exist: '${VCPKG_ROOT}'")
8+
endif()
9+
10+
set(VCPKG_ROOT_INSTALL_DIR "${VCPKG_ROOT}/installed")
11+
if (NOT EXISTS "${VCPKG_ROOT_INSTALL_DIR}")
12+
message(FATAL_ERROR "VCPKG_ROOT installation directory does not exist: '${VCPKG_ROOT_INSTALL_DIR}'")
13+
endif()
14+
15+
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "" FORCE)
16+
else()
17+
message(FATAL_ERROR "Please define a path to VCPKG_ROOT. See https://github.com/trailofbits/cxx-common for more details. Or if you don't want to use vcpkg dependencies, add '-DUSE_SYSTEM_DEPENDENCIES=ON'")
18+
endif()
19+
20+
# Set default triplet to Release VCPKG build unless we can't find it
21+
if (NOT DEFINED VCPKG_TARGET_TRIPLET)
22+
if (APPLE)
23+
set(_project_vcpkg_triplet "x64-osx-rel")
24+
elseif(UNIX)
25+
set(_project_vcpkg_triplet "x64-linux-rel")
26+
else()
27+
message(FATAL_ERROR "Could not detect default release triplet")
28+
endif()
29+
30+
if (NOT EXISTS "${VCPKG_ROOT_INSTALL_DIR}/${_project_vcpkg_triplet}")
31+
message(STATUS "Could not find installed project-default triplet '${_project_vcpkg_triplet}' using vcpkg-default for your system")
32+
else()
33+
set(VCPKG_TARGET_TRIPLET "${_project_vcpkg_triplet}" CACHE STRING "")
34+
message(STATUS "Setting default vcpkg triplet to release-only libraries: ${VCPKG_TARGET_TRIPLET}")
35+
endif()
36+
endif()
37+
38+
if (DEFINED VCPKG_TARGET_TRIPLET AND NOT EXISTS "${VCPKG_ROOT_INSTALL_DIR}/${VCPKG_TARGET_TRIPLET}")
39+
message(FATAL_ERROR "Could not find vcpkg triplet (${VCPKG_TARGET_TRIPLET}) installation libraries '${VCPKG_ROOT_INSTALL_DIR}/${VCPKG_TARGET_TRIPLET}'.")
40+
endif()
41+
42+
message(STATUS "Using vcpkg installation directory at '${VCPKG_ROOT_INSTALL_DIR}/${VCPKG_TARGET_TRIPLET}'")
43+
endif()

‎mcsema/Arch/X86/Runtime/CMakeLists.txt

+13-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ elseif(APPLE)
3535
#TODO(artem): Support runtimes on MacOS
3636
message(WARNING "Runtime generation is not supported for your operating system. mcsema-lift will still work, but you can't rebuild the generated bitcode to native executables.")
3737

38-
else()
38+
else()
3939
# Create the runtimes
4040

4141
set(MCSMEMA_RT64 mcsema_rt64-${LLVM_MAJOR_VERSION}.${LLVM_MINOR_VERSION})
@@ -48,7 +48,12 @@ else()
4848
)
4949

5050
# this is going to import the public include headers of remill
51-
target_link_libraries(mcsema-print-runtime-amd64 PRIVATE remill)
51+
if (DEFINED ENV{TRAILOFBITS_LIBRARIES})
52+
target_link_libraries(mcsema-print-runtime-amd64 PRIVATE remill)
53+
else()
54+
# include directory was moved to public interface library for vcpkg
55+
target_link_libraries(mcsema-print-runtime-amd64 PRIVATE remill_settings remill)
56+
endif()
5257
target_include_directories(mcsema-print-runtime-amd64 PRIVATE
5358
"${REMILL_INCLUDE_LOCATION}" "${MCSEMA_SOURCE_DIR}"
5459
)
@@ -96,7 +101,12 @@ else()
96101
)
97102

98103
# this is going to import the public include headers of remill
99-
target_link_libraries(mcsema-print-runtime-amd64 PRIVATE remill)
104+
if (DEFINED ENV{TRAILOFBITS_LIBRARIES})
105+
target_link_libraries(mcsema-print-runtime-amd64 PRIVATE remill)
106+
else()
107+
# include directory was moved to public interface library for vcpkg
108+
target_link_libraries(mcsema-print-runtime-amd64 PRIVATE remill_settings remill)
109+
endif()
100110

101111
target_include_directories(mcsema-print-runtime-amd64 PRIVATE
102112
"${REMILL_INCLUDE_LOCATION}" "${MCSEMA_SOURCE_DIR}"

0 commit comments

Comments
 (0)
This repository has been archived.