Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg] Fix unrecognized identifier errors in prbuild and cibuild. #15354

Merged
merged 4 commits into from
Jan 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions ports/tensorflow-cc/CONTROL

This file was deleted.

8 changes: 4 additions & 4 deletions ports/tensorflow-cc/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ vcpkg_fail_port_install(ON_ARCH "x86" "arm" ON_TARGET "UWP")

set(TF_LIB_SUFFIX "_cc")
set(TF_PORT_SUFFIX "-cc")
set(TF_INCLUDE_DIRS "${INSTALL_PREFIX}/${TARGET_TRIPLET}/include/tensorflow-external
${INSTALL_PREFIX}/${TARGET_TRIPLET}/include/tensorflow-external/src")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../tensorflow-common")
set(TF_INCLUDE_DIRS "${CURRENT_INSTALLED_DIR}/include/tensorflow-external
${CURRENT_INSTALLED_DIR}/include/tensorflow-external/src")
list(APPEND CMAKE_MODULE_PATH "${CURRENT_INSTALLED_DIR}/share/tensorflow-common")
include(tensorflow-common)

file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow-external)
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow-external")
11 changes: 11 additions & 0 deletions ports/tensorflow-cc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "tensorflow-cc",
"version-string": "2.3.1",
"port-version": 2,
"description": "Library for computation using data flow graphs for scalable machine learning (C++ API version)",
"homepage": "https://github.com/tensorflow/tensorflow",
"supports": "!(x86 | arm | uwp)",
"dependencies": [
"tensorflow-common"
]
}
6 changes: 0 additions & 6 deletions ports/tensorflow-common/CONTROL

This file was deleted.

23 changes: 23 additions & 0 deletions ports/tensorflow-common/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) Microsoft Corporation

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 27 additions & 1 deletion ports/tensorflow-common/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
message(FATAL_ERROR "This meta package holds common files for the C [tensorflow] and the C++ [tensorflow-cc] API version of TensorFlow but is not installable on its own.")
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

set(TENSORFLOW_FILES
"${CMAKE_CURRENT_LIST_DIR}/change-macros-for-static-lib.patch"
"${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_linux.py"
"${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_windows.py"
"${CMAKE_CURRENT_LIST_DIR}/fix-build-error.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-dbg-build-errors.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-linux-build.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-more-build-errors.patch"
"${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_linux.py"
"${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_macos.py"
"${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_windows.py"
"${CMAKE_CURRENT_LIST_DIR}/README-linux"
"${CMAKE_CURRENT_LIST_DIR}/README-macos"
"${CMAKE_CURRENT_LIST_DIR}/README-windows"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-common.cmake"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-shared.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-static.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-windows-dll.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-windows-lib.cmake.in"
)

file(COPY ${TENSORFLOW_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

# Use vcpkg's license
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
12 changes: 6 additions & 6 deletions ports/tensorflow-common/tensorflow-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ else()
endif()

foreach(BUILD_TYPE dbg rel)
# prefer repeated source extraction here for each build type over extracting once above the loop and copying because users reported issues with copying symlinks
# prefer repeated source extraction here for each build type over extracting once above the loop and copying because users reported issues with copying symlinks
set(STATIC_ONLY_PATCHES)
set(LINUX_ONLY_PATCHES)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(STATIC_ONLY_PATCHES ../tensorflow-common/change-macros-for-static-lib.patch) # there is no static build option - change macros via patch and link library manually at the end
set(STATIC_ONLY_PATCHES "${CMAKE_CURRENT_LIST_DIR}/change-macros-for-static-lib.patch") # there is no static build option - change macros via patch and link library manually at the end
endif()
if(VCPKG_TARGET_IS_LINUX)
set(LINUX_ONLY_PATCHES ../tensorflow-common/fix-linux-build.patch)
set(LINUX_ONLY_PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-linux-build.patch")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -126,9 +126,9 @@ foreach(BUILD_TYPE dbg rel)
SHA512 e497ef4564f50abf9f918be4522cf702f4cf945cb1ebf83af1386ac4ddc7373b3ba70c7f803f8ca06faf2c6b5396e60b1e0e9b97bfbd667e733b08b6e6d70ef0
HEAD_REF master
PATCHES
../tensorflow-common/fix-build-error.patch # Fix namespace error
../tensorflow-common/fix-dbg-build-errors.patch # Fix no return statement
../tensorflow-common/fix-more-build-errors.patch # Fix no return statement
"${CMAKE_CURRENT_LIST_DIR}/fix-build-error.patch" # Fix namespace error
"${CMAKE_CURRENT_LIST_DIR}/fix-dbg-build-errors.patch" # Fix no return statement
"${CMAKE_CURRENT_LIST_DIR}/fix-more-build-errors.patch" # Fix no return statement
${STATIC_ONLY_PATCHES}
${LINUX_ONLY_PATCHES}
)
Expand Down
7 changes: 7 additions & 0 deletions ports/tensorflow-common/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "tensorflow-common",
"version-string": "2.3.1",
"port-version": 1,
"description": "This meta package holds common files for the C [tensorflow] and the C++ [tensorflow-cc] API version of TensorFlow but is not installable on its own.",
"homepage": "https://github.com/tensorflow/tensorflow"
}
6 changes: 0 additions & 6 deletions ports/tensorflow/CONTROL

This file was deleted.

26 changes: 13 additions & 13 deletions ports/tensorflow/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ vcpkg_fail_port_install(ON_ARCH "x86" "arm" ON_TARGET "uwp")

set(TF_LIB_SUFFIX "")
set(TF_PORT_SUFFIX "")
set(TF_INCLUDE_DIRS "${INSTALL_PREFIX}/${TARGET_TRIPLET}/include")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../tensorflow-common")
set(TF_INCLUDE_DIRS "${CURRENT_INSTALLED_DIR}/include")
list(APPEND CMAKE_MODULE_PATH "${CURRENT_INSTALLED_DIR}/share/tensorflow-common")
include(tensorflow-common)

file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/c_api.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/c_api_experimental.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tensor_interface.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_attrtype.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_datatype.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_file_statistics.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_status.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_tensor.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/eager/c_api.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c/eager)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/eager/c_api_experimental.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c/eager)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/eager/dlpack.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/tensorflow/c/eager)
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/c_api.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/c_api_experimental.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tensor_interface.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_attrtype.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_datatype.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_file_statistics.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_status.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/tf_tensor.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/eager/c_api.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c/eager")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/eager/c_api_experimental.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c/eager")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bazel-bin/tensorflow/include/tensorflow/c/eager/dlpack.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/tensorflow/c/eager")
11 changes: 11 additions & 0 deletions ports/tensorflow/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "tensorflow",
"version-string": "2.3.1",
"port-version": 1,
"description": "Library for computation using data flow graphs for scalable machine learning (C API version)",
"homepage": "https://github.com/tensorflow/tensorflow",
"supports": "!(x86 | arm | uwp)",
"dependencies": [
"tensorflow-common"
]
}
3 changes: 3 additions & 0 deletions toolsrc/src/vcpkg/platform-expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace vcpkg::PlatformExpression
uwp,
android,
emscripten,
ios,

static_link,
};
Expand All @@ -48,6 +49,7 @@ namespace vcpkg::PlatformExpression
{"uwp", Identifier::uwp},
{"android", Identifier::android},
{"emscripten", Identifier::emscripten},
{"ios", Identifier::ios},
{"static", Identifier::static_link},
};

Expand Down Expand Up @@ -392,6 +394,7 @@ namespace vcpkg::PlatformExpression
case Identifier::android: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "Android");
case Identifier::emscripten:
return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "Emscripten");
case Identifier::ios: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "iOS");
case Identifier::wasm32: return true_if_exists_and_equal("VCPKG_TARGET_ARCHITECTURE", "wasm32");
case Identifier::static_link:
return true_if_exists_and_equal("VCPKG_LIBRARY_LINKAGE", "static");
Expand Down