Manu343726 / siplasplas

A library for C++ reflection and introspection
https://manu343726.github.io/siplasplas
MIT License
195 stars 27 forks source link

Deprecate thirdparty.cmake and use conan.io for dependency management #78

Closed Manu343726 closed 7 years ago

Manu343726 commented 7 years ago

Ping @lasote

lasote commented 7 years ago

+1

sztomi commented 7 years ago

I made a package for luacpptemplater: https://www.conan.io/source/LuaCppTemplater/1.0.0/sztomi/luacpptemplater Haven't tested on Windows yet.

Manu343726 commented 7 years ago

Windows (Visual Studio) support is currently broken, so don't worry about it ;)

Manu343726 commented 7 years ago

Tip: You may like to add an url property to your conanfile.py so users know where the package comes from and what the lib is about (Well, the name is very descriptive. Not my case, who will figure out what something called "siplasplas" is about?... About C++, yeah...)

sztomi commented 7 years ago

Thanks, will do. If you can make a list of other dependencies that are missing a conan package, I'd like to help out with making them. I assume standardese is one, but I can see that you are actively packaging things, so I'll try to avoid duplicating efforts.

Manu343726 commented 7 years ago

This is the list of libraries imported in 3rdParty/CMakeLists.txt: (Check means I already conanized it)

Future dependencies already integrated

Today I will be working on backward-cpp. Also, I'm thinking of writing a package for efsw from external sources (i.e. the package downloads sources from bitbucket and we maintain the package scripts on github).

imgui-sfml is an imgui backend by @eliasdaler that is hosted directly in our sourcetree (See the imgui-sfml README).

I would like to talk with @lefticus about integrating a conanfile.py into chaiscript. About standardese, I know @foonathan is not a huge fan of external tools, and I already owe him a PR, so I will try to leave Standardese package til we have the rest of deps working. Note Standardese is not (currently) a direct dependency but a tool we use to compile the docs)

Whatever lib you pick to play with, feel free to send me a PR to dev/siplasplas-78-conan, I will fix the merge conflicts later.

foonathan commented 7 years ago

If someone wants to maintain a conan package for standardese, this is totally fine by me.

Manu343726 commented 7 years ago

Great thanks @foonathan

sztomi commented 7 years ago

One thing I realized while creating the luacpptemplater package was that you can't have both conanfile.txt for pulling deps and conanfile.py for creating a package at the same time (you can, but conan will pick the txt while you try to build it). For this reason I created a repo that imports luacpptemplater as a submodule and I work with that to create the package.

As I began to understand conan, I can see that you can do both from a single conanfile.py, but I still feel that a simple repo that builds the package in a non-intrusive way is better and more flexible.

Manu343726 commented 7 years ago

You can also instruct the conanfile.py recipe to clone the repo in its build dir, see the source() method in the docs. This way you don't have to manage submodules, and you can parameterize what repo you download (For example, checking out different tags depending on the requested package version)

lefticus commented 7 years ago

I shamefully admit that I have not yet looked at conan, but I would happily accept a PR for it.

sztomi commented 7 years ago

@Manu343726 in this case I'll start with standardese. Also, thanks for the tips, I'll update the luacpptemplater package as well.

Manu343726 commented 7 years ago

@sztomi I have created a simple cmake tool to automatically import conan packages as cmake targets, cmake-utils Just require it and include conan.cmake in your CMakeLists.txt:

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CONAN_CMAKE-UTILS_ROOT}/conan.cmake)

# Imports a conan package named 'foo' as an interface target 'foo-conan' with the include dirs and
# library binaries configured:
add_conan_library(foo)

Anyway, I have been talking with the conan guys and they told me there will be a similar feature (Importing all package deps as an IMPORTED cmake target) in the cmake generator out of the box by the next release.

sztomi commented 7 years ago

@Manu343726 thanks, that's pretty useful.

I'm working on the standardese conanfile still. BTW, @foonathan, are you interested in a PR that replaces the submodules in standardese with conan packages? A single conanfile can implement both packaging the project for conan.io and pulling its dependencies.

foonathan commented 7 years ago

This would require conan to be installed, right?

If so, then I'd rather keep the submodules.

sztomi commented 7 years ago

Right, conan needs to be installed. Although it's only a matter of pip install conan. Does that change your opinion? If not, I'll go ahead and make a non-intrusive package.

foonathan commented 7 years ago

No, does not change it, as some (like me) would have to install pip as well.

sztomi commented 7 years ago

https://www.conan.io/source/standardese/0.3-1/sztomi/standardese

@Manu343726, I did not make a PR for the conanfile.txt on your working branch because this is not yet a dependency as you pointed out. libclang is not listed as a requirement because I assumed that you would want to keep the cmake-based downloading for that (since it was not listed). If not, there is a conan package that does the same: clang/3.8.0@smspillaz/stable

Manu343726 commented 7 years ago

Hey guys, I think I'm ready to merge this. Thanks for all the help.