Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411419 Posts in 69363 Topics- by 58416 Members - Latest Member: timothy feriandy

April 17, 2024, 08:29:06 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)How do I deal with cross-platform C++ builds including consoles?
Pages: [1]
Print
Author Topic: How do I deal with cross-platform C++ builds including consoles?  (Read 1987 times)
tague
Level 0
**


View Profile WWW
« on: April 13, 2020, 04:48:26 PM »

I'm working on a little engine project, to learn.

I want to target desktop platforms (Win/Mac/Lin) *as well as* the Xbox One and possibly other platforms.
Now, I had the desktop versions working quite nicely... until I decided to try and add support for Xbox earlier on. Now, I'm in a bit of a build system situation.

I can build my normal stuff using CMake. It works nicely, and I can work in CLion across all my devices with any OS.

UWP apps, however, *don't* build nicely in CMake - and my attempts at bridging the gap between my existing source code (temporarily using SFML for rendering) and the DX12-obsessed world of Xbox One are quickly becoming messy (I plan on migrating toward a dual DX12 and Vulkan-based renderer... I really don't like DirectX, though, and wish it could be avoided!) I also don't get nice in-IDE support for the configuration files, etc.

In addition to this, I also tried builds for another platform from a certain Japanese 'N' company, which didn't get along too well with CMake, either.

So... how do you deal with cross-platform support in C++ - especially for platforms like the Xbox one that have very specific requirements?
Logged
oahda
Level 10
*****



View Profile
« Reply #1 on: April 14, 2020, 01:58:28 AM »

I saw something recently about an official OpenGL > DirectX translation layer getting released, made me wonder if it works on Xbox too, but I haven't managed to figure it out. ): Does anyone here know?

As for cross-compiling, while I haven't worked with a console yet, even just getting my stuff working nicely and uniformly across mobile and PC I've had to resort to writing some scripts to bring everything together in a slightly more complex manner than a makefile, cobbling command line tools together. Not quite as elegant to set up but as the end user you still only need to run the one script so maybe you can set something like that up? Gomez

Even if there are GUI utils for these systems, I imagine they have command line interfaces too? I use Xcode to build for iOS for example, but I'm doing it using its CLI from my script without having to open up the GUI app. The scripts also use Premake and CMake under the hood (for example to generate that iOS Xcode project) so you can still leverage those where applicable, just unifying everything under the same script interface. Smiley
Logged

tague
Level 0
**


View Profile WWW
« Reply #2 on: April 14, 2020, 10:01:55 AM »

I saw something recently about an official OpenGL > DirectX translation layer getting released

Well, there is already ANGLE, which can kinda do that. I'm not overly worried about dealing with DirectX, though, that part is a learning opportunity for someone deeply entrenched in the world of OpenGL and Vulkan.

Even if there are GUI utils for these systems, I imagine they have command line interfaces too?

Yep, there are, at least for building. Thing is, I want to be able to build+run for Xbox and Windows Store *from* Visual Studio - especially for the case of Xbox, where it's essentially the only way to deploy and debug to the devkit. A few other platforms also seem to expect MSVC. I might end up making my project use a sort of hybrid of separately configured CMake and Visual Studio SLNs that I keep somewhat in sync, using CMake + VCPKG to build for Linux and MacOS only.
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #3 on: April 16, 2020, 06:49:49 AM »

Because you stated that you are still learning in making engine, I want to advice that is hard, first you need to pay to have a Microsoft license and a devkit to deploy on console. Then you have to get ready to manage the graphics API (which is not exactly the same D3D you have PC), audio, different compilers, OS calls, TRC and platform memory management.
Logged

Games:

tague
Level 0
**


View Profile WWW
« Reply #4 on: April 16, 2020, 06:12:30 PM »

first you need to pay to have a Microsoft license and a devkit to deploy on console.

I already have XBox one devkit access, and don't plan on actually publishing, so I'm not concerned with publishing fees etc.

Then you have to get ready to manage the graphics API (which is not exactly the same D3D you have PC), audio, different compilers, OS calls, TRC and platform memory management.

My whole goal is to deal with this stuff, honestly. I'm just struggling to get a build system going that works across every target.
Logged
Kinaetron
Level 5
*****



View Profile WWW
« Reply #5 on: April 20, 2020, 05:18:01 AM »

So if you want a detailed example of doing this properly I would suggest you read the book Game Code Complete as it explains pretty well how to do things like this

https://www.amazon.com/Game-Coding-Complete-Fourth-McShaffry/dp/1133776574/ref=sr_1_1?dchild=1&keywords=game+code+complete+4th+edition&qid=1587388537&sr=8-1

failing that Tommy Refences from Team Meat did a pretty decent explaination of how to deal with it here

https://isetta.io/interviews/TommyRefenes-interview/

Logged

Life sucks and then you die.
Daid
Level 3
***



View Profile
« Reply #6 on: April 23, 2020, 06:27:42 AM »

So if you want a detailed example of doing this properly I would suggest you read the book Game Code Complete as it explains pretty well how to do things like this

https://www.amazon.com/Game-Coding-Complete-Fourth-McShaffry/dp/1133776574/ref=sr_1_1?dchild=1&keywords=game+code+complete+4th+edition&qid=1587388537&sr=8-1

failing that Tommy Refences from Team Meat did a pretty decent explaination of how to deal with it here

https://isetta.io/interviews/TommyRefenes-interview/
Non of that talks about build systems.

I had sort of the same problem with Android support. But I managed to port that all to CMake, but it was a lot of work to figure it out for Android. I would not be surprised if you could deploy to XBox One from the command line tools. And VS-Code has pretty nice CMake plugin for full support on the IDE side.


Also, I did stuff with SFML, and I'm glad that I'm mostly rid of it except for one large legacy project. There are quite a few limitations with it.
Logged

Software engineer by trade. Game development by hobby.
The Tribute Of Legends Devlog Co-op zelda.
EmptyEpsilon Free Co-op multiplayer spaceship simulator
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic