-
-
Notifications
You must be signed in to change notification settings - Fork 851
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
Devendor some thridparty deps #7836
Conversation
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Drive-by: use add_compile_options instead of add_definitions to set -fno-omit-frame-pointer Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
GLOBAL flag for find_package has been added in CMake 3.24 Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
…ED_3PARTY is set Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@Ferenc- can you please help with testing these changes?
@@ -7,5 +7,7 @@ set(SRC | |||
) | |||
omim_add_library(${PROJECT_NAME} ${SRC}) | |||
target_link_libraries(${PROJECT_NAME} | |||
jansson | |||
PUBLIC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Won't private be enough?
- Should base also be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both are used in public interface.
@@ -10,5 +10,13 @@ set(SRC | |||
) | |||
|
|||
omim_add_library(${PROJECT_NAME} ${SRC}) | |||
target_link_libraries(${PROJECT_NAME} | |||
PUBLIC | |||
coding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why public? How does it work? )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rule is "private by default unless it's used in a public header".
CMakeLists.txt
Outdated
if (MSVC) | ||
add_compile_options(/utf-8) | ||
add_link_options(/INCREMENTAL:NO) | ||
add_link_options(/DEBUG:FULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be set only for Debug and RelWithDebInfo configs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it even make sense to have release build without debug symbols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when distributing a binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when distributing a binary.
Windows binaries don't embed any debug information. I.e. without this flag you get .exe
, with this flag you get .exe
+ .pdb
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it influence the build speed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My unscientific measurements (full build with tests, Release):
With flag: 8:50
Without flag: 8:30
Anyway, I've already removed it.
@@ -319,6 +319,11 @@ if (PLATFORM_LINUX) | |||
find_package(harfbuzz REQUIRED) | |||
endif() | |||
|
|||
if (WITH_SYSTEM_PROVIDED_3PARTY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this block be moved to 3party?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but you need CMake 3.24+ for that
https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_PACKAGE_TARGETS_GLOBAL.html#variable:CMAKE_FIND_PACKAGE_TARGETS_GLOBAL
Though IMHO it really shouldn't be in 3party.
|
||
add_library(utf8cpp INTERFACE) | ||
add_library(utf8cpp::utf8cpp ALIAS utf8cpp) | ||
target_include_directories(utf8cpp INTERFACE "${OMIM_ROOT}/3party/utfcpp/source") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change was required? Can it be extracted into a separate PR to test and polish properly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Remove hardcoded
"${OMIM_ROOT}/3party/utf8cpp/include"
from include path - Unify usage for system-provided and vendored copy of utfcpp.
Changes in this PR somewhat depend on each other, I really wouldn't like to split them.
@@ -322,6 +322,7 @@ endif() | |||
if (WITH_SYSTEM_PROVIDED_3PARTY) | |||
set(GFLAGS_USE_TARGET_NAMESPACE ON) | |||
find_package(gflags REQUIRED) | |||
find_package(utf8cpp REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really packaged on different systems?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those who set WITH_SYSTEM_PROVIDED_3PARTY
should make sure they have it.
https://repology.org/project/utfcpp/versions
@@ -22,6 +22,7 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) | |||
set(EXPAT_DTD OFF) | |||
set(EXPAT_NS ON) | |||
add_subdirectory(expat/expat) | |||
add_library(expat::expat ALIAS expat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change would also be great to test and merge separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto wouldn't want to dive into rebase-cherry-pick-hell
@@ -324,6 +324,7 @@ if (WITH_SYSTEM_PROVIDED_3PARTY) | |||
find_package(gflags REQUIRED) | |||
|
|||
find_package(expat CONFIG REQUIRED) | |||
find_package(jansson CONFIG REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is wrong with building these packages from sources?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing in particular, though mixing system and vendored deps is considered bad.
Note that add_subdirectory(jansson)
is not called on when WITH_SYSTEM_PROVIDED_3PARTY
. CMake implicitly uses -ljansson
if it couldn't find target with name jansson
. It happens to work on Linux because everything is in include/link directories. This is why namespaced targets are preferred (they don't allow this implicit behavior).
@@ -320,6 +320,7 @@ if (WITH_SYSTEM_PROVIDED_3PARTY) | |||
|
|||
find_package(expat CONFIG REQUIRED) | |||
find_package(jansson CONFIG REQUIRED) | |||
find_package(pugixml REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't it compile from sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Please use squash when merging. |
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's move on with this to be able to run Windows soon. Thank you very much!
So far, I haven't found any issues. |
No description provided.