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

Devendor some thridparty deps #7836

Merged
merged 14 commits into from
Apr 6, 2024
Merged

Conversation

Osyotr
Copy link
Contributor

@Osyotr Osyotr commented Apr 6, 2024

No description provided.

Osyotr added 11 commits April 6, 2024 16:50
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>
Copy link
Member

@biodranik biodranik left a 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
Copy link
Member

Choose a reason for hiding this comment

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

  1. Won't private be enough?
  2. Should base also be public?

Copy link
Contributor Author

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
Copy link
Member

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? )

Copy link
Contributor Author

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".

transit/CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
if (MSVC)
add_compile_options(/utf-8)
add_link_options(/INCREMENTAL:NO)
add_link_options(/DEBUG:FULL)
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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?

Copy link
Contributor Author

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")
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Remove hardcoded "${OMIM_ROOT}/3party/utf8cpp/include" from include path
  2. 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)
Copy link
Member

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?..

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

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)
Copy link
Member

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?..

Copy link
Contributor Author

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)
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

transit/CMakeLists.txt Outdated Show resolved Hide resolved
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
@Osyotr
Copy link
Contributor Author

Osyotr commented Apr 6, 2024

Please use squash when merging.

Signed-off-by: Osyotr <Osyotr@users.noreply.github.com>
Copy link
Member

@biodranik biodranik left a 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!

@biodranik biodranik merged commit 76dd632 into organicmaps:master Apr 6, 2024
13 of 15 checks passed
@Osyotr Osyotr deleted the cmake-fixes branch April 6, 2024 23:54
@Ferenc-
Copy link
Contributor

Ferenc- commented Apr 7, 2024

Thanks!

@Ferenc- can you please help with testing these changes?

So far, I haven't found any issues.

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.

None yet

3 participants