--- 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
--- 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}
)
--- 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 <Shlobj.h>
#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;
}
--- 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_ */
--- 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