Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change defaults and improve CMake export #26

Merged
merged 18 commits into from
Oct 28, 2023
Merged

Change defaults and improve CMake export #26

merged 18 commits into from
Oct 28, 2023

Conversation

jerinphilip
Copy link
Owner

No description provided.

CMakeLists.txt Outdated
@@ -56,7 +56,7 @@ find_package(PCRE2 REQUIRED)
if(USE_BUILTIN_SENTENCEPIECE)
list(APPEND SLIMT_PUBLIC_LIBS SentencePiece::SentencePiece)
else(USE_BUILTIN_SENTENCEPIECE)
list(APPEND SLIMT_PRIVATE_LIBS SentencePiece::SentencePiece)
list(APPEND SLIMT_PUBLIC_LIBS SentencePiece::SentencePiece)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in if and else we have the same code for SentencePiece::SentencePiece
we can change code as

list(APPEND SLIMT_PUBLIC_LIBS SentencePiece::SentencePiece)
if (NOT USE_BUILTIN_SENTENCEPIECE)
   list(APPEND SLIMT_PRIVATE_LIBS SentencePiece::Protobuf)
endif()

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -116,7 +115,7 @@ if(EXPORT_CMAKE_FILE)

# This will double install, but is-ok.
install(
TARGETS slimt-shared slimt-static
TARGETS slimt-shared slimt-static sentencepiece
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it work if we don't sentencepiece ? (if we have it install in system)

Copy link
Owner Author

@jerinphilip jerinphilip Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire block will only work if it is system sentencepiece (i.e installed via libsentencepiece-dev in debian based machines, sentencepiece-git maybe from ArchLinux AUR). For distributions where this is not available, the recommendation is to independently (of slimt) install sentencepiece from sources. If it's sentencepiece from sources supplied here via submodule (USE_BUILTIN_SENTENCEPIECE=ON), the code will fail at configure step.

sentencepiece only provides the pkg-config based sentencepiece.pc.in. This is used in our builds to induct the
sentencpiece target (a.k.a Sentencepiece::Sentencepiece). This happens here in source.

What we are doing here is merely exposing this target as slimt::sentencepiece, as a dependency for slimt::slimt-shared. i.e, it refers to the already installed sentencepiece from elsewhere. This target for usage cmake's packaging is not provided by the original source (only pkg-config), and since we are providing it as slimt::sentencepiece it should not be an issue.

You can look at the source of the generated ${CMAKE_INSTALL_PREFIX}/lib/cmake/slimt/slimtTargets.cmake to see how this is laid out in a real installation. On my installation, it looks like this.

I'm no expert, just thinking out loud here. I'm experimenting with CMakeLists.txt and figuring out where these things go.

@jerinphilip jerinphilip force-pushed the kde-drive branch 12 times, most recently from c9997da to 8db14eb Compare October 27, 2023 16:22
Fix broken CI due to actions-runner. Manually install llvm-17 and make
it preferred. The upgrade improves static analysis, leading to the
following fixes, uniformities:

  - misc-include-cleaner: Add missing headers, remove unused headers
  - Use `\n` instead of `std::endl`
  - Move includes to included impl files
  - Fixes to HTML.cc
  - Add explicit `default: break` for switches
  - Fix use-after-free
@jerinphilip jerinphilip changed the title Improve defaults Change defaults and improve CMake export Oct 28, 2023
@jerinphilip jerinphilip marked this pull request as ready for review October 28, 2023 17:25
@jerinphilip jerinphilip merged commit 4322e41 into main Oct 28, 2023
6 checks passed
@jerinphilip jerinphilip deleted the kde-drive branch October 28, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants