clipper2.mk.in (2991B)
1 # Copyright (C) 2023-2026 |Méso|Star> (contact@meso-star.com) 2 # 3 # This file is part of Star-Build. 4 # 5 # Star-Build is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # Star-Build is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with Star-Build. If not, see <http://www.gnu.org/licenses/>. 17 18 # Configuration macros 19 CLIPPER2_TAG=TAG 20 CLIPPER2_URL_ONLINE = https://github.com/AngusJohnson/Clipper2 21 CLIPPER2_URL_OFFLINE = $(MIRROR)/Clipper2 22 CLIPPER2_URL = $(CLIPPER2_URL_$(NETWORK)) 23 24 # Helper macros 25 CLIPPER2_DIR=$(CACHE)/clipper2/$(CLIPPER2_TAG) 26 CLIPPER2_CMAKE_OPTIONS =\ 27 ifelse(TAG, Clipper2_1.1.1, -DCMAKE_CXX_FLAGS=-Wno-template-id-cdtor)\ 28 -DCMAKE_BUILD_TYPE=Release\ 29 -DCMAKE_INSTALL_LIBDIR="lib"\ 30 -DCLIPPER2_TESTS=0\ 31 -DCLIPPER2_UTILS=0\ 32 -DCLIPPER2_EXAMPLES=0\ 33 -DBUILD_SHARED_LIBS=1 34 35 clipper2: build_clipper2 36 @prefix="$$(cat .prefix)" && \ 37 cd -- "$(CLIPPER2_DIR)/CPP/build" && \ 38 cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. > /dev/null 2>&1 && \ 39 $(MAKE) install 40 41 build_clipper2: $(CLIPPER2_DIR) $(CLIPPER2_DIR)/patch 42 @cd -- "$(CLIPPER2_DIR)/CPP/build" && \ 43 cmake $(CLIPPER2_CMAKE_OPTIONS) .. && \ 44 $(MAKE) 45 46 $(CLIPPER2_DIR): 47 @git clone --branch "$(CLIPPER2_TAG)" --depth 1 "$(CLIPPER2_URL)" $@ 48 @mkdir -p "$@/CPP/build" 49 50 $(CLIPPER2_DIR)/patch: $(CLIPPER2_DIR) 51 # Version number is wrong 52 sed -i 's/ VERSION 1\.1\.0 / VERSION 1.1.1 /' \ 53 "$(CLIPPER2_DIR)/CPP/CMakeLists.txt" 54 # Missing LIBRARY DESTINATION for targets (cmake fails) 55 re="install(TARGETS Clipper2 Clipper2Z"; \ 56 sed -i "s/^$${re}$$/$${re} LIBRARY DESTINATION \$${CMAKE_INSTALL_LIBDIR}/" \ 57 "$(CLIPPER2_DIR)/CPP/CMakeLists.txt" 58 # Missing cstdint (compilation fails) 59 re="#include <climits>"; \ 60 sed -i "s/^$${re}$$/$${re}\n#include <cstdint>/" \ 61 "$(CLIPPER2_DIR)/CPP/Clipper2Lib/include/clipper2/clipper.core.h" 62 echo "done" > "$@" 63 64 clean_clipper2: 65 if [ -d "$(CLIPPER2_DIR)/CPP/build" ]; then \ 66 cd -- "$(CLIPPER2_DIR)/CPP/build" && $(MAKE) clean; \ 67 fi 68 69 uninstall_clipper2: $(CLIPPER2_DIR) 70 @prefix="$$(cat .prefix)" && \ 71 cd -- "$(CLIPPER2_DIR)/CPP/build" && \ 72 cmake $(CLIPPER2_CMAKE_OPTIONS) -DCMAKE_INSTALL_PREFIX="$${prefix}" .. && \ 73 $(MAKE) install 74 xargs rm -f < "$(CLIPPER2_DIR)/CPP/build/install_manifest.txt" 75 76 mirror_clipper2: 77 repo="$$(echo "$(CLIPPER2_URL)" | sed 's/[\/]\{0,\}$$//g')" && \ 78 repo="$(MIRROR)/$${repo##*/}" && \ 79 rm -rf "$${repo}" && \ 80 git clone --bare --branch "$(CLIPPER2_TAG)" $(MIRROR_GIT_OPT) \ 81 $(CLIPPER2_URL) "$${repo}" 82 83 clean_all: clean_clipper2 84 install_all: clipper2 85 uninstall_all: uninstall_clipper2 86 mirror_all: mirror_clipper2