-
Notifications
You must be signed in to change notification settings - Fork 36
Cross compiling fixes, improvements and additions #128
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
Cross compiling fixes, improvements and additions #128
Conversation
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.
Looks good except the comment below
I am not approving while the review of libp2p/cpp-libp2p#59 is in progress
cmake/dependencies.cmake
Outdated
|
||
# https://docs.hunter.sh/en/latest/packages/pkg/Boost.html | ||
hunter_add_package(Boost COMPONENTS date_time filesystem random system) | ||
find_package(Boost CONFIG REQUIRED date_time filesystem random system) | ||
|
||
# https://docs.hunter.sh/en/latest/packages/pkg/Microsoft.GSL.html | ||
hunter_add_package(Microsoft.GSL) | ||
find_package(Microsoft.GSL 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.
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.
I remember trying this line with no luck. CMake has no FindMicrosoft.GSL.cmake
, but if I add an empty one, it works. The same with cppcodec - we don't use the output CPPCODEC_FOUND
anywhere, I just added the pkg-config check because I noticed cppcodec provided pkg-config files.
Does Hunter do any magic by providing found package info to CMake? If I removed all find_package() calls, I suspect fuhon would still build, does this sound weird?
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.
According to the faq, hunter_add_package(foo)
will download and install foo
package while find_package(foo)
should only look up for files in read-only mode.
find_package
is a CMake builtin function, which loads package settings. Thus, find_package
looks to be required while even when hunter is not used.
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.
Dropped this commit
libp2p/cpp-libp2p#59 is declared as a dependency in the PR description. I updated the bullet to a check box so we can see that the dependency is fulfilled directly from this PR. |
155259e
to
aca6b56
Compare
I updated libp2p/cpp-libp2p#59 and this PR. I removed all CONFIG commits. Also dropped a fix not needed after the rust BLS signature library was dropped in #129. Only 5 commits left in this PR now. |
Is there more to do on the PR? |
aca6b56
to
2654e41
Compare
Codecov Report
@@ Coverage Diff @@
## master #128 +/- ##
==========================================
+ Coverage 46.00% 46.02% +0.02%
==========================================
Files 713 715 +2
Lines 32293 32328 +35
Branches 17876 17885 +9
==========================================
+ Hits 14855 14880 +25
- Misses 13095 13102 +7
- Partials 4343 4346 +3
Continue to review full report at Codecov.
|
Hi @eigendude and sorry for the long waiting |
Upstream libp2p/cpp-libp2p#59 has been merged! I plan to rebase this sometime before the end of the year. |
975417f
to
67460ed
Compare
Back from the dead! I rebased the PR and compile-tested. I dropped the tinycbor header change, it's no longer needed. I also added a commit removing the c-ares CMake declaration, as I can't find a use throughout the codebase. |
This change shuffles the order of several CMake steps to expose CMake options to included files. By defining options before inclusion, included files are able to access the input provided by the build system.
When building without tests, GTest and GMock are not needed. This change allows build systems to continue with filecoin compilation without devoting resources to its testing infrastructure.
Not every build system can handle git submodules, so expose an option to exclude these dependencies from the build
When building without Hunter, it is desirable to pass the path to protoc and the protobuf include directory from the build system. Allow these variables to be overridden.
67460ed
to
174b696
Compare
Signed-off-by: Garrett Brown <[email protected]>
Signed-off-by: Garrett Brown <[email protected]>
Signed-off-by: Garrett Brown <[email protected]>
Description of the Change
This PR contains the build system fixes, improvements and additions broken out from #114.
Structure of the PR
The PR is organized as follows:
Fixes for cross-compiling
Commits:
CMake: Fix error including generated protobuf headersFix tinycbor include directoryThese commits come first, because they address what could be considered defects. Inclusion would be valuable even if the rest of the PR is omitted. Further description is in the commit message.
Changes for cross-compiling
Commits:
These changes enable more control over the build process when embedded in another build system.
CMake is controlled by user variables; the first one we need is
-DHUNTER_ENABLED=OFF
so that we can have control over dependencies.Another useful variable is
-DTESTING=OFF
, because embedding test infra drastically increases the up-front effort. The first two commits above allow this variable to exclude test infra from the dependency discovery in addition to the build.Finally, I introduced a new variable:
-DBUILD_INTERNAL_DEPS=OFF
. This causes the in-tree dependencies to be skipped. I needed this for a build system that doesn't support git submodules. Instead, the dependencies are provided by the build sytsem.Dependencies
How has this been tested?
Temporarily disabled proofs and ran
make
from Kodi's build deps. Build succeeds.Ran
make install
:Next PR will address this.