-
Notifications
You must be signed in to change notification settings - Fork 53
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
build: Add CMake buildsystem #75
base: master
Are you sure you want to change the base?
Conversation
Chasing for Concept (N)ACKs... |
bd57926
to
14503b1
Compare
14503b1
to
30fdfb3
Compare
The currently suggesting minimal CMake-based build system implementation is enough for:
add_subdirectory(minisketch EXCLUDE_FROM_ALL)
target_compile_definitions(minisketch
PRIVATE
DISABLE_DEFAULT_FIELDS
ENABLE_FIELD_32
) To became a full fledged one, the current minimal CMake-based build system requires some additional features:
Although, those features are not required for this PR goal, i.e., providing a native Windows CI task. |
30fdfb3
to
5851544
Compare
5851544
to
d2408e0
Compare
Imo this should be renamed "Add CMake buildsystem". I looked for this a while back and didn't find it because CMake isn't mentioned in the title. Concept ACK. Will review next week. |
@sipa Are you interested in CMake for this project? |
@theuni Yeah, will look soon. |
Done. |
I'm happy to add a CMake build system for minisketch. I will need review from people more experienced with build systems, though. |
I'm going to update this PR shortly. |
66b4133
to
b486457
Compare
Reworked. The PR description has been updated. The approach from hebasto/bitcoin#93 was used for printing summary. |
endif() | ||
|
||
if(MINGW) | ||
add_link_options(-static) |
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 don't think we should port this functionality. Instead we should use the CMake shared/static selection machinery.
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 affects only benchmark/test binaries and allows to run them on the build system via Wine when building either a static library or a shared one.
UPD. It also links libstdc++-6
to libminisketch.dll
statically when cross-compiling for Windows and -DBUILD_SHARED_LIBS=YES
is provided.
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.
Consider
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix
cmake --build build --target test
wine ./build/src/test.exe
or
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix \
-DBUILD_SHARED_LIBS=YES
cmake --build build --target test
wine ./build/src/test.exe
) | ||
|
||
if(DEFINED CMAKE_CXX_STANDARD) | ||
if(CMAKE_CXX_STANDARD EQUAL 98 OR CMAKE_CXX_STANDARD LESS 11) |
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.
Hah! Stupid CMake :)
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.
Y2K problem :)
Addressed @theuni's comments. |
This PR adds a new CMake-based build system, which can be reused in downstream projects, including Bitcoin Core.
Also an MSVC CI task has been added per feedback.
Autotools vs CMake configuration option parity:
--disable-ccache
--enable-tests
-DMINISKETCH_TESTS
--enable-benchmark
-DMINISKETCH_BENCHMARK
--enable-fields
-DMINISKETCH_FIELDS
Here is a examples of output when configuring: