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

Support Visual C++/Visual Studio toolchain #300

Closed
spencels opened this issue Feb 11, 2017 · 5 comments
Closed

Support Visual C++/Visual Studio toolchain #300

spencels opened this issue Feb 11, 2017 · 5 comments
Assignees

Comments

@spencels
Copy link
Contributor

Jsonnet and libjsonnet/libjsonnet++ should be buildable with the Visual C/C++ (VC/VC++) compiler. The project should include build files for a tool that integrates well with Visual Studio (VS) such as MSBuild, CMake, or NMake.

Rationale

Microsoft's Visual C/C++ compiler is widely used on Windows. It's bundled with and integrated with Visual Studio, probably the most widely used IDE for C/C++ development on Windows. A small amount of development would give a wide community of developers easy access to Jsonnet.

Jsonnet currently supports Windows builds using Cygwin and MinGW, using make as a build system. These don't integrate well with VS. Cygwin .so libraries can't be used by other Windows development tools. VS can use DLLs and possibly even object files from MinGW's gcc, but not g++ as name mangling works differently. VS also doesn't integrate with the GNU toolchain: no make or gcc support (although there may be plugins for this). Developers wishing to use Jsonnet in a VC++ project must either forgo advanced IDE features like code search and debugging, or manually create their own project file.

VS is also the de facto IDE for .NET development. Supporting VS/VC++ will make writing and maintaining C#/.NET bindings for Jsonnet easier in the future.

@spencels
Copy link
Contributor Author

I'm looking into this in my spare time, please assign to me if no one else is working on it.

@sparkprime
Copy link
Contributor

In principle, the code is all standard. In practice, it may have bugs that only show up on VC. I'm happy to accept PRs to fix these bugs :) In 2014, I tried compiling Jsonnet with Visual Studio Express 12, but it crashed the compiler. It is definitely worth trying it with a more modern MSVC. There is this fork adding VC support which is quite old, but might provide some useful insight https://github.com/tyler-elric/jsonnet

Having yet another build system would be kind of a pain. However I can't think of a better solution. Is there some way of running regression tests on travis against VC? The typical problem is that someone renames a header or adds a file or whatever, and only n-1 of the build scripts get updated, breaking one of the platforms. Currently we have BUILD, Makefile, setup.py (for pypi).

@spencels
Copy link
Contributor Author

I was able to compile Jsonnet and its tests without modification using VS2015. The question remains of what build system to use.

One build system option is to replace Make with CMake. It's a meta build system that generates targets for other build systems: Make, Visual Studio, Eclipse, etc. It also has features and plugins for other stuff like cloning external repos, copying files, and running external commands.

Bazel (BUILD) has Windows support but it's in beta at the moment (full support by 2017). But I'm guessing they won't support MSVC++ so that doesn't address this issue.

Travis does not seem to support VC++, which is unfortunate.

I think CMake is the best option, because it gives Jsonnet compatibility with a ton of build systems. If that won't work, I'll just hand-create Visual Studio targets and hope people submit bug reports as stuff breaks.

@sparkprime
Copy link
Contributor

Either cmake or hand-written vcxproj is fine with me

@sbarzowski
Copy link
Collaborator

We have some VS files in the repo (#344 stuff) I'm going to close this issue..

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

No branches or pull requests

3 participants