mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-07-31 23:08:09 -07:00
Don't inject `CMAKE_CXX_STANDARD` into the `CMakeLists.txt`. It should have included `CACHE STRING ""` anyway to allow override. Instead pass `CMAKE_CXX_STANDARD` as commandline argument. Closes: https://bugs.gentoo.org/976176 Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/46315 Signed-off-by: Sam James <sam@gentoo.org>
100 lines
2.5 KiB
Bash
100 lines
2.5 KiB
Bash
# Copyright 1999-2026 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=8
|
|
|
|
inherit cmake
|
|
|
|
DESCRIPTION="Neural network model for language identification"
|
|
HOMEPAGE="https://github.com/google/cld3"
|
|
|
|
MY_PV="b48dc46512566f5a2d41118c8c1116c4f96dc661"
|
|
SRC_URI="https://github.com/google/cld3/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
|
|
S="${WORKDIR}/${PN}-${MY_PV}"
|
|
|
|
LICENSE="Apache-2.0"
|
|
SLOT="0/${PV}"
|
|
KEYWORDS="amd64 ~loong"
|
|
|
|
RDEPEND="
|
|
dev-cpp/abseil-cpp:=
|
|
dev-libs/protobuf:=
|
|
"
|
|
DEPEND="${RDEPEND}"
|
|
|
|
src_prepare() {
|
|
# None of the added compiler flags make sense or are future-proof
|
|
sed -e '/add_definitions(/d' \
|
|
-i CMakeLists.txt || die
|
|
|
|
# Link with the right libraries for the tests
|
|
cat >> CMakeLists.txt <<- 'EOF' || die
|
|
target_link_libraries(cld3
|
|
protobuf-lite
|
|
absl_log_internal_check_op
|
|
absl_log_internal_message
|
|
)
|
|
EOF
|
|
|
|
# Let cmake actually know about the tests
|
|
cat >> CMakeLists.txt <<- 'EOF' || die
|
|
include(CTest)
|
|
add_test(NAME language_identifier_main COMMAND language_identifier_main)
|
|
add_test(NAME getonescriptspan_test COMMAND getonescriptspan_test)
|
|
add_test(NAME language_identifier_features_test COMMAND language_identifier_features_test)
|
|
EOF
|
|
|
|
# Install the library
|
|
cat >> CMakeLists.txt <<- 'EOF' || die
|
|
include(GNUInstallDirs)
|
|
install(TARGETS cld3)
|
|
install(FILES
|
|
src/base.h
|
|
src/casts.h
|
|
src/embedding_feature_extractor.h
|
|
src/embedding_network.h
|
|
src/embedding_network_params.h
|
|
src/feature_extractor.h
|
|
src/feature_types.h
|
|
src/float16.h
|
|
src/lang_id_nn_params.h
|
|
src/language_identifier_features.h
|
|
src/nnet_language_identifier.h
|
|
src/registry.h
|
|
src/sentence_features.h
|
|
src/task_context.h
|
|
src/task_context_params.h
|
|
src/utils.h
|
|
src/workspace.h
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cld3")
|
|
install(FILES
|
|
src/script_span/generated_ulscript.h
|
|
src/script_span/getonescriptspan.h
|
|
src/script_span/integral_types.h
|
|
src/script_span/offsetmap.h
|
|
src/script_span/stringpiece.h
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cld3/script_span")
|
|
install(FILES
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cld_3/protos/feature_extractor.pb.h"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cld_3/protos/sentence.pb.h"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cld_3/protos/task_spec.pb.h"
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cld3/cld_3/protos")
|
|
EOF
|
|
|
|
cmake_src_prepare
|
|
}
|
|
|
|
src_configure() {
|
|
local CXXSTD="17"
|
|
if has_version ">=dev-cpp/abseil-cpp-20260107.0"; then
|
|
# needs >=c++20
|
|
CXXSTD="20"
|
|
fi
|
|
|
|
local mycmakeargs=(
|
|
-DCMAKE_CXX_STANDARD="${CXXSTD}"
|
|
)
|
|
|
|
cmake_src_configure
|
|
}
|