# HG changeset patch # User unc0rr # Date 1353441849 -14400 # Node ID ea7541f779440d7b3bc6480c423d6a3048d0bf02 # Parent 2ea5cde93abc9b42e445ee6f242359448c528e29 Start port to frontlib diff -r 2ea5cde93abc -r ea7541f77944 CMakeLists.txt --- a/CMakeLists.txt Tue Nov 20 23:09:17 2012 +0400 +++ b/CMakeLists.txt Wed Nov 21 00:04:09 2012 +0400 @@ -253,6 +253,9 @@ # physfs library add_subdirectory(misc/physfs) +# frontend library +add_subdirectory(project_files/frontlib) + #Android related build scripts if(ANDROID) #run cmake -DANDROID=1 to enable this diff -r 2ea5cde93abc -r ea7541f77944 QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Tue Nov 20 23:09:17 2012 +0400 +++ b/QTfrontend/CMakeLists.txt Wed Nov 21 00:04:09 2012 +0400 @@ -35,6 +35,7 @@ include_directories(${FFMPEG_INCLUDE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/misc/physfs/src) include_directories(${CMAKE_SOURCE_DIR}/misc/physfs/extras) +include_directories(${CMAKE_SOURCE_DIR}/project_files/frontlib) if(UNIX) # HACK: in freebsd cannot find iconv.h included via SDL.h include_directories("/usr/local/include") @@ -168,9 +169,11 @@ set(HW_LINK_LIBS physfs + frontlib ${QT_LIBRARIES} ${SDL_LIBRARY} ${SDLMIXER_LIBRARY} + ${SDLNET_LIBRARY} ${FFMPEG_LIBRARIES} ${HW_LINK_LIBS} ) diff -r 2ea5cde93abc -r ea7541f77944 QTfrontend/main.cpp --- a/QTfrontend/main.cpp Tue Nov 20 23:09:17 2012 +0400 +++ b/QTfrontend/main.cpp Wed Nov 21 00:04:09 2012 +0400 @@ -35,6 +35,8 @@ #include "DataManager.h" #include "FileEngine.h" +#include "frontlib.h" + #ifdef _WIN32 #include #endif @@ -109,6 +111,8 @@ FileEngineHandler engine(argv[0]); + flib_init(); + app.setAttribute(Qt::AA_DontShowIconsInMenus,false); QStringList arguments = app.arguments(); @@ -290,5 +294,9 @@ app.form = new HWForm(NULL, style); app.form->show(); - return app.exec(); + int r = app.exec(); + + flib_quit(); + + return r; } diff -r 2ea5cde93abc -r ea7541f77944 project_files/frontlib/frontlib.h --- a/project_files/frontlib/frontlib.h Tue Nov 20 23:09:17 2012 +0400 +++ b/project_files/frontlib/frontlib.h Wed Nov 21 00:04:09 2012 +0400 @@ -26,6 +26,10 @@ #ifndef FRONTLIB_H_ #define FRONTLIB_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "ipc/gameconn.h" #include "ipc/mapconn.h" #include "net/netconn.h" @@ -45,4 +49,8 @@ */ void flib_quit(); +#ifdef __cplusplus +} +#endif + #endif /* FRONTLIB_H_ */ diff -r 2ea5cde93abc -r ea7541f77944 project_files/hedgewars.pro --- a/project_files/hedgewars.pro Tue Nov 20 23:09:17 2012 +0400 +++ b/project_files/hedgewars.pro Wed Nov 21 00:04:09 2012 +0400 @@ -11,6 +11,7 @@ INCLUDEPATH += ../QTfrontend/util INCLUDEPATH += ../misc/physfs/src INCLUDEPATH += ../misc/physfs/extras +INCLUDEPATH += ../project_files/frontlib DESTDIR = ../bin @@ -233,7 +234,7 @@ RESOURCES += ../QTfrontend/hedgewars.qrc -LIBS += -L../bin -lphysfs +LIBS += -L../bin -lphysfs -lfrontlib macx { QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6