Skip to content

Commit

Permalink
vcpkg: Support Windows and arm64 (#87)
Browse files Browse the repository at this point in the history
* Fixup errors found when compiling on Windows

* Support aarch64 and Windows triplets

* Conditional link to remill_settings for new vcpkg build

* Fix python2.7 get-pip.py
  • Loading branch information
ekilmer authored Feb 2, 2021
1 parent bc89e60 commit 613e3c5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN apt-get update && \
apt-get install -qqy ninja-build python2.7 python3.8 python3-pip python3.8-venv liblzma-dev zlib1g-dev libtinfo-dev curl git wget build-essential ninja-build ccache clang && \
rm -rf /var/lib/apt/lists/*
# needed for 20.04 support until we migrate to py3
RUN curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py && python2.7 get-pip.py
RUN curl https://bootstrap.pypa.io/2.7/get-pip.py --output get-pip.py && python2.7 get-pip.py

RUN update-alternatives --install /usr/bin/python2 python2 /usr/bin/python2.7 1

Expand Down
4 changes: 4 additions & 0 deletions bin/Bitcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include <sstream>
#include <string>

#ifdef _WIN32
#define STDOUT_FILENO 1
#endif

#if __has_include(<llvm/Support/JSON.h>)

# include <llvm/Support/JSON.h>
Expand Down
18 changes: 16 additions & 2 deletions cmake/vcpkg_helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,24 @@ if (NOT USE_SYSTEM_DEPENDENCIES)

# Set default triplet to Release VCPKG build unless we can't find it
if (NOT DEFINED VCPKG_TARGET_TRIPLET)
set(_project_arch "x64")
if (UNIX)
execute_process(COMMAND uname -m
OUTPUT_VARIABLE _SYSTEM_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
message(WARNING "No detection of architecture for this platform. Assuming x64")
endif()
if (_SYSTEM_ARCH MATCHES "^[Aa][Aa][Rr][Cc][Hh]64$")
set(_project_arch "arm64")
endif()

if (APPLE)
set(_project_vcpkg_triplet "x64-osx-rel")
set(_project_vcpkg_triplet "${_project_arch}-osx-rel")
elseif(UNIX)
set(_project_vcpkg_triplet "x64-linux-rel")
set(_project_vcpkg_triplet "${_project_arch}-linux-rel")
elseif(WIN32)
set(_project_vcpkg_triplet "${_project_arch}-windows-static-md-rel")
else()
message(FATAL_ERROR "Could not detect default release triplet")
endif()
Expand Down
1 change: 1 addition & 0 deletions include/anvill/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <llvm/IR/CallingConv.h>

#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
Expand Down
4 changes: 4 additions & 0 deletions lib/Version/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ add_library(AnvillVersion STATIC
${POST_CONFIGURE_FILE}
${Version_PUBLIC_H}
)
# Needed for compilation settings
if (NOT DEFINED ENV{TRAILOFBITS_LIBRARIES})
target_link_libraries(AnvillVersion PRIVATE remill_settings)
endif()
target_include_directories(AnvillVersion PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
Expand Down

0 comments on commit 613e3c5

Please sign in to comment.