From acf810f8fd77ce393c704c90c2737e0eb37b7221 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sun, 31 Mar 2024 03:43:29 +0200 Subject: [PATCH] depends: gtest: update to 1.14.0, clean up package definition --- contrib/depends/funcs.mk | 12 ++++++++++++ contrib/depends/packages/gtest.mk | 32 ++++++++----------------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk index e08669c98..83dc22f3c 100644 --- a/contrib/depends/funcs.mk +++ b/contrib/depends/funcs.mk @@ -172,6 +172,18 @@ endif ifneq ($($(1)_ldflags),) $(1)_autoconf += LDFLAGS="$$($(1)_ldflags)" endif + +$(1)_cmake=env CC="$$($(1)_cc)" \ + CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \ + CXX="$$($(1)_cxx)" \ + CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \ + LDFLAGS="$$($(1)_ldflags)" \ + cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" $$($(1)_config_opts) +ifneq ($(host),$(build)) +$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system) +$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host) +$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host) +endif endef define int_add_cmds diff --git a/contrib/depends/packages/gtest.mk b/contrib/depends/packages/gtest.mk index 1208d7c03..c87b31471 100644 --- a/contrib/depends/packages/gtest.mk +++ b/contrib/depends/packages/gtest.mk @@ -1,39 +1,23 @@ package=gtest -$(package)_version=1.8.1 +$(package)_version=1.14.0 $(package)_download_path=https://github.com/google/googletest/archive/ -$(package)_download_file=release-$($(package)_version).tar.gz +$(package)_download_file=v$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c -$(package)_cxxflags=-std=c++11 +$(package)_sha256_hash=8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7 +$(package)_cxxflags=-std=c++14 $(package)_cxxflags_linux=-fPIC define $(package)_config_cmds - cd googletest && \ - CC="$(host_prefix)/native/bin/$($(package)_cc)" \ - CXX="$(host_prefix)/native/bin/$($(package)_cxx)" \ - AR="$(host_prefix)/native/bin/$($(package)_ar)" \ - RANLIB="$(host_prefix)/native/bin/$($(package)_ranlib)" \ - LIBTOOL="$(host_prefix)/native/bin/$($(package)_libtool)" \ - CXXFLAGS="$($(package)_cxxflags)" \ - CCFLAGS="$($(package)_ccflags)" \ - CPPFLAGS="$($(package)_cppflags)" \ - CFLAGS="$($(package)_cflags) $($(package)_cppflags)" \ - LDLAGS="$($(package)_ldflags)" \ - cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix) \ - -DTOOLCHAIN_PREFIX=$(host_toolchain) \ - -DCMAKE_AR="$(host_prefix)/native/bin/$($(package)_ar)" \ - -DCMAKE_RANLIB="$(host_prefix)/native/bin/$($(package)_ranlib)" \ - -DCMAKE_CXX_FLAGS_DEBUG=ON + $($(package)_cmake) -S . -B . endef -# -DCMAKE_TOOLCHAIN_FILE=$(HOST)/share/toolchain.cmake define $(package)_build_cmds - cd googletest && CC="$(host_prefix)/native/bin/$($(package)_cc)" $(MAKE) + $(MAKE) endef define $(package)_stage_cmds mkdir $($(package)_staging_prefix_dir)/lib $($(package)_staging_prefix_dir)/include &&\ - cp googletest/libgtest.a $($(package)_staging_prefix_dir)/lib/ &&\ - cp googletest/libgtest_main.a $($(package)_staging_prefix_dir)/lib/ &&\ + cp lib/libgtest.a $($(package)_staging_prefix_dir)/lib/ &&\ + cp lib/libgtest_main.a $($(package)_staging_prefix_dir)/lib/ &&\ cp -a googletest/include/* $($(package)_staging_prefix_dir)/include/ endef