Skip to content

Commit

Permalink
- API: compile fixes for MinGW. From Oliver Bock.
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=24474
  • Loading branch information
davidpanderson committed Oct 24, 2011
1 parent 14e3bd7 commit 77e3c4d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 13 deletions.
12 changes: 11 additions & 1 deletion checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -7707,7 +7707,7 @@ Charlie 24 Oct 2011
mac_build/
Mac_SA_Secure.sh

David 21 Oct 2011
David 24 Oct 2011
- client: reimplement the round-robin simulator to
reduce its runtime from O(N^2) to O(N),
where N is the number of runnable jobs
Expand Down Expand Up @@ -7735,3 +7735,13 @@ Rom 24 Oct 2011
skin.xml
clientgui/skins/Progress Thru Processors/
skin.xml

David 24 Oct 2011
- API: compile fixes for MinGW. From Oliver Bock.

lib/
win_util.h
boinc_win.h
proc_control.h
Makefile.mingw
parse.h
15 changes: 11 additions & 4 deletions lib/Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ BOINC_SRC ?= ..
# headers to install
HEADERS = $(BOINC_SRC)/version.h \
$(BOINC_SRC)/api/boinc_api.h \
$(BOINC_SRC)/api/boinc_opencl.h \
$(BOINC_SRC)/api/graphics2.h \
$(BOINC_SRC)/lib/app_ipc.h \
$(BOINC_SRC)/lib/boinc_win.h \
$(BOINC_SRC)/lib/url.h \
$(BOINC_SRC)/lib/common_defs.h \
$(BOINC_SRC)/lib/diagnostics.h \
$(BOINC_SRC)/lib/diagnostics_win.h \
$(BOINC_SRC)/lib/error_numbers.h \
$(BOINC_SRC)/lib/filesys.h \
$(BOINC_SRC)/lib/hostinfo.h \
$(BOINC_SRC)/lib/proxy_info.h \
Expand All @@ -38,10 +40,12 @@ ZIP_HEADERS = zip/boinc_zip.h

API_OBJ = boinc_api.o graphics2_util.o

OCL_OBJ = boinc_opencl.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 \
hostinfo.o md5.o md5_file.o mem_usage.o mfile.o miofile.o procinfo_win.o procinfo.o proc_control.o parse.o prefs.o \
proxy_info.o str_util.o shmem.o base64.o stackwalker_win.o url.o coproc.o

ZIP_OBJ = boinc_zip.o z_win32.o win32zip.o zipup.o zipfile.o zip.o z_globals.o z_fileio.o \
Expand All @@ -52,15 +56,16 @@ ZIP_OBJ = boinc_zip.o z_win32.o win32zip.o zipup.o zipfile.o zip.o z_globals.o z

# libraries to build
API_BIN = libboinc_api.a
OCL_BIN = libboinc_opencl.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)
OBJ = $(API_OBJ) $(OCL_OBJ) $(LIB_OBJ) $(GPH_OBJ) $(ZIP_OBJ)

# all libraries (zip not listed anymore)
BIN = $(API_BIN) $(LIB_BIN) $(GPH_BIN)
BIN = $(API_BIN) $(OCL_BIN) $(LIB_BIN) $(GPH_BIN)

# -gstabs is necessary for MinGWs backtrace to work
#DEBUG = -D__DEBUG__ -gstabs -g3
Expand Down Expand Up @@ -97,6 +102,8 @@ boinc_zip: $(ZIP_BIN)
# rules for the indivisual libraries
$(API_BIN): $(API_OBJ)
$(AR) rc $@ $^
$(OCL_BIN): $(OCL_OBJ)
$(AR) rc $@ $^
$(LIB_BIN): $(LIB_OBJ)
$(AR) rc $@ $^
$(GPH_BIN): $(GPH_OBJ)
Expand Down Expand Up @@ -154,7 +161,7 @@ install-zip: $(ZIP_BIN) $(ZIP_HEADERS)

uninstall:
${RM} -rf $(BOINC_PREFIX)/include/boinc
${RM} $(BOINC_PREFIX)/lib/libboinc.a $(BOINC_PREFIX)/lib/libboinc_api.a $(BOINC_PREFIX)/lib/libboinc_graphics2.a
${RM} $(BOINC_PREFIX)/lib/libboinc.a $(BOINC_PREFIX)/lib/libboinc_api.a $(BOINC_PREFIX)/lib/libboinc_opencl.a $(BOINC_PREFIX)/lib/libboinc_graphics2.a
( cd $(BOINC_PREFIX)/lib && rm -f $(BIN) || exit 0 )

clean:
Expand Down
7 changes: 5 additions & 2 deletions lib/boinc_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
#define __attribute__(x)
#endif

#if defined(__MINGW32__) && (__GNUC__ < 4)
// breaks build on MinGW gcc-4
#if defined(__MINGW32__)
#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -257,6 +256,10 @@ void __cdecl fpreset (void);
#ifdef __cplusplus
}
#endif //cplusplus
#endif //MINGW32

#if defined(__MINGW32__) && (__GNUC__ < 4)
// breaks build on MinGW gcc-4
#define SetClassLongPtr SetClassLong
#define GCLP_HICON GCL_HICON
#define GCLP_HICONSM GCL_HICONSM
Expand Down
4 changes: 2 additions & 2 deletions lib/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ inline bool match_tag(const std::string &s, const char* tag) {
return match_tag(s.c_str(), tag);
}

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#define boinc_strtoull _strtoui64
#else
#if HAVE_STRTOULL
#if defined(HAVE_STRTOULL) || defined(__MINGW32__)
#define boinc_strtoull strtoull
#else
inline unsigned long long boinc_strtoull(const char *s, char **, int) {
Expand Down
4 changes: 4 additions & 0 deletions lib/proc_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
#define _PROC_CONTROL_

#include <vector>
#ifdef _WIN32
#include <windows.h>
#endif

extern void get_descendants(int pid, std::vector<int>& pids);
extern bool any_process_exists(std::vector<int>& pids);
extern void kill_all(std::vector<int>& pids);
#ifdef _WIN32
extern void kill_descendants();
extern int suspend_or_resume_threads(DWORD pid, DWORD threadid, bool resume);
#else
extern void kill_descendants(int child_pid=0);
#endif
Expand Down
10 changes: 6 additions & 4 deletions lib/win_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#ifndef _WIN_UTIL_
#define _WIN_UTIL_

#include <string>
#include <windows.h>
#include <malloc.h>

extern BOOL IsWindows2000Compatible();
extern BOOL IsTerminalServicesEnabled();
extern BOOL ValidateProductSuite(LPSTR SuiteName);
Expand All @@ -29,6 +33,8 @@ extern BOOL GetAccountSid(
LPCSTR AccountName, // account of interest
PSID *Sid // resultant buffer containing SID
);
extern void chdir_to_data_dir();
extern bool is_remote_desktop();

inline std::wstring A2W(const std::string& str) {
int length_wide = MultiByteToWideChar(CP_UTF8, 0, str.data(), (int)str.length(), NULL, 0);
Expand All @@ -46,8 +52,4 @@ inline std::string W2A(const std::wstring& str) {
return result;
}

extern int suspend_or_resume_threads(DWORD pid, DWORD threadid, bool resume);
extern void chdir_to_data_dir();
extern bool is_remote_desktop();

#endif // _WIN_UTIL_

0 comments on commit 77e3c4d

Please sign in to comment.