set_downloader() {
test_program_installed wget
if [[ $? -ne 0 ]] ; then
- DOWNLOADER=wget
+ DOWNLOADER="wget -nd"
DOWNLOADER_NAME=wget
return
fi
}
set_cc() {
+
+ # on Cygwin we MUST use the MinGW "cross-compiler", therefore check these first
+ # furthermore, we prefer 64 bit over 32 bit versions if both are available
+ test_programs_installed x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++
+ if [[ $? -ne 0 ]] ; then
+ [ -z "$CC" ] && CC=x86_64-w64-mingw32-gcc
+ [ -z "$CXX" ] && CXX=x86_64-w64-mingw32-g++
+ return
+ fi
+
+ test_programs_installed i686-w64-mingw32-gcc i686-w64-mingw32-g++
+ if [[ $? -ne 0 ]] ; then
+ [ -z "$CC" ] && CC=i686-w64-mingw32-gcc
+ [ -z "$CXX" ] && CXX=i686-w64-mingw32-g++
+ return
+ fi
+
test_programs_installed clang clang++
if [[ $? -ne 0 ]] && clang_version_ok ; then
[ -z "$CC" ] && CC=clang
return
fi
+ # gcc and g++ will fail to correctly build Factor on Cygwin
test_programs_installed gcc g++
if [[ $? -ne 0 ]] ; then
[ -z "$CC" ] && CC=gcc
ensure_program_installed uname
ensure_program_installed git
ensure_program_installed wget curl
- ensure_program_installed clang gcc
- ensure_program_installed clang++ g++ cl
+ ensure_program_installed clang x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc gcc
+ ensure_program_installed clang++ x86_64-w64-mingw32-g++ i686-w64-mingw32-g++ g++ cl
ensure_program_installed make gmake
ensure_program_installed md5sum md5
ensure_program_installed cut
-SITE_CFLAGS += -mno-cygwin -mwindows
+SITE_CFLAGS += -mwindows
CFLAGS_CONSOLE += -mconsole
SHARED_FLAG = -shared
SHARED_DLL_EXTENSION=.dll
PLAF_DLL_OBJS += vm/os-windows.o vm/mvm-windows.o
PLAF_EXE_OBJS += vm/resources.o vm/main-windows.o
-PLAF_MASTER_HEADERS += vm/os-windows.hpp vm/mvm-windows.hpp
+PLAF_MASTER_HEADERS += vm/os-windows.hpp
EXE_SUFFIX=
EXE_EXTENSION=.exe
DLL_EXTENSION=.dll
CONSOLE_EXTENSION=.com
-LINKER = $(CPP) -shared -mno-cygwin -o
+LINKER = $(CPP) -shared -o
LINK_WITH_ENGINE = -l$(DLL_PREFIX)factor$(DLL_SUFFIX)
PLAF_DLL_OBJS += vm/os-windows-x86.32.o
PLAF_MASTER_HEADERS += vm/os-windows.32.hpp
DLL_PATH=http://factorcode.org/dlls
-WINDRES=windres
+WINDRES=windres -F pe-i386
include vm/Config.windows
include vm/Config.x86.32
#elif defined(__INTEL_COMPILER)
#define FACTOR_COMPILER_VERSION \
"Intel C Compiler " FACTOR_STRINGIZE(__INTEL_COMPILER)
+#elif defined(__MINGW32__)
+#define FACTOR_COMPILER_VERSION "MinGW (GCC " __VERSION__ ")"
#elif defined(__GNUC__)
#define FACTOR_COMPILER_VERSION "GCC " __VERSION__
#elif defined(_MSC_FULL_VER)
#error "Unsupported architecture"
#endif
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined (__MINGW32__)
#define WINDOWS
#define WINNT
#elif defined(WIN32)
void sleep_nanos(uint64_t nsec) { Sleep((DWORD)(nsec / 1000000)); }
+#ifndef EXCEPTION_DISPOSITION
typedef enum _EXCEPTION_DISPOSITION {
ExceptionContinueExecution = 0,
ExceptionContinueSearch = 1,
ExceptionNestedException = 2,
ExceptionCollidedUnwind = 3
} EXCEPTION_DISPOSITION;
+#endif
LONG factor_vm::exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c,
void* dispatch) {