summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2008-08-06 11:58:06 +0000
committerpixel <pixel>2008-08-06 11:58:06 +0000
commitb7014aad09a7f5653e2931858a1c148a15f21352 (patch)
treef5d5b27ca0fa8128deed1ac8a4d3a858f0c25eb7
parentf3c88af7e5db334fbce6cc4399e6b7e41dc33812 (diff)
Adding win32 osmesa / imagemagick support, and cleaning up a bit.
-rw-r--r--Makefile.mingw3227
-rw-r--r--src/lua-plugin.cc8
-rw-r--r--src/plugin-luaosmesa.cc10
3 files changed, 35 insertions, 10 deletions
diff --git a/Makefile.mingw32 b/Makefile.mingw32
index 3195896..eea0337 100644
--- a/Makefile.mingw32
+++ b/Makefile.mingw32
@@ -4,23 +4,25 @@ LD = i586-mingw32msvc-g++
STRIP = i586-mingw32msvc-strip
INCLUDES = \
--I ../Mesa-7.0.3-win32/include \
+-I ../Mesa-7.0.3-mingw32/include \
-I../mogltk/include \
-I../Baltisot/include \
--I../Baltisot/lib/zlib/include \
-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
-I ../tinyxml \
-I /usr/include/mysql \
-I ../ftgl-win32/include -I ../freetype-win32/include/freetype2 \
--I ../Mesa-win32/include \
-I /usr/include/oracle/11.1.0.1/client/ \
-I ../Baltisot/MSVC/regex \
+-I ../gnuwin32/include \
+-I ../pthreads-w32-2-8-0-release/ \
+-I ../gnuwin32/include/ImageMagick
-HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H
+HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H -DUSE_OSMESA
CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN -fexceptions -march=i686 $(HAVES)
-LDFLAGS += -g -fexceptions -shared -L/usr/lib/oracle/11.1.0.1/client/lib ../lua-interface/lua-interface.a -Wl,--export-dynamic -Wl,--enable-auto-image-base --export-all-symbols -Wl,--enable-auto-import
+LDFLAGS += -g -fexceptions -shared ../lua-interface/lua-interface.a -Wl,--export-dynamic -Wl,--enable-auto-image-base --export-all-symbols -Wl,--enable-auto-import \
+ -L ../freetype-win32/lib -L ../gnuwin32/lib -L ../ftgl-win32/lib/
vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
@@ -94,13 +96,19 @@ GL_SOURCES = \
plugin-luagl.cc \
LuaGL.cc \
-GL_LIBS = ../Mesa-7.0.3-win32/lib/libGLU.a ../Mesa-7.0.3-win32/lib/libOSMesa.a
+GL_LIBS =
FTGL_SOURCES = \
plugin-luaftgl.cc \
LuaFTGL.cc \
-FTGL_LIBS = ../ftgl-win32/lib/ftgl-mingw32.a ../freetype-win32/lib/libfreetype.dll.a
+FTGL_LIBS = -lftgl-mingw32 -lfreetype.dll
+
+OSMESA_SOURCES = \
+plugin-luaosmesa.cc \
+dds.c \
+
+OSMESA_LIBS = -lMagick++ -lMagickWand -lMagickCore -lbz2.dll -lz.dll -lfreetype.dll -lgdi32 -ljpeg.dll -lpng.dll ../pthreads-w32-2-8-0-release/libpthreadGC2.a
WHOLE_SOURCES = \
$(CONFIGFILES_SOURCES) \
@@ -112,6 +120,7 @@ $(HTTP_SOURCES) \
$(REGEX_SOURCES) \
$(GL_SOURCES) \
$(FTGL_SOURCES) \
+$(OSMESA_SOURCES) \
#$(OCCI_SOURCES) \
@@ -127,6 +136,7 @@ luahttp.dll \
luaregex.dll \
luagl.dll \
luaftgl.dll \
+luaosmesa.dll \
#luaocci.dll \
@@ -174,6 +184,9 @@ luaftgl.dll: $(addsuffix .o, $(notdir $(basename $(FTGL_SOURCES))))
lualibs.dll: $(addsuffix .o, $(notdir $(basename $(LUALIBS_SOURCES) $(LUA_LIB))))
$(LD) -o $@ $+ $(LUALIBS_LIBS) $(LDFLAGS)
+luaosmesa.dll: $(addsuffix .o, $(notdir $(basename $(OSMESA_SOURCES))))
+ $(LD) -o $@ $+ $(OSMESA_LIBS) $(LDFLAGS)
+
clean:
rm -f *.o *.dep *.dll
diff --git a/src/lua-plugin.cc b/src/lua-plugin.cc
index 79968a6..92b379b 100644
--- a/src/lua-plugin.cc
+++ b/src/lua-plugin.cc
@@ -9,6 +9,8 @@ void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) {
HMODULE handle;
String fname = _fname + ".dll";
+ printm(M_INFO, "Loading library " + fname + "\n");
+
if (!(handle = LoadLibraryEx(fname.to_charp(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) &&
!(handle = LoadLibraryEx(fname.to_charp(), NULL, NULL))) {
throw GeneralException("File not found or error loading shared object file: " + fname + "; Error #" + String((int) GetLastError()));
@@ -20,6 +22,8 @@ void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) {
throw GeneralException("No init pointer on plugin " + fname);
}
+ printm(M_INFO, "Library loaded, init ptr = %p\n", init_ptr);
+
init_ptr(L);
}
#else
@@ -28,6 +32,8 @@ void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) {
void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException) {
void * handle = dlopen(("./" + fname + ".so").to_charp(), RTLD_NOW | RTLD_GLOBAL);
+ printm(M_INFO, "Loading library " + fname + "\n");
+
if (!handle) {
throw GeneralException("File not found or error loading shared object file: " + fname + "; " + dlerror());
}
@@ -38,6 +44,8 @@ void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException) {
throw GeneralException("No init pointer on plugin " + fname);
}
+ printm(M_INFO, "Library loaded, init ptr = %p\n", init_ptr);
+
init_ptr(L);
}
#endif
diff --git a/src/plugin-luaosmesa.cc b/src/plugin-luaosmesa.cc
index 830c2db..09929b7 100644
--- a/src/plugin-luaosmesa.cc
+++ b/src/plugin-luaosmesa.cc
@@ -1,3 +1,5 @@
+#include <pthread.h>
+
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/osmesa.h>
@@ -28,7 +30,9 @@ class scene_t : public Base {
public:
std::list<Magick::Image> scene;
String filename, tmp_filename;
-};void empty_scene(scene_t scene) {
+};
+
+void empty_scene(scene_t scene) {
while (scene.scene.begin() != scene.scene.end()) {
scene.scene.pop_front();
}
@@ -68,14 +72,14 @@ void init_OSMesa() {
ctx = OSMesaCreateContextExt(OSMESA_BGRA, z, stencil, accum, NULL);
if (!ctx) {
- printf("OSMesaCreateContextExt() failed!\n");
+ Base::printm(M_ERROR, "OSMesaCreateContextExt() failed!\n");
return;
}
buffer = malloc(2048 * 2048 * 4);
if (!buffer) {
- printf("Alloc image buffer failed!\n");
+ Base::printm(M_ERROR, "Alloc image buffer failed!\n");
return;
}