add bazel and cmake file for Half lib (#3906)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e37de7a..474109c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -405,6 +405,7 @@
include(flatbuffer_cc_library)
add_subdirectory(build_tools/third_party/flatcc EXCLUDE_FROM_ALL)
+add_subdirectory(build_tools/third_party/half EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/pffft EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/renderdoc_api EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/ruy EXCLUDE_FROM_ALL)
diff --git a/WORKSPACE b/WORKSPACE
index 6698025..8530017 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -293,6 +293,13 @@
path = "third_party/pffft",
)
+maybe(
+ new_local_repository,
+ name = "half",
+ build_file = "build_tools/third_party/half/BUILD.overlay",
+ path = "third_party/half",
+)
+
GOOGLE_RESEARCH_COMMIT = "a5213e2c92c3e87849fe417ba42786d0324e7c75"
http_archive(
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
index 5a23bc1..abc31ce 100644
--- a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
@@ -73,6 +73,7 @@
"@pffft//:pffft": ["pffft"],
"@sdl2//:SDL2": ["SDL2-static"],
"@com_github_pytorch_cpuinfo//:cpuinfo": ["cpuinfo"],
+ "@half//:half": ["half"],
}
diff --git a/build_tools/third_party/half/BUILD.overlay b/build_tools/third_party/half/BUILD.overlay
new file mode 100644
index 0000000..33671b7
--- /dev/null
+++ b/build_tools/third_party/half/BUILD.overlay
@@ -0,0 +1,22 @@
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+ name = "half",
+ hdrs = ["half.hpp"],
+ include_prefix = "third_party/half",
+)
diff --git a/build_tools/third_party/half/CMakeLists.txt b/build_tools/third_party/half/CMakeLists.txt
new file mode 100644
index 0000000..84f9ade
--- /dev/null
+++ b/build_tools/third_party/half/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set(HALF_API_ROOT "${IREE_ROOT_DIR}/third_party/half/")
+
+external_cc_library(
+ PACKAGE
+ half
+ NAME
+ half
+ ROOT
+ ${HALF_API_ROOT}
+ HDRS
+ "half.hpp"
+)