From 00fb7e6f65faf72a85c72f3775e49345aeb7442f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 30 Dec 2011 09:29:51 -0700 Subject: It now builds for windows, cool. --- .gitignore | 2 + mingw.bld | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test.stage | 12 ++++++ 3 files changed, 135 insertions(+) create mode 100644 mingw.bld diff --git a/.gitignore b/.gitignore index e4e0594..28b0e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ stage .build_cache .*.swp *.o +*.win_o +libbu++ diff --git a/mingw.bld b/mingw.bld new file mode 100644 index 0000000..f224fa0 --- /dev/null +++ b/mingw.bld @@ -0,0 +1,121 @@ +#build-m3 file for fishtrax client + +action "default" +{ + warning "Use the 'release' target to strip debugging and build without deps."; + DEBUG = "true"; + build: ["stage.exe"]; +} + +action "release" +{ + warning "Relesae will build without deps, and will strip debugging."; + DEBUG = "false"; + build: ["stage.exe"]; +} + +action "clean" +{ + clean: targets(); +} + +CXXFLAGS += "-ggdb"; + +target "stage.exe" +{ + input [ + files("src/*.cpp") +// files("src/*.c") + ]; + rule "winexe"; + + CXXFLAGS += "-O2 -frtti -fexceptions -Wall -Ilibbu++/support/windows -Isrc"; + + LDFLAGS += "-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -lmingw32 -Llibbu++ -lbu++win -Llibbu++/support/windows -lbz2"; + + CXXFLAGS += "-Ilibbu++"; +} + +rule "winlib" +{ + input "*.win_o"; + profile "build" + { + execute("wine C:/MinGW/bin/ar.exe cr ${OUTPUT} ${INPUT}"); + } +} + +rule "winexe" +{ + input "*.win_o"; + profile "build" + { + if DEBUG != "true" then + { + LDFLAGS += "-Wl,-s"; + } + execute("wine C:/MinGW/bin/mingw32-g++.exe -o ${OUTPUT} ${INPUT} ${LDFLAGS}"); + } +} + +function cppToWinObj() +{ + if OBJ_DIR == null then + { + DIR = INPUT.dirName(); + } + else + { + DIR = OBJ_DIR; + } + + return DIR + "/" + INPUT.fileName().replace(".cpp", ".win_o"); +} + +function cToWinObj() +{ + if OBJ_DIR == null then + { + DIR = INPUT.dirName(); + } + else + { + DIR = OBJ_DIR; + } + + return DIR + "/" + INPUT.fileName().replace(".c", ".win_o"); +} + +function winDeps( CMD ) +{ + if DEBUG == "true" then + { + return getMakeDeps( CMD ); + } + return []; +} + +rule "wincpp" +{ + input "*.cpp"; + output INPUT.cppToWinObj(); + requires winDeps("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -M ${INPUT}"); + profile "build" + { + //condition always; + execute("wine C:/MinGW/bin/mingw32-g++.exe ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++"); + } +} + +rule "winc" +{ + input "*.c"; + output INPUT.cToWinObj(); + requires winDeps("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -M ${INPUT}"); + profile "build" + { + //condition always; + execute("wine C:/MinGW/bin/mingw32-g++.exe ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++"); + } +} + diff --git a/test.stage b/test.stage index 3fa32c0..516471d 100644 --- a/test.stage +++ b/test.stage @@ -32,16 +32,23 @@ function myGoto( txt ) goto( txt ); } +function getThing() +{ + display( situation.thing ); +} + situation <> { setup { + situation.thing = 55; player.name = "Bob"; name = player.name + "o"; name += " The Man"; display("This is the setup phase for start, " + name); sillyDisplay( "Hello", name == player.name ); + getThing(); myGoto( <> ); display("You shouldn't see this."); } @@ -54,8 +61,13 @@ situation <> situation <> { + setup + { + situation.thing = "Just a thing"; + } enter { + getThing(); display('''Entered stuff''' + player.name); count = 0; while count < 5 do -- cgit v1.2.3