Commit cdcbfc29 authored by Bernd Machenschalk's avatar Bernd Machenschalk

api: updates for building Win32 libs & API with MinGW gcc

added Makefile.mingw used for Einstein@home in lib/ as an
_alternative_ to api/Makefile.mingw

svn path=/trunk/boinc/; revision=19583
parent da0ec737
BOINCDIR = ./boinc
BOINCDIR = ..
DEBUG = -D__DEBUG__ -g3
OBJ = boinc_api.o util.o win_util.o app_ipc.o diagnostics.o diagnostics_win.o filesys.o hostinfo.o md5.o md5_file.o mem_usage.o mfile.o miofile.o parse.o prefs.o proxy_info.o str_util.o shmem.o stackwalker_win.o base64.o
LINKOBJ = $(OBJ)
......
......@@ -22,6 +22,10 @@
#include <Carbon/Carbon.h>
#endif
#ifdef _WIN32
#include "boinc_win.h"
#endif
// ANSI C API BEGINS HERE
// Do not put implementation stuff here
......
......@@ -9226,3 +9226,19 @@ David 15 Nov 2009
sched/
credit_test.cpp
Bernd 16 Nov 2009
- api: updates for building Win32 libs & API with MinGW gcc
added Makefile.mingw used for Einstein@home in lib/ as an
_alternative_ to api/Makefile.mingw
lib/
diagnostics.h
boinc_win.h
diagnostics.cpp
Makefile.mingw
diagnostics_win.cpp
api/
Makefile.mingw
boinc_api.h
# Makefile for building BOINC with MinGW (gcc and gnumake)
# if you want to use install/uninstall targets, set this to the prefix
BOINC_PREFIX ?= /usr/local/boinc
# set this for the BOINC sourc directory. This default should work for calling from within lib/ or api/
BOINC_SRC ?= ..
# headers to install
HEADERS = version.h api/boinc_api.h api/graphics2.h lib/app_ipc.h lib/boinc_win.h \
lib/common_defs.h lib/diagnostics.h lib/diagnostics_win.h lib/filesys.h lib/hostinfo.h \
lib/proxy_info.h lib/prefs.h lib/miofile.h lib/mfile.h lib/parse.h lib/util.h \
win_build/config.h
ZIP_HEADERS = zip/boinc_zip.h
# objects to compile
API_OBJ = boinc_api.o graphics2_util.o
GPH_OBJ = graphics2.o graphics2_util.o
LIB_OBJ = util.o win_util.o app_ipc.o diagnostics.o diagnostics_win.o filesys.o \
hostinfo.o md5.o md5_file.o mem_usage.o mfile.o miofile.o parse.o prefs.o \
proxy_info.o str_util.o shmem.o base64.o stackwalker_win.o
ZIP_OBJ = boinc_zip.o z_win32.o win32zip.o zipup.o zipfile.o zip.o z_globals.o z_fileio.o \
z_util.o trees.o deflate.o zipinfo.o win32.o unzip.o unshrink.o unreduce.o ttyio.o \
process.o match.o list.o inflate.o globals.o fileio.o extract.o explode.o envargs.o \
crctab.o crc32.o apihelp.o api.o
# libraries to build
API_BIN = libboinc_api.a
LIB_BIN = libboinc.a
GPH_BIN = libboinc_graphics2.a
ZIP_BIN = libboinc_zip.a
# all objects (for clean target)
OBJ = $(API_OBJ) $(LIB_OBJ) $(GPH_OBJ) $(ZIP_OBJ)
# all libraries (zip not listed anymore)
BIN = $(API_BIN) $(LIB_BIN) $(GPH_BIN)
# -gstabs is necessary for MinGWs backtrace to work
DEBUG = -D__DEBUG__ -gstabs -g3
# where to find headers
INCS = -I"$(BOINC_SRC)" -I"$(BOINC_SRC)/db" -I"$(BOINC_SRC)/lib" -I"$(BOINC_SRC)/api" -I"$(BOINC_SRC)/zip" -I"$(BOINC_SRC)/win_build"
# various cpp & gcc flags (for both C and C++ mode)
# set NOCYGWIN=-mno-cygwin to build non-Cywin Windows libs under Cygwin
# -D_WIN32_WINDOWS=0x0410 sets to use Win98 API
CCXXFLAGS = $(INCS) $(DEBUG) --include $(BOINC_SRC)/version.h -DEINSTEINATHOME_CROSS_BUILD -DMINGW_WIN32 \
-DWIN32 -D_WIN32 -D_WIN32_WINDOWS=0x0410 -D_MT -DNDEBUG -D_WINDOWS -DBOINC \
-DNODB -D_CONSOLE -mtune=pentium-m -fexceptions -march=i386 -O2 $(NOCYGWIN)
# flags for compiling boinc_zip
ZIP_FLAGS = -DWIN32 -DNDEBUG -D_LIB -D_MBCS -DNO_MKTEMP $(INCS) -O2 -DDLL $(NOCYGWIN)
LDFLAGS = -lwinmm -march=i386
CFLAGS = $(CCXXFLAGS)
CXXFLAGS = $(CCXXFLAGS)
# default target
all: $(BIN)
# zip target
boinc_zip: $(ZIP_BIN)
# rules for the indivisual libraries
$(API_BIN): $(API_OBJ)
$(AR) rc $@ $^
$(LIB_BIN): $(LIB_OBJ)
$(AR) rc $@ $^
$(GPH_BIN): $(GPH_OBJ)
$(AR) rc $@ $^
$(ZIP_BIN): $(ZIP_OBJ)
$(AR) rc $@ $^
# standard BOINC code - .C and .cpp versions
%.o: $(BOINC_SRC)/api/%.C
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
%.o: $(BOINC_SRC)/lib/%.C
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
%.o: $(BOINC_SRC)/api/%.cpp
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
%.o: $(BOINC_SRC)/lib/%.cpp
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
# C-mode file
md5.o: $(BOINC_SRC)/lib/md5.c
$(CXX) -c $(BOINC_SRC)/lib/md5.c -o md5.o $(CPPFLAGS) $(CXXFLAGS)
# for boinc_zip. Don't change the order!
%.o: $(BOINC_SRC)/zip/%.cpp
$(CXX) -c $< -o $@ $(ZIP_FLAGS)
%.o: $(BOINC_SRC)/zip/unzip/win32/%.c
$(CC) -c $< -o $@ $(ZIP_FLAGS)
%.o: $(BOINC_SRC)/zip/unzip/%.c
$(CC) -c $< -o $@ $(ZIP_FLAGS)
%.o: $(BOINC_SRC)/zip/zip/win32/%.c
$(CC) -c $< -o $@ $(ZIP_FLAGS)
%.o: $(BOINC_SRC)/zip/zip/%.c
$(CC) -c $< -o $@ $(ZIP_FLAGS)
z_util.o: $(BOINC_SRC)/zip/zip/util.c
$(CC) -c $< -o $@ $(ZIP_FLAGS)
# set to the target ranlib when cross-compiling
RANLIB ?= ranlib
# additional targets
install: $(BIN) $(HEADERS)
mkdir -p $(BOINC_PREFIX)/include/BOINC $(BOINC_PREFIX)/lib
cp $(HEADERS) $(BOINC_PREFIX)/include/BOINC
$(RANLIB) $(BIN)
cp $(BIN) $(BOINC_PREFIX)/lib
install-zip: $(ZIP_BIN) $(ZIP_HEADERS)
mkdir -p $(BOINC_PREFIX)/include/BOINC $(BOINC_PREFIX)/lib
cp $(ZIP_HEADERS) $(BOINC_PREFIX)/include/BOINC
$(RANLIB) $(ZIP_BIN)
cp $(ZIP_BIN) $(BOINC_PREFIX)/lib
uninstall:
rm -f $(BOINC_PREFIX)/include/BOINC/*.h
( cd $(BOINC_PREFIX)/lib && rm -f $(BIN) || exit 0 )
clean:
${RM} $(OBJ) $(BIN) $(ZIP_BIN)
......@@ -97,6 +97,7 @@ typedef size_t socklen_t;
#include <commctrl.h>
#include <raserror.h>
#if defined(MINGW_WIN32)
#include <stdint.h>
#include <imagehlp.h>
#else
#include <dbghelp.h>
......
......@@ -22,7 +22,7 @@
#include "boinc_win.h"
#endif
#ifdef _MSC_VER
#if defined(_WIN32) && !defined(__CYGWIN32__)
#define snprintf _snprintf
#define strdate _strdate
#define strtime _strtime
......@@ -152,7 +152,7 @@ int boinc_finish_diag() {
int boinc_install_signal_handlers() {
#ifdef _WIN32
SetUnhandledExceptionFilter(boinc_catch_signal);
#if _MSC_VER >= 1400
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
_set_invalid_parameter_handler(boinc_catch_signal_invalid_parameter);
#endif
#else //_WIN32
......
......@@ -114,12 +114,7 @@ extern int diagnostics_finish_unhandled_exception_monitor();
#ifdef _WIN32
extern UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID lpParameter);
extern LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *ExceptionInfo);
#ifndef MINGW_WIN32
extern void boinc_catch_signal_invalid_parameter(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved);
#else
extern void boinc_catch_signal_invalid_parameter(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line);
#endif
#else
extern void boinc_catch_signal(int signal);
extern void boinc_set_signal_handler(int sig, void(*handler)(int));
......
......@@ -22,7 +22,7 @@
#include "boinc_win.h"
#endif
#ifdef _MSC_VER
#if defined(_WIN32) && !defined(__CYGWIN__)
#define snprintf _snprintf
#define strdate _strdate
#define strtime _strtime
......@@ -2070,7 +2070,7 @@ LONG CALLBACK boinc_catch_signal(PEXCEPTION_POINTERS pExPtrs) {
// then throw a breakpoint exception to dump all the rest of the useful
// information.
void boinc_catch_signal_invalid_parameter(
const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t /* pReserved */
const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t /* pReserved */
) {
fprintf(
stderr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment