Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Is there an Scons port for libgit2? If not, how do I make one? #13

Closed
twaritwaikar opened this issue Jul 17, 2019 · 9 comments
Closed

Comments

@twaritwaikar
Copy link

twaritwaikar commented Jul 17, 2019

Currently, I am porting the project to Scons by just submitting all the source files in deps/ and src/ to be compiled and setting the include paths as include/ and deps/.

However, my task is in a C++ project (Godot Engine) and I am having trouble figuring out all the minor dependencies that have been configured in libgit2 through CMake. Is there a list of all the libraries I need to link again while making this port?

@ethomson
Copy link
Member

There should be very few dependencies necessary (in fact, you could compile with zero dependencies but limited functionality). Setting this up is going to depend very much on what platform you're targeting and what functionality you do want.

@twaritwaikar
Copy link
Author

@ethomson Could you direct me on making a zero dependency build? I am currently having to link against winhttp, rpcrt4, crypt32 and ole32 manually. Would be nice to have no system dependencies for offline use

@twaritwaikar
Copy link
Author

twaritwaikar commented Jul 17, 2019

I did get the library to build with Scons on Windows btw. I just want it to be multi-platform compatible

@ethomson
Copy link
Member

I don't understand what you mean by "no system dependencies for offline use". Any Windows machine is going to have all of those libraries. You could disable networking entirely, and you wouldn't need winhttp, but you'll never not have it. (Things like system32, though, there's no way to eliminate a dependency on.)

@twaritwaikar
Copy link
Author

@ethomson If that's case (winhttp is going to be needed someday) then if there a list of all the different libraries that I need to know about while porting over my scons code to Linux lets say, then it will make my job a lot easier actually. I assume winhttp needs to be replaced, or I may need to exclude some windows only .cpp files and include some unix only files instead.

Just looking for making a successful port basically.

@twaritwaikar
Copy link
Author

Would be nicer for the project to not even depend on rpcrt4, crypt32 and ole32 for reliable porting

@ethomson
Copy link
Member

Would be nicer for the project to not even depend on rpcrt4, crypt32 and ole32 for reliable porting

It only depends on those things on Windows.

I'd encourage you to actually run cmake on these different platforms to understand how the detection of dependencies works, and then look at the generated features.h and compiler flags used to build the library.

You might also consider just building the library with cmake. Surely godot can reference libraries that aren't built in-tree with scons, can't it?

@twaritwaikar
Copy link
Author

features.h should help if it switches features on and off. Thanks I will look into the CMake flags and library detections.

I originally started with linking to libgit2 externally to Godot, however, linking to external libraries is not done at all in Godot apart from some system libraries and instead, most of the libraries are build from source.

@twaritwaikar
Copy link
Author

Closing this because I was able to get libgit2 to build with Scons. However, I don't think sharing my code will help someone working with Scons because Godot uses its own framework built around Scons to compile third-party code. The scripts look a lot different.

But all I did was to read all the CMakeLists.txt files and translated the CMake script basically to Scons.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants