aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile35
-rw-r--r--src/client/main.cpp10
2 files changed, 30 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index ea26842..5d98285 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,8 @@ CLIENT_BUILD=build/client/
SERVER_NAME=brokeserver
SERVER_EXE=$(SERVER_NAME)$(EXE_EXT)
-SERVER_PATH=bin/server/bin/$(SERVER_EXE)
+SERVER_DIR=bin/server/bin
+SERVER_PATH=$(SERVER_DIR)/$(SERVER_EXE)
SERVER_SRC=src/server/
SERVER_BUILD=build/server/
@@ -72,13 +73,13 @@ LIBIRR=lib/libIrrlicht.a
LIBBCO=lib/libBulletCollision.a
LIBBDY=lib/libBulletDynamics.a
LIBBLM=lib/libLinearMath.a
-LIBNAN=lib/libnanomsg.dll.a
+LIBNAN=lib/libnanomsg.a
DLLIRR=$(LIRRDIR)/Irrlicht.dll
-DYNAMIC_LIBS = -lnanomsg.dll #-lIrrlicht
+DYNAMIC_LIBS = #-lnanomsg.dll #-lIrrlicht
#order matters!
-STATIC_LIBS = -lBulletDynamics -lBulletCollision -lLinearMath -lIrrlicht -lluajit -lOpenGL32
+STATIC_LIBS = -lBulletDynamics -lBulletCollision -lLinearMath -lIrrlicht -lluajit -lOpenGL32 -lnanomsg
LIBS=-Bstatic $(STATIC_LIBS) -Bdynamic $(DYNAMIC_LIBS)
SLIBS=$(LIBLUA) $(LIBIRR) $(LIBBDY) $(LIBBCO) $(LIBBLM) $(LIBNAN)
@@ -86,14 +87,21 @@ SLIBS=$(LIBLUA) $(LIBIRR) $(LIBBDY) $(LIBBCO) $(LIBBLM) $(LIBNAN)
#can't compile with -std=c++11 because irrlicht will complain
-CFLAGS=-Wall -static $(INCLUDES) -D_IRR_STATIC_LIB_
+CFLAGS=-Wall -static $(INCLUDES) -D_IRR_STATIC_LIB_ -DNN_STATIC_LIB
LDFLAGS=
ifeq ($(UNAME),Windows)
- LDFLAGS+=-mwindows -Wl,-subsystem,windows -lwinmm
+ LDFLAGS+=-mwindows -lwinmm #-Wl,-subsystem,windows
+ STATIC_LIBS+=-lws2_32 -lmswsock -ladvapi32
+endif
+
+ifeq ($(UNAME),true)
+ ifeq ($(UNAME),Windows)
+ LDFLAGS+=-Wl,-subsystem,console
+ endif
endif
ifeq ($(DEBUG),true)
- CFLAGS+=-g -O0
+ CFLAGS+=-g
else
CFLAGS+=-O3
#LDFLAGS+=--strip-all
@@ -244,11 +252,14 @@ $(LIBLUA) : $(ILUADIR)/Makefile
IRRMAKEFLAGS=
IRRMADELIB=
+ifeq ($(DEBUG),true)
+ IRRMAKEFLAGS+=NDEBUG=1
+endif
ifeq ($(UNAME), Windows)
- IRRMAKEFLAGS=NDEBUG=1 staticlib_win32
+ IRRMAKEFLAGS=staticlib_win32
IRRMADELIB=$(LIRRDIR)/lib/Win32-gcc
else
- IRRMAKEFLAGS=-NDEBUG=1
+ IRRMAKEFLAGS=NDEBUG=1
IRRMADELIB=$(LIRRDIR)/lib/Linux
endif
@@ -273,10 +284,12 @@ $(LBULDIR)/Makefile : $(LBULDIR)/CMakeLists.txt
$(LIBNAN) : $(LNANDIR)/Makefile
cd $(LNANDIR) && make
- cp $(LNANDIR)/libnanomsg.dll.a lib
+ cp $(LNANDIR)/libnanomsg.a lib
+ # cp $(LNANDIR)/libnanomsg.dll $(CLIENT_DIR)
+ # cp $(LNANDIR)/libnanomsg.dll $(SERVER_DIR)
$(LNANDIR)/Makefile : $(LNANDIR)/CMakeLists.txt
- cd $(LNANDIR) && cmake $(CMAKE_FLAGS)
+ cd $(LNANDIR) && cmake -DNN_STATIC_LIB=ON $(CMAKE_FLAGS)
#compile & run tests
test: $(TEST_PATH)test_stream $(TEST_PATH)test_phys
diff --git a/src/client/main.cpp b/src/client/main.cpp
index 9c22567..ad7d818 100644
--- a/src/client/main.cpp
+++ b/src/client/main.cpp
@@ -5,7 +5,6 @@ extern "C" {
#include <lauxlib.h>
#include <lualib.h>
}
-#define _IRR_STATIC_LIB_
#include <irrlicht.h>
#include <chrono>
@@ -111,9 +110,10 @@ int setbackgroundcolor(lua_State* L){
int main(int argc, char *argv[]){
printf("Brok[en]gine Client\n");
+
// Initialize bullet
phys_genesis();
-
+
//Create a new lua state, this gets shared everywhere
lua_State *state = luaL_newstate();
L = state;
@@ -121,10 +121,12 @@ int main(int argc, char *argv[]){
loadLLibs(state);
//Defined in initdevice.cpp, creates the irrlicht device
device = spawnIrrDevice(state);
+ if (!device){
+ printf("Failed to initalize device\n");
+ return 1;
+ }
ILogger* log = device->getLogger();
log->setLogLevel(ELL_NONE);
- if (!device)
- return 1;
//Loads libraries for interfaceing with irrlicht
loadIrrLibs(state,device);
loadNetLibs(state);