rules_qt6 icon indicating copy to clipboard operation
rules_qt6 copied to clipboard

macOS: Make ``rules_qt6`` independent of local installation for macOS

Open Vertexwahn opened this issue 2 years ago • 0 comments

On Windows and Ubunutu no local installation of Qt is needed, since a prebuild version is fetched.

This does currently not work for macOS (must work for Intel and ARM (e.g. M1))

I uploaded a prebuild version for macOS (Intel) here: https://vertexwahn.de/lfs/v1/qt_6.4.0_mac_desktop_clang_64.tar.xz

More hints to the rebuild Qt Versions can be found here: https://github.com/Vertexwahn/rules_qt6/blob/main/docs/prebuild_qt_versions.md

Maybe it makes sense to use aqt directly instead of downloading from vertexwahn.de.

Maybe the following example can be adapted to fetch Qt packages via aqt:

http_archive(
    name = "python_interpreter",
    build_file_content = """
exports_files(["python_bin"])
filegroup(
    name = "files",
    srcs = glob(["bazel_install/**"], exclude = ["**/* *"]),
    visibility = ["//visibility:public"],
)
""",
    patch_cmds = [
        "mkdir $(pwd)/bazel_install",
        _configure_python_based_on_os,
        "make",
        "make install",
        "ln -s bazel_install/bin/python3 python_bin",
    ],
    sha256 = "dfab5ec723c218082fe3d5d7ae17ecbdebffa9a1aea4d64aa3a2ecdd2e795864",
    strip_prefix = "Python-3.8.3",
    urls = ["https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tar.xz"],
)

or this example:

genrule(
  name = "build_tbb",
  srcs = glob(["**"]) + [
    "@local_config_cc//:toolchain",
  ],
  cmd = """
         set -e
         WORK_DIR=$$PWD
         DEST_DIR=$$PWD/$(@D)
         export PATH=$$(dirname $(AR)):$$PATH
         export CC=$$PWD/$(C_COMPILER)
         export CXX=$$PWD/$(CC)
         export CXXFLAGS=$(CC_FLAGS)
         export NM=$(NM)
         export AR=$(AR)
         cd $$(dirname $(location :Makefile))

         #TBB's build needs some help to figure out what compiler it's using
         if $$CXX --version | grep clang &> /dev/null; then 
           COMPILER_OPT="compiler=clang"
         else
           COMPILER_OPT="compiler=gcc"
         fi 

         # uses extra_inc=big_iron.inc to specify that static libraries are
         # built. See https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/297792
         make tbb_build_prefix="build" \
              extra_inc=big_iron.inc \
              $$COMPILER_OPT; \

         echo cp build/build_{release,debug}/*.a $$DEST_DIR
         cp build/build_{release,debug}/*.a $$DEST_DIR
         cd $$WORK_DIR
  """,
  outs = [
    "libtbb.a",
    "libtbbmalloc.a",
  ] 
)

cc_library(
    name = "tbb",
    hdrs = glob([
        "include/serial/**",
        "include/tbb/**/**",
        ]),
    srcs = ["libtbb.a"],
    includes = ["include"],
    visibility = ["//visibility:public"],
)

Vertexwahn avatar Nov 12 '22 21:11 Vertexwahn