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

CMake Support #466

Closed
liuchang0812 opened this issue May 4, 2017 · 19 comments
Closed

CMake Support #466

liuchang0812 opened this issue May 4, 2017 · 19 comments

Comments

@liuchang0812
Copy link

Hi, @cmumford

Does it make sense if we add cmake support to leveldb? if the answer is YES, I will try to do it.

There are some useful LLVM tools likes clang-tidy/woboq that need cmake support. We will get code format automatically, static check and online code browser if here is CMakeLists.txt.

any comments are appreciated. thx

@Netzeband
Copy link

FYI: #475

@jasjuang
Copy link

CMake supported is much needed in order to integrate it into vcpkg

@cmumford
Copy link
Contributor

Work on CMake support is underway.

@navidR
Copy link

navidR commented Oct 3, 2017

@cmumford is it going to be supported on *nix platforms as well as Windows too?

Please support CMake on *nix as well as Windows.

@pwnall
Copy link
Member

pwnall commented Oct 3, 2017

Windows support requires a separate effort, because we'll need replacements for the POSIX port and env. That being said, one of the benefits of CMake is the ability to support Windows down the line.

Sorry we have no plans to announce right now, but we are aware of the demand!

This was referenced Oct 23, 2017
@andyleejordan
Copy link

@pwnall @cmumford I was watching the Windows Support thread, and just want to make myself available to this effort. I'm leading the port of Mesos to Windows, where we had to switch from Autotools to CMake as well, and in fact, leveldb is one of remaining requirements to bring the Mesos master component to Windows.

I've also previously patched ZooKeeper's C client library to support Windows with a new CMake build system, and for Mesos, wrote documentation covering how to maintain a good CMake build system (after I rewrote it).

Not knowing how familiar leveldb developers are with CMake, I very highly recommend reading this list of common anti-patterns and this modern guide to CMake.

Please feel free to bug me with any questions or work items you have, I'd be happy to help. I would especially like to help test the CMake build as its developed, as I'll be integrating it as a third-party dependency into my build system back at Mesos (using External_ProjectAdd).

@chfast
Copy link

chfast commented Nov 3, 2017

Can you share the current status of this task? I can help or even do it from scratch.

@pwnall
Copy link
Member

pwnall commented Nov 3, 2017

@chfast Thank you very much for the offer! Unfortunately, unless you're a Googler, it's highly unlikely that you can help.

I have a patch for the open-source repository here: https://github.com/pwnall/leveldb/tree/cmake

The work is blocked on integrating this changes into Google's internal source repository. Sorry, that's all I have to share right now.

@chfast
Copy link

chfast commented Nov 30, 2017

Any estimations how long it can take?

@jasjuang
Copy link

Someone wrote a CMakeLists for leveldb on vcpkg https://github.com/Microsoft/vcpkg/blob/master/ports/leveldb/CMakeLists.txt, and it is fully working on Windows. Simply install leveldb with vcpkg install leveldb

@isaachier
Copy link

@pwnall thanks for the CMake support. I think that is good enough for me. On a related note, I wonder why you chose to redefine all of the if defined macros to if macros. CMake can do either (cmakedefine vs. cmakedefine01) and it would have less impact on the existing build system to keep as if defined.

@chfast
Copy link

chfast commented Dec 3, 2017

The #if is better than #if defined for compile time options, because it handles a case like -DOPTION=0.

@isaachier
Copy link

@chfast good point but I think it is harder to merge with the project unless CMake and autotools can both use identical source files. As of now, @pwnall's CMake build is pretty invasive in the way it redefines macros etc.

@chfast
Copy link

chfast commented Dec 4, 2017

I'm not saying it was worth to change it in a side branch.

@maxim-allen
Copy link

@jasjuang Thanks! But produced result - 02/08/2018 04:40 PM 25,541,932 libleveldb.lib - weighs like it has some extra stuff. It was downloading something bitcoin-related: "-- Downloading https://github.com/bitcoin-core/leveldb/archive/8b1cd3753b184341e837b30383832645135d3d73.tar.gz...". Looks like some bitcoin-oriented code that's just using leveldb. So package name leveldb for vcpkg is just misguiding, but not an actual leveldb that you would expect...

@isaachier
Copy link

@maxim-allen bitcoin maintains a windows compatible LevelDB. Google does not.

@jasjuang
Copy link

jasjuang commented Feb 8, 2018

@maxim-allen You are right the leveldb on vcpkg is actually from the bitcoin fork. You might want to try modifying the portfile to install the original leveldb and see if it works.

@k15tfu
Copy link

k15tfu commented Oct 23, 2020

BTW, why are some tests skipped when building as a shared library? Makefile-based builds used all of them.

if(NOT BUILD_SHARED_LIBS)

@pwnall
Copy link
Member

pwnall commented Oct 23, 2020

I think that the CMake version now builds with -fvisibility=hidden (or MSVC equivalent) whereas the previous version didn't. This makes it so that only LEVELDB_EXPORT symbols are visible in the shared library.

I want us to be testing with -fvisibility=hidden, because this config is used in Chrome for development (in the component build). We do have full testing coverage for the static library build, and the underlying C++ code is the same as for the shared library build. I think / hope we have enough tests running for the shared library to catch any issues, under the assumption that we also run the full test suite for the static library.

I hope this helps.

maochongxin pushed a commit to maochongxin/leveldb that referenced this issue Jul 21, 2022
…ark. (google#466)

Describe how to use the cpupower command to disable CPU frequency scaling.
Document this, since there are other ways that don't see to have the same
effect. See google#325
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests