Where is the main function [CMake build doesn't run]
Moderator: Forum Moderators
Where is the main function [CMake build doesn't run]
Hi all,
I have downloaded the Wesnoth repository from git. I cannot find the main function Which is the file that contains it?
I use Mac so It's not the one that is in wesnoth.cpp
I have downloaded the Wesnoth repository from git. I cannot find the main function
Code: Select all
int main (int argc, char **argv)
I use Mac so It's not the one that is in wesnoth.cpp
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Where is the main function
$ grep -R wesnoth_main src
I forked real life and now I'm getting merge conflicts.
- Pentarctagon
- Project Manager
- Posts: 5592
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Where is the main function
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
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Where is the main function
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.Tad_Carlucci wrote:$ grep -R wesnoth_main src
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Where is the main function
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];
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.
Re: Where is the main function
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.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];
Thanks for the advices I'll try with discord and IRC.
Re: Where is the main function
CMake's file organization is a bit different.
The fastest hack to make it work is to go to wesnoth.cpp and replace
with
I believe it's a glitch and need s to be fixed some day.
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
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