tkonolige commented on a change in pull request #7153: URL: https://github.com/apache/tvm/pull/7153#discussion_r572291038
########## File path: cmake/modules/Libbacktrace.cmake ########## @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# +# http://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. +include(ExternalProject) + +# Git tag for libbacktrace +set(TAG dedbe13fda00253fe5d4f2fb812c909729ed5937) + +ExternalProject_Add(project_libbacktrace + PREFIX libbacktrace + GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git + GIT_TAG "${TAG}" + CONFIGURE_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace/src/project_libbacktrace/configure" + "--prefix=${CMAKE_CURRENT_BINARY_DIR}/libbacktrace" --with-pic + INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace" + BUILD_COMMAND make + INSTALL_COMMAND make install + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace/lib/libbacktrace.a" + "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace/include/backtrace.h" + # disable the builtin update because it rebuilds on every build + UPDATE_COMMAND "" + ) + +# Only rebuild libbacktrace if this file changes +# libbacktrace has a bug on macOS with shared libraries, so we patch it here +ExternalProject_Add_Step(project_libbacktrace checkout Review comment: There are actually two sets of choices here: 1. How do we handle patching libbacktrace and 2. Where do we get the libbacktrace repo from. For 1, I decided to include a local patching instead of a fork of the repo because I wasn't sure about how people would feel about TVM depending on a repo I control (and I wasn't sure about if apache would let us fork a repo to their GitHub account) For 2, I think the fetching at configure time from an external repo to be easier than using a submodule. Switching branches with submodules is very awkward. Often people forget to run `git submodule update` and we get PRs that accidentally change submodule commits. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
