How to build a really cross-platform CLI? - performance

I'm trying to find how is the best way to make a cross platform CLI, that's working everywhere: Windows, Mac, iOS, Android and Linux.
I started a thing in C, but building the libraries for each platform is horrible work and very complicated, just tried to build sqlite for windows, I think I'm not going the right way.
So is there a "thing" that can provide fast performance and easy cross-platform building, a thing such as Qt maybe?
Or it is simpler to re code everything for each platform?
I thought it was easier to build cross-platform C code when there's no GUI involved but couldn't find anything.
Tried cmake, but it's very complicated to understand for anyone who always used make and I don't think it's easy to use under iOS or Android.
Maybe there is a Package manager that's working everywhere? were I can install sqlite easily on every platform.
I want to build an API that's working everywhere so a GUI can use it, the GUI that I want to code platform specific.

To build on what #Mathusalem stated, we build out systems on a variety of platforms using Docker and Jenkins.
You could use a setup as follows:
Jenkins Master (whatever OS you are comfortable on)
Jenkins Slave 1: Linux
Jenkins Slave 2: Windows
Additional Jenkins Slaves as needed based on OS you want to target
You can then have the master create build jobs on commit for both slaves and have them build in parallel. You can also hook in additional steps, including testing and integration, as part of your pipeline.

Related

Is Bazel good for mobile+desktop project?

I am looking for a relible build system for my ongoing cross-platform c++ project.
It's meant to be IOS (Obj-C (SWift?) + c++), Android (Java (Kothlin?) + cpp via NDK/Jni bridge) app, and probably osx and windows as well.
Although it's highly likely that desktop platforms are meant to be a 'development' platforms only (not production ones).
I considered gradle, but it didn't look like the best solution for ios and/or desktop platforms.
Of course, there is well known and well-proven cmake, but I personlly don't like it. I haven't had any experience with cmake on Android, and want to try something new and modern at the moment.
Bazel (https://docs.bazel.build/versions/master/tutorial/cpp.html) looks promissing for me, but I am wondering how hard it might be to create 4 native project from one codebase/project structure.
In other words, I want to create one common make file for the 4 different platforms. When changes is going to be made, I'd like to make them only once and get all my four build working.
I believe, I understand platform dependant staff. The question is about possibility to have 1 common project for 4 different platforms.
Is it feaseble to acheive this with Bazel?
Or you could reccommend anything else either?
I think Bazel is the perfect solution for you. Take a look at this repository.
Take a look on chapter_9 (Android app) and chapter_10 (iOS app).

IDE use a VM compiler?

I'm starting to work on my master thesis at the moment and I have a (maybe) specific question...
I want to stay on windows OS and run a Linux VM via VirtualBox combined with Vagrant. No Problem. I like the feature to reset the VM via vagrant easily.
The next target is using features like auto-completing or similar while developing in C++. This would help me to work with unknown includes/libraries.
Is it possible to access the filesystem/compiler of the VM while using an IDE (like clion) installed on windows? Without explicit loading of the gui und running the IDE on it? Kinda like working with cygwin? I don't want to use cygwin because it doesn't support c++11 standard (or is there a way???)
Maybe you know an alternative way. I would be glad for all hints solving my problem.
I don't know much about cygwin, though I would be surprised if they cannot get recent versions of gcc. But for certain, you can use MSYS2 to get very recent versions of gcc and many other linux packages, which will support C++11.
It's a matter of opinion how best to do cross-platform development, but an alternative worth mentioning is to use cmake for your project. When you want to code in windows, it can make MSVC 2015 project files for you -- when you want to compile in linux, it can find the dependencies and generate a makefile for you to use. IIUC, cmake is the most widely used cross-platform build system right now, besides gnu make itself. (I'm pretty sure it's more popular than "autotools" nowadays, and its definitely more popular than scons.) The advantage is that you avoid the need to maintain multiple platform-specific project files that essentially say the same thing with different formatting.

Multi platform build & CI server

we use UrbanCode's AnthillPro build and CI server to build our C++ multi platform applications in a number of environments: linux, windows, solaris, hp-ux and aix. Yes, I know that AnthillPro was initially not designed to build C++ applications - rather for Java applications, but we've managed to make it do what we need :).
Now, UrbanCode belongs to IBM and it looks like they're about to discontinue AnthillPro. That's why we're now looking for an alternative solution.
The key features we appreciate in Anthill / expect to be supported by the new solution:
support of multiple C/C++ compilers (see above)
good and efficient dependency management and resolving
support of JavaC (very important in the future)
own "artifactory" / Anthill's CodeStation anologon
work distribution between build stations (Anthill's Agents concept)
logging and reporting tools (obvoius)
Can anybody recommend a solution, which complies to this feature list? If one or two features are not supported out of the box, but can be implemented with on-board tools or with help of unix' shell and other admin-tools, that's OK!

How to build examples using libspotify on windows

I have downloaded spotify API and am trying to build the example code using libspotify on Windows. The build environment seems to apply only for Mac/Linux world (atleast the Makefile seems to suggest that and there are no Visual Studio project files). Any one has any luck in building the sample code on Windows ?
Even the basic stub example uses pthreads which is not available on windows. Since all their examples assume a POSIX compliant OS (which windows is not) I'm afraid you will not be able to build them on windows (natively). If you want try then take a look at Cygwin.
However, you can still use the include header file and the provided dll/lib to link against and develop applications. The library calls made in the examples are still valid - just not the examples themselves.

Techniques to provide a shared build environment on Windows and Unix

I'm certain this has been asked before, with with nearly 900k questions, it's hard to find things :)
We are starting a project where we want our C++ and Python to run both under a Unix environment but also under Windows. We want to make our project easy to contribute to as developers, and so we wish to have what each side feels is "natural."
In this case, under Unix, it's automake/autoconf/etc. Under Windows, anything but visual studio project files seems like a mistake. This is mostly because we want windows-native hackers to have a way to easily develop in their natural environment.
How are people doing this sort of thing today? Are Windows coders comfortable in a non-GUI world, so we are trying too hard?
Another goal is that we need automated testing of our project, ideally using the same test code (google-test) on all platforms, etc. This may be matter for another question, though.
Multi-platform development can be a tricky situation. Here are some things we do to ease the process:
Source Control (this one is obvious, a solid code-base that works with both Windows and Linux, we use SubVersion)
Create standards (All of our Makefiles look identical and are easy to implement as are our .sln files for Visual Studio)
Build the application on all platforms, frequently
Be aware of cross library use like QT and any quirks that might contain between Windows and Linux
Sometimes you can't avoid it: #ifndef's to execute some code specific to a platform
We develop in Windows, Sun and Linux (RedHat) with multiple applications both visual and command line based. I hope that helps!

Resources