Where is the main function [CMake build doesn't run]

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

Where is the main function [CMake build doesn't run]

Postby nosba » August 7th, 2017, 10:50 am

Hi all,

I have downloaded the Wesnoth repository from git. I cannot find the main function
Code: Select all
int main (int argc, char **argv)
Which is the file that contains it?

I use Mac so It's not the one that is in wesnoth.cpp
nosba
 
Posts: 7
Joined: January 17th, 2016, 4:49 pm

Re: Where is the main function

Postby Tad_Carlucci » August 7th, 2017, 11:56 am

$ grep -R wesnoth_main src
I forked real life and now I'm getting merge conflicts.
Tad_Carlucci
Developer
 
Posts: 216
Joined: April 24th, 2016, 4:18 pm

Re: Where is the main function

Postby Pentarctagon » August 7th, 2017, 12:34 pm

Moved to Coder's Corner.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Pentarctagon
Forum Administrator
 
Posts: 2982
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Where is the main function

Postby nosba » August 7th, 2017, 1:43 pm

Tad_Carlucci wrote:$ grep -R wesnoth_main src

ok but the program needs a main. If the main is the one in SDLmain.mm it does not work with cmake. the wesnoth_main function is never called.
nosba
 
Posts: 7
Joined: January 17th, 2016, 4:49 pm

Re: Where is the main function

Postby Tad_Carlucci » August 7th, 2017, 2:11 pm

I don't use MacOS so haven't done it but I know that Wesnoth compiles and runs on MacOS.

Are you code-reading or actually compiling and saying you're not compiling correctly? If you're code-reading, you need to study how MacOS and SDL start up applications. If you're having problems compiling, I'd suggest asking more specific questions. Here is fine, but you might have better luck asking on the developer channels IRC or Discord.

I see the startup:

[NSBundle loadNibNamed:@"SDLMain" owner:NSApp];
[NSApp run];
I forked real life and now I'm getting merge conflicts.
Tad_Carlucci
Developer
 
Posts: 216
Joined: April 24th, 2016, 4:18 pm

Re: Where is the main function

Postby nosba » August 7th, 2017, 2:48 pm

Tad_Carlucci wrote:I don't use MacOS so haven't done it but I know that Wesnoth compiles and runs on MacOS.

Are you code-reading or actually compiling and saying you're not compiling correctly? If you're code-reading, you need to study how MacOS and SDL start up applications. If you're having problems compiling, I'd suggest asking more specific questions. Here is fine, but you might have better luck asking on the developer channels IRC or Discord.

I see the startup:

[NSBundle loadNibNamed:@"SDLMain" owner:NSApp];
[NSApp run];

I know that wesnoth compiles on macOS. The problem is with cmake only. If I use scons it works perfectly. I think that some files are missing from CmakeList.txt in src and I'm trying to fix it.
Thanks for the advices I'll try with discord and IRC.
nosba
 
Posts: 7
Joined: January 17th, 2016, 4:49 pm

Re: Where is the main function

Postby singalen » October 1st, 2017, 6:19 pm

CMake's file organization is a bit different.
The fastest hack to make it work is to go to wesnoth.cpp and replace
Code: Select all
#ifdef __APPLE__
extern "C" int wesnoth_main(int argc, char** argv);
int wesnoth_main(int argc, char** argv)
#else
int main(int argc, char** argv)
#endif


with
Code: Select all
#if 0
extern "C" int wesnoth_main(int argc, char** argv);
int wesnoth_main(int argc, char** argv)
#else
int main(int argc, char** argv)
#endif


I believe it's a glitch and need s to be fixed some day.
User avatar
singalen
iOS Port Maintainer
 
Posts: 164
Joined: January 3rd, 2007, 10:18 am
Location: bay


Return to Coder’s Corner

Who is online

Users browsing this forum: No registered users and 1 guest