Fix problems with Allegro + MacOSX + main().

Renamed the application main to app_main() so it's called from "she"
library. It's impossible to avoid dirty main() tricks with Allegro 4.
This commit is contained in:
David Capello 2012-08-24 00:24:51 -03:00
parent ae777018e2
commit d46616e71f
5 changed files with 10 additions and 22 deletions

View File

@ -16,7 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <gtest/gtest.h>
#include "tests/test.h"
#include "app/color.h"
inline std::ostream& operator<<(std::ostream& os, const Color& color) {
@ -50,9 +51,3 @@ TEST(Color, toString)
EXPECT_EQ("rgb{32,16,255}", Color::fromRgb(32, 16, 255).toString());
EXPECT_EQ("hsv{32,64,99}", Color::fromHsv(32, 64, 99).toString());
}
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

View File

@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <gtest/gtest.h>
#include "config.h"
#include "tests/test.h"
#include "app.h"
#include "document.h"

View File

@ -71,8 +71,8 @@ static bool get_memory_dump_filename(std::string& filename)
#endif
}
// ASEPRITE entry point
int main(int argc, char* argv[])
// ASEPRITE entry point. (Called from she library.)
int app_main(int argc, char* argv[])
{
// Initialize the random seed.
std::srand(static_cast<unsigned int>(std::time(NULL)));

View File

@ -310,12 +310,11 @@ System* Instance()
}
#ifdef main
// It must be defined by the user program code.
extern int app_main(int argc, char* argv[]);
int main(int argc, char* argv[]) {
#undef main
extern int main(int argc, char* argv[]);
return main(argc, argv);
return app_main(argc, argv);
}
END_OF_MAIN();
#endif

View File

@ -28,11 +28,7 @@
#include "ui/gui.h"
#endif
#ifdef main
#undef main
#endif
int main(int argc, char* argv[])
int app_main(int argc, char* argv[])
{
int exitcode;
::testing::InitGoogleTest(&argc, argv);