From 32c09c00290fe47dac301bae3f8cf48d17344885 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Sat, 30 Dec 2023 00:38:51 -0800 Subject: [PATCH] Prefer system-provided robin-map (#248) * Prefer system-provided robin-map * Use find_package * Use submodule * PR feedback * Include FetchContent --- .github/workflows/main.yml | 4 ---- .gitmodules | 3 --- ANNOUNCE | 10 ---------- CMakeLists.txt | 18 +++++++++++------- INSTALL | 9 --------- arc.mm | 2 +- selector_table.cc | 2 +- third_party/robin-map | 1 - 8 files changed, 13 insertions(+), 36 deletions(-) delete mode 100644 .gitmodules delete mode 160000 third_party/robin-map diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d74a16d..1d53680 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,8 +44,6 @@ jobs: name: ${{ matrix.os }} ${{ matrix.build-type }} LLVM-${{ matrix.llvm-version }} ${{ matrix.cxxlib }} steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Install dependencies run: | sudo apt install ninja-build @@ -92,8 +90,6 @@ jobs: name: Cross-build for ${{ matrix.arch.triple }} LLVM-${{ matrix.llvm-version}} ${{ matrix.build-type }} steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Install cross-compile toolchain and QEMU run: | sudo apt update diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 5f12667..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "third_party/robin-map"] - path = third_party/robin-map - url = https://github.com/Tessil/robin-map diff --git a/ANNOUNCE b/ANNOUNCE index d0e288e..404e75c 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -37,16 +37,6 @@ Alternatively, a tarball is available from: https://github.com/gnustep/libobjc2/archive/v2.2.zip https://github.com/gnustep/libobjc2/archive/v2.2.tar.gz -The submodule is available from: - -https://github.com/Tessil/robin-map/archive/d37a410.zip -https://github.com/Tessil/robin-map/archive/d37a410.tar.gz - -This will extract as robin-map-d37a41003bfbc7e12e34601f93c18ca2ff6d7c07. -You must move the contents of that directory into third_party/robin_map in the -libobjc2 tree. - - The runtime library is responsible for implementing the core features of the object model, as well as exposing introspection features to the user. The GNUstep runtime implements a superset of Apple's Objective-C Runtime APIs. diff --git a/CMakeLists.txt b/CMakeLists.txt index 5387b47..d55a8e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ endif() enable_language(OBJC OBJCXX) INCLUDE (CheckCXXSourceCompiles) +INCLUDE (FetchContent) set(libobjc_VERSION 4.6) @@ -120,14 +121,16 @@ else () list(APPEND libobjc_C_SRCS eh_personality.c) endif (WIN32) -if (NOT EXISTS "${CMAKE_SOURCE_DIR}/third_party/robin-map/include/tsl/robin_map.h") - message(FATAL_ERROR "Git submodules not present, please run:\n\n" - " $ git submodule init && git submodule update\n\n" - "If you did not checkout via git, you will need to" - "fetch the submodule's contents from" - "https://github.com/Tessil/robin-map/") -endif () +find_package(tsl-robin-map) + +if (NOT tls-robin-map_FOUND) + FetchContent_Declare( + robinmap + GIT_REPOSITORY https://github.com/Tessil/robin-map/ + GIT_TAG v1.2.1) + FetchContent_MakeAvailable(robinmap) +endif() if (WIN32) set(OLD_ABI_COMPAT_DEFAULT false) @@ -235,6 +238,7 @@ if (WIN32) target_link_libraries(objc ntdll.dll) endif() +target_link_libraries(objc tsl::robin_map) set_target_properties(objc PROPERTIES LINKER_LANGUAGE C diff --git a/INSTALL b/INSTALL index 10378d7..a91268f 100644 --- a/INSTALL +++ b/INSTALL @@ -14,15 +14,6 @@ things that can be used by other programs that actually perform the building. I recommend that you use Ninja for building if you are compiling regularly, but these instructions will use Make to avoid the need for an extra dependency. -When checking out the code make sure you check out git submodules as well -either by using - - $ git checkout --recursive - -or by getting submodules after checkout using - - $ git submodule update --init - After checking out the code, build as follows: $ mkdir Build diff --git a/arc.mm b/arc.mm index debb8be..5a4cc89 100644 --- a/arc.mm +++ b/arc.mm @@ -7,7 +7,7 @@ #include #include #include -#include "third_party/robin-map/include/tsl/robin_map.h" +#include #import "lock.h" #import "objc/runtime.h" #import "objc/blocks_runtime.h" diff --git a/selector_table.cc b/selector_table.cc index e028144..d7d5629 100644 --- a/selector_table.cc +++ b/selector_table.cc @@ -11,7 +11,7 @@ #include #include #include -#include "third_party/robin-map/include/tsl/robin_set.h" +#include #include "class.h" #include "lock.h" #include "method.h" diff --git a/third_party/robin-map b/third_party/robin-map deleted file mode 160000 index d37a410..0000000 --- a/third_party/robin-map +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d37a41003bfbc7e12e34601f93c18ca2ff6d7c07