Skip to content

Multiple CMake fixes for missing Protobuf and Boost requirements#1605

Merged
kevinkreiser merged 4 commits intovalhalla:masterfrom
mloskot:ml/cmake-fixes
Jan 17, 2019
Merged

Multiple CMake fixes for missing Protobuf and Boost requirements#1605
kevinkreiser merged 4 commits intovalhalla:masterfrom
mloskot:ml/cmake-fixes

Conversation

@mloskot
Copy link
Copy Markdown
Collaborator

@mloskot mloskot commented Oct 30, 2018

Configure custom protobuf:: targets only if CMake <3.7.

Add missing dependency on libprotobuf target to some modules:

  • valhalla_module does not seem to generate valhalla::proto target_link_libraries-linked against Protobuf targets
  • clients of valhalla::proto do not transitively receive include directories, etc.

Add missing Boost::boost where modules #include Boost headers.
Add missing dependency of baldr on third-party dirent.
Configure libvalhalla.pc only if PKG_CONFIG_FOUND
Call Unix-specific CMake command create_symlink only if UNIX.

Add MSVC-specific fixes to cmake/Binary2Header.cmake:

Note, although not specific to Windows, those are helpful when building Valhalla on Windows or any environment where Protobuf or Boost are not deployed in standard prefixes eg. /usr or /usr/local, where they can be found even if target dependencies configuration is incomplete.

Issue

Tasklist

  • Review - you must request approval to merge any PR to master
  • Generally use squash merge to rebase and clean comments before merging

@kevinkreiser kevinkreiser self-requested a review October 31, 2018 14:22
@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Oct 31, 2018

@kevinkreiser FYI, I'm still applying some tweaks to this PR

@mloskot mloskot changed the title Multiple CMake fixes for missing Protobuf and Boost requirements WIP: Multiple CMake fixes for missing Protobuf and Boost requirements Oct 31, 2018
@mloskot mloskot changed the title WIP: Multiple CMake fixes for missing Protobuf and Boost requirements Multiple CMake fixes for missing Protobuf and Boost requirements Nov 5, 2018
@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Nov 5, 2018

@kevinkreiser This is ready for review now.

Together with the bunch of recent MSVC-specific PRs, it restores support for building on Windows with VS2017.

@kevinkreiser
Copy link
Copy Markdown
Member

@mloskot amazing work we owe you a 🍺 and then some!

@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Nov 6, 2018

Thanks :) The patch is yet to be checked at runtime - this or next week. I'm not sure of the Header2Binary thing is still sound. I'll welcome any feedback of course.

@kevinkreiser
Copy link
Copy Markdown
Member

kevinkreiser commented Nov 6, 2018

@mloskot I see that you still have Boost::boost on all the modules rather than just on mjolnir. This shouldn't be necessary. All of the modules other than mjolnir don't actually link boost, they just include some of the header-only parts of boost. Does the windows build fail when you remove the boost dependency from say baldr for example?

@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Nov 6, 2018

@kevinkreiser I added Boost::boost to Valhalla modules one by one to solve include directories. Boost::boost resolves dependency on header-only libraries and headers of built libraries, but it does not provide any binaries itself. Does that makes sense?

@kevinkreiser
Copy link
Copy Markdown
Member

@mloskot ok, ill try it again! last time i did this i noticed that it was adding the linker bits on linux which is not desirable. I haven't pulled this down in a while so let me do that!

@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Nov 6, 2018

I think that would be a FindBoost.cmake bug if Boost::boost added any linker flags. The behaviour of that target is well documented as header-only includes:

https://github.com/Kitware/CMake/blob/08da4f8d70cce97a9a6913d74e6c128ca6c0a40b/Modules/FindBoost.cmake#L72-L75

https://github.com/Kitware/CMake/blob/08da4f8d70cce97a9a6913d74e6c128ca6c0a40b/Modules/FindBoost.cmake#L1991-L1999

mloskot and others added 2 commits November 6, 2018 13:00
Configure custom protobuf:: targets only if CMake <3.7.
Add missing dependency on libprotobuf target to some modules:
- valhalla_module does not seem to generate valhalla::proto
  target_link_libraries-linked against protobuf targets
- clients of valhalla::proto do not transitively receive
  include directories, etc.
Add missing dependency on Boost::boost where modules #include Boost headers.
Add missing dependency of baldr on third-party dirent.
Configure libvalhalla.pc only if PKG_CONFIG_FOUND.
Call Unix-specific CMake command create_symlink only if UNIX.

Add MSVC-specific fixes to cmake/Binary2Header.cmake:
- add alternative workaround based on generating concatenated string
  literal to allow  sub 64K byte long string literals
- since 64K may be not enough, restore `xxd -i` behaviour (see minimal
  CMake configuration in #1124).

Although it's not specific to Windows, those are helpful when building
Valhalla on Windows or any environment where Protobuf or Boost are not
deployed in standard prefixes eg. /usr or /usr/local, where they can be
found even if target dependencies configuration is incomplete.
@kevinkreiser
Copy link
Copy Markdown
Member

I havent forgotten about this I just havent gotten to it yet. I'll get this merged in the next week or so! Sorry for the delay!

@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Nov 15, 2018

@kevinkreiser No rush, thanks.

@mloskot mloskot mentioned this pull request Jan 17, 2019
@kevinkreiser
Copy link
Copy Markdown
Member

I'm going to merge this and deal with any downstream issues in a separate PR this has hanged out there long enough. Sorry for the wait @mloskot and thank you for your continued contributions to windows builds!

Comment thread src/baldr/CMakeLists.txt Outdated
@kevinkreiser kevinkreiser merged commit 57a7faf into valhalla:master Jan 17, 2019
@mloskot mloskot deleted the ml/cmake-fixes branch January 17, 2019 16:25
@mloskot
Copy link
Copy Markdown
Collaborator Author

mloskot commented Jan 17, 2019

Thanks for merging. No problem, I'm glad I can help.

p.s. Hopefully, I haven't broken anything badly near cmake/Binary2Header.cmake, a hard work by @oxidase in #1272 to remove dependency on xxd.

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