Skip to content

Commit

Permalink
Merge pull request #5003 from myd7349/issue-3374-3385
Browse files Browse the repository at this point in the history
[libsodium] Fix #3374, #3385
  • Loading branch information
Rastaban committed Dec 23, 2018
2 parents 64f8485 + cb1b311 commit 27aa5a4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ports/libsodium/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ else()
set(LIBSODIUM_DEBUG_CONFIGURATION Debug)
endif()

vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/libsodium.vcxproj
RELEASE_CONFIGURATION ${LIBSODIUM_RELEASE_CONFIGURATION}
DEBUG_CONFIGURATION ${LIBSODIUM_DEBUG_CONFIGURATION}
)

IF(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSE()
SET(BUILD_ARCH ${VCPKG_TARGET_ARCHITECTURE})
ENDIF()

vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/libsodium.vcxproj
RELEASE_CONFIGURATION ${LIBSODIUM_RELEASE_CONFIGURATION}
DEBUG_CONFIGURATION ${LIBSODIUM_DEBUG_CONFIGURATION}
OPTIONS
/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/builds/msvc/properties/${BUILD_ARCH}.props
)

file(INSTALL
${SOURCE_PATH}/src/libsodium/include/sodium.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include
Expand All @@ -45,6 +47,12 @@ file(INSTALL
DESTINATION ${CURRENT_PACKAGES_DIR}/include/sodium
)

if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(READ ${CURRENT_PACKAGES_DIR}/include/sodium/export.h _contents)
string(REPLACE "#ifdef SODIUM_STATIC" "#if 1 //#ifdef SODIUM_STATIC" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/sodium/export.h "${_contents}")
endif ()

if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(INSTALL
${SOURCE_PATH}/Build/${LIBSODIUM_RELEASE_CONFIGURATION}/${BUILD_ARCH}/libsodium.dll
Expand Down

0 comments on commit 27aa5a4

Please sign in to comment.