SFML community forums

Help => General => Topic started by: John6 on July 20, 2020, 07:09:02 pm

Title: What process would I follow to port my game from Windows to Mac?
Post by: John6 on July 20, 2020, 07:09:02 pm
Hi all,

I am nearly finished creating a game in SFML for windows. I used visual studio as my environment. I want the game to be playable on OSX as well, but I'm not sure how much work it will take. The instructions to build on Mac using XCode are clear, but I'm wondering if there is a way to simply convert my already made windows project into one that will run on a Mac. Any advice or resources would be greatly appreciated.

Thanks,
John
Title: Re: What process would I follow to port my game from Windows to Mac?
Post by: Stauricus on July 21, 2020, 06:17:21 pm
do you mean to convert your windows .exe to a mac aplication? I wouldn't agree to that. its better to simply compile it again in an OSX. same for Linux based distros...
Title: Re: What process would I follow to port my game from Windows to Mac?
Post by: John6 on July 21, 2020, 06:22:15 pm
I'm just unfamiliar with the process. What would be the simplest way to do that? Would I just open Visual Studio on a Mac, download my project from github, try to compile it, and just start fixing any emergent bugs? Would I have to recreate the project from scratch and then copy paste the code in each file?

Thanks for your help!
Title: Re: What process would I follow to port my game from Windows to Mac?
Post by: Stauricus on July 21, 2020, 06:35:47 pm
I dont know if there is Visual Studio for MAC, but it would be something like that. you just take your code and compile it again in a OSX. you don't need to copy/paste all the code, just use the same files (.c, .cpp, .h, .hpp, etc). they are text files, so they work everywhere.
an easier way would be using crosscompilers. OR you can use a virtual machine to compile your program.
Title: Re: What process would I follow to port my game from Windows to Mac?
Post by: John6 on July 21, 2020, 06:37:53 pm
Awesome, I appreciate the help. I just checked it out and I think there is visual studio on Mac. It would be really helpful to reuse the exact same project file because of all of the various compile settings in visual studio that will carry over. If that doesn't work for whatever reason I'll just try the same thing on XCode. Thanks again!

EDIT:

It looks like CrossCompiler was the magic word! This seems to be the exact solution to my problem, I can just add a build option for linux and for Mac. This is great!

https://devblogs.microsoft.com/cppblog/using-visual-studio-for-cross-platform-c-development-targeting-windows-and-linux/

EDIT2:

Woops, it looks like I jumped the gun on posting. The crosscompiler on visual studio seems to only be for Linux. Looks like the best option is still just to use a mac.