vcpkg/ports/zeroc-ice/prepare_for_build.cmake
Benjamin Oldenburg 1c9b23ba2b
[zeroc-ice] New port (#23764)
* Initial commit

* clean up

* updated manifest and version

* Removed C++11 mapping option (feature) and made C++11 the default mapping.

* updated version

* added main target

added entries to ci.baseline.txt

* corrected ci.baseline.txt entries

* updated version

* fixed generated header path

* Updated version

* fixed include paths

* updated version

* expect x64-windows-static to fail

* added patches for clang 13

* update version

* Update ports/zeroc-ice/portfile.cmake

Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>

* 2->4 spaces

* Removed v144/5 stuff

* check for .DS_Store file before deletion

* several changes

* format vcpkg.json

* update version

* remove typo

* updated version

* reformatting

* resolve review issues

* regex

* updated version

* windows-static

* allow static builds on windows and added maintainer

* updated version

* added openssl as a dependency for Ice core library

* updated version

* minor updates

Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2022-04-13 10:48:49 -07:00

61 lines
2.5 KiB
CMake

# This function removes hardcoded RuntimeLibrary directives from Ice's vcxproh files and downloads
# Ice Builder for MSBuild, which is required to generate C++ files based on the interface definition
# files (.ice).
function(prepare_for_build ICE_SOURCE_DIR)
message("-- Removing hardcoded 'RuntimeLibrary' directives from .vcxproj files")
set(CPP_SOURCE_DIR "${ICE_SOURCE_DIR}/cpp/src")
file(GLOB_RECURSE PROJ_FILES "${CPP_SOURCE_DIR}/*.vcxproj")
foreach(PROJ_FILE ${PROJ_FILES})
file(READ ${PROJ_FILE} PROJ_FILE_CONTENT)
STRING(REGEX
REPLACE
"<Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">"
"<Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\" Condition=\"'$(UseVcpkg)' != 'yes'\">"
PROJ_FILE_CONTENT
"${PROJ_FILE_CONTENT}"
)
STRING(REGEX
REPLACE
"<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>"
""
PROJ_FILE_CONTENT
"${PROJ_FILE_CONTENT}"
)
STRING(REGEX
REPLACE
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>"
""
PROJ_FILE_CONTENT
"${PROJ_FILE_CONTENT}"
)
file(WRITE ${PROJ_FILE} "${PROJ_FILE_CONTENT}")
endforeach()
set(ICE_CPP_MSBUILD_PACKAGES_DIR "${ICE_SOURCE_DIR}/cpp/msbuild/packages")
set(ICE_BUILDER_DEST_DIRECTORY "${ICE_CPP_MSBUILD_PACKAGES_DIR}/zeroc.icebuilder.msbuild.5.0.7")
if(NOT EXISTS "${ICE_BUILDER_DEST_DIRECTORY}")
message("-- Making Ice Builder for MSBuild available")
vcpkg_download_distfile(
ICE_BUILDER_MSBUILD_ARCHIVE
URLS https://globalcdn.nuget.org/packages/zeroc.icebuilder.msbuild.5.0.7.nupkg
FILENAME zeroc.icebuilder.msbuild.5.0.7.zip
SHA512 d4afed8a3c67daf2e1cde09e7747ec9f088fa1354069bb7c7782c1089ea0f4e50b669f45a88502ad341dbccafbc1394d74fe764479f25bf4be1d3f70e66cb174
)
vcpkg_extract_source_archive(
ICE_BUILDER_MSBUILD_DIRECTORY
ARCHIVE
"${ICE_BUILDER_MSBUILD_ARCHIVE}"
NO_REMOVE_ONE_LEVEL
SOURCE_BASE icebuilder
)
file(MAKE_DIRECTORY "${ICE_SOURCE_DIR}/cpp/msbuild/packages")
file(RENAME "${ICE_BUILDER_MSBUILD_DIRECTORY}" "${ICE_BUILDER_DEST_DIRECTORY}")
endif()
endfunction()