vcpkg/ports/unicorn/portfile.cmake
Alexander Karatarakis 6ad96b7e7a 2018.05.17 updates
2018-05-17 22:56:05 -07:00

59 lines
2.3 KiB
CMake

include(vcpkg_common_functions)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "WindowsStore not supported")
endif()
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic" AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
message(FATAL_ERROR "unicorn can currently only be built with /MT or /MTd (static CRT linkage)")
endif()
# Note: this is safe because unicorn is a C library and takes steps to avoid memory allocate/free across the DLL boundary.
set(VCPKG_CRT_LINKAGE "static")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO unicorn-engine/unicorn
REF 19ffa83d4353af8834c4c55590ca2ecd357a6bbe
SHA512 db09f91da1f0611663200ca1add7f878e677d3df4faebdb38e68e96a795c1d2bb7bf5b4af44d9b92fc91a1c1f18a89862a0aa3f12ef8a1277d8bfdf94b0b5020
HEAD_REF master
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(UNICORN_PLATFORM "Win32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(UNICORN_PLATFORM "x64")
else()
message(FATAL_ERROR "Unsupported architecture")
endif()
vcpkg_build_msbuild(
PROJECT_PATH "${SOURCE_PATH}/msvc/unicorn.sln"
PLATFORM "${UNICORN_PLATFORM}"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(INSTALL "${SOURCE_PATH}/msvc/${UNICORN_PLATFORM}/Release/unicorn.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${SOURCE_PATH}/msvc/${UNICORN_PLATFORM}/Release/unicorn.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(INSTALL "${SOURCE_PATH}/msvc/${UNICORN_PLATFORM}/Debug/unicorn.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(INSTALL "${SOURCE_PATH}/msvc/${UNICORN_PLATFORM}/Debug/unicorn.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
else()
file(INSTALL "${SOURCE_PATH}/msvc/${UNICORN_PLATFORM}/Release/unicorn_static.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${SOURCE_PATH}/msvc/${UNICORN_PLATFORM}/Debug/unicorn_static.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()
file(
INSTALL "${SOURCE_PATH}/msvc/distro/include/unicorn"
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
RENAME "unicorn"
)
file(
INSTALL "${SOURCE_PATH}/COPYING"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/unicorn"
RENAME "copyright"
)
file(
INSTALL "${SOURCE_PATH}/COPYING_GLIB"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/unicorn"
)