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
cmake support for linux and osx #1358
Conversation
Thank you for your pull request. As you may know, we require contributors to sign our Contributor License Agreement, and we don't seem to have you on file and listed as active anymore. In order for us to review and merge your code, please email cla@fb.com with your details so we can update your status. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@yuslepukhin can you help take a look at it? |
Windows build seems to be failing. |
7e0a9b7
to
89205c1
Compare
@siying the Windows build failure is fixed.
And the test failure above is irrelevant to this change. |
* port part of build_detect_platform not covered by thirdparty.inc to cmake. - detect fallocate() - detect malloc_usable_size() - detect JeMalloc - detect snappy * check for asan,tsan,ubsan * create 'build_version.cc' in build directory. * add `check` target to support 'make check'. * add `tools` target to match its counterpart in Makefile. * use `date` on non-win32 platforms. * pass different cflags on non-win32 platforms * detect pthead library using FindThread cmake module. * enable CMP0042 to silence the cmake warning on osx * reorder the linked libraries. because testutillib references gtest, to enable the linker to find the referenced symbols, we need to put gtest after testutillib. Signed-off-by: Marcus Watts <mwatts@redhat.com> Signed-off-by: Kefu Chai <kchai@redhat.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
testharness.cc is included in librocksdb sources, and it uses gtest. but gtest is not supposed to be part of the public API of librocksdb. so, in this change, the testharness.cc is moved out out librocksdb, and is built as an object target, then linked with the tools and tests instead. Signed-off-by: Marcus Watts <mwatts@redhat.com> Signed-off-by: Kefu Chai <kchai@redhat.com>
Looks good. Please, document all the test failures. Also, did you get a change running standalone test executables, besides db_test and db_test2? I will get to all the unimplemented features soon if somebody else does not get those first. |
@yuslepukhin thank you for taking a look. should I press the "merge" bottom? |
Thanks for your contribution and Sorry for commenting late:
You want to edit this comment at the top of the CMakeLists.txt
Why not separate these into cmake files of its own? There is some risk if these things are order sensitive. Should be a solvable problem though. Simple RPM/DEB creation using continuous integration (I used packagecloud.io) can be built on top of this. It's not a replacement for distro packaging, but still useful to automate testing of CI generated bits. There is precedent in the Linux kernel doing this. |
tested with devtoolset-3:
Two comments: why is the library called librocksdblib.a and not librocksdb.a? |
Using rocksdb-shared for tests should cut down disk usage significantly. |
i think it would be easier for the posterity to read when maintaining this building system.
it's not intentional. and yes, it should be |
I interpret that to mean you agree with splitting into platform specific cmake files. Once that's done, we can forward port the following snippets from #1135:
Happy to pitch in as much as I can. |
@adsharma, no, i meant it would be easier in current way.
yeah, i am all for this. |
On Windows when building it produces two things rocksdb.dll and rocksdb.lib. For the DLL it also produces import library rocksdb.lib. So in order that import library does not mix up or overwrite the stati library the latter is called rocksdblib.lib |
It is important that c_tests properly links to import library so it can test the exported interfaces the DLL that is actually used instead of the static library. |
Thanks for explaining. I didn't grok the difference between static, dynamic and import library when I wrote #1364. How about:
so the distinction is clear? |
@adsharma Not sure where you would actually explicitly use ${ROCKSDB_IMPORT_LIB}
|
@yuslepukhin: Sounds good. Let's stick with just the first two then.
|
@adsharma Speaking about the names. Did not look here, but the original build had ARTIFACT_SUFFIX. This was primarily for building libraries and binaries with _je suffix if they are built with JEMALLOC. We run 4 builds from the same build directory and end up with two sets of Debug and two sets of Release binaries so we can easily internally package them from the same location. _je suffix provides the way out so we would like to keep that if possible. |
@adsharma set_target_properties sound a little complex. Simply setting the name of the target different on Windows will do. |
@yuslepukhin: could you take another look at #1364? |
Summary: After make install, I see a directory hierarchy that looks like ``` ./usr ./usr/include ./usr/include/rocksdb ./usr/include/rocksdb/filter_policy.h [..] ./usr/include/rocksdb/iterator.h ./usr/include/rocksdb/utilities ./usr/include/rocksdb/utilities/ldb_cmd_execute_result.h ./usr/include/rocksdb/utilities/lua ./usr/include/rocksdb/utilities/lua/rocks_lua_custom_library.h ./usr/include/rocksdb/utilities/lua/rocks_lua_util.h ./usr/include/rocksdb/utilities/lua/rocks_lua_compaction_filter.h ./usr/include/rocksdb/utilities/backupable_db.h [..] ./usr/include/rocksdb/utilities/env_registry.h [..] ./usr/include/rocksdb/env.h ./usr/lib64 ./usr/lib64/librocksdb.so.5 ./usr/lib64/librocksdb.so.5.0.0 ./usr/lib64/librocksdb.so ./usr/lib64/librocksdb.a ``` Closes #1798 Differential Revision: D4456536 Pulled By: yiwu-arbug fbshipit-source-id: 5494e91
tested on macos and gnu/linux