Browse Source

Merge branch 'windows-cross-compile'

nfactor-troky
Noel Maersk 10 years ago
parent
commit
cd5fa8d3cb
  1. 19
      compat.h
  2. 31
      configure.ac
  3. 99
      doc/windows-build.txt

19
compat.h

@ -47,15 +47,16 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem) @@ -47,15 +47,16 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem)
}
#endif
static inline int sleep(unsigned int secs)
{
struct timespec req, rem;
req.tv_sec = secs;
req.tv_nsec = 0;
if (!nanosleep(&req, &rem))
return 0;
return rem.tv_sec + (rem.tv_nsec ? 1 : 0);
}
/* Reported unneded in https://github.com/veox/sgminer/issues/37 */
/* static inline int sleep(unsigned int secs) */
/* { */
/* struct timespec req, rem; */
/* req.tv_sec = secs; */
/* req.tv_nsec = 0; */
/* if (!nanosleep(&req, &rem)) */
/* return 0; */
/* return rem.tv_sec + (rem.tv_nsec ? 1 : 0); */
/* } */
enum {
PRIO_PROCESS = 0,

31
configure.ac

@ -186,18 +186,35 @@ if test "x$has_winpthread" != xtrue; then @@ -186,18 +186,35 @@ if test "x$has_winpthread" != xtrue; then
fi
AC_ARG_ENABLE([adl],
[AC_HELP_STRING([--disable-adl],[Override detection and disable building with adl])],
[AC_HELP_STRING([--disable-adl],[Override detection and disable building with ADL])],
[adl=$enableval]
)
AC_ARG_ENABLE([adl_checks],
[AC_HELP_STRING([--disable-adl-checks],[Override detection and assume ADL is available])],
[adl_checks=$enableval]
)
if test "$found_opencl" = 1; then
if test "x$adl" != xno; then
ADL_CPPFLAGS=
AC_CHECK_FILE([$srcdir/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$srcdir], have_adl=false,)
dnl FIXME: force ADL usage if disable-checks specified
if test "x$adl_checks" = xno; then
have_adl=true
ADL_CPPFLAGS=-I$srcdir
fi
dnl Check if include files are in $srcdir/ADL_SDK
if test "x$have_adl" != xtrue; then
ADL_CPPFLAGS=
AC_CHECK_FILE([$srcdir/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$srcdir], have_adl=false,)
fi
dnl FIXME: Check if SGMINER_SDK present
if test x$have_adl+$have_sgminer_sdk = xfalse+true; then
AC_CHECK_FILE([$SGMINER_SDK/include/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$SGMINER_SDK/include], have_adl=false,)
fi
if test x$have_adl = xtrue
if test "x$have_adl" = xtrue
then
AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
else
@ -379,7 +396,11 @@ fi @@ -379,7 +396,11 @@ fi
if test "x$adl" != xno; then
if test x$have_adl = xtrue; then
echo " ADL..................: SDK found, GPU monitoring support enabled"
if test "x$adl_checks" = xno; then
echo " ADL..................: SDK use FORCED"
else
echo " ADL..................: SDK found, GPU monitoring support enabled"
fi
else
echo " ADL..................: SDK NOT found, GPU monitoring support DISABLED"
fi

99
doc/windows-build.txt

@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
######################################################################################
# #
# SGMINER WIN32 setup and build instructions (on mingw32/Windows): #
# Native WIN32 setup and build instructions (on mingw32/Windows): #
# #
######################################################################################
(See bottom of file for steps to cross-build for Win32 from Linux.)
**************************************************************************************
* Introduction *
**************************************************************************************
@ -36,8 +38,8 @@ what you copied. @@ -36,8 +38,8 @@ what you copied.
**************************************************************************************
Download and install the following Mingw32 version by doing a google search for:
"mingw-get-inst-20120426"
*This is currently a known working version as of SGMINER 4.0.0, but this could be a
different version later.
This is currently a known working version, but this could be a different version
later.
During installation, select all the check boxes (excluding "Fortran Compiler") so that
everything is installed.
@ -202,12 +204,99 @@ For you. Make sure you never remove the ADL_SDK folder from your home folder. @@ -202,12 +204,99 @@ For you. Make sure you never remove the ADL_SDK folder from your home folder.
* Some ./configure options *
**************************************************************************************
--enable-opencl Enable support for GPU mining with opencl
--disable-adl Override detection and disable building with adl
--disable-adl Override detection and disable building with ADL
--disable-adl-checks Override detection and assume ADL is present
--disable-libcurl Disable building with libcurl for getwork and GBT support
--without-curses Compile support for curses TUI (default enabled)
######################################################################################
# #
# Native WIN32 setup and build instructions (on mingw32/Windows) complete #
# Cross-compiling for Windows from Linux #
# #
######################################################################################
It is possible to cross-compile Windows binaries from Linux. The
process is a bit different to the native steps shown above (it is also
possible to use wine and the native steps, but this is more messing
around, very slow, and not advisable.)
** Install mingw cross compiler
On Ubuntu/Debian:
sudo apt-get install mingw32
** create a directory to hold our cross-library dependencies
We'll create a directory outside the source tree to hold non-system
libraries we depend on. We could put these in
/usr/i586-mingw32msvc/lib or anywhere else, instead (though keeping it
outside /usr means we can set it up without root privileges.)
IMPORTANT: If you put this directory inside your sgminer directory,
remember 'make distclean' may delete it!
mkdir -p ../win32/lib
cd ../win32
mkdir include
mkdir bin
NB: All following steps assume you are in the "win32" directory. Adjust as necessary.
** pdcurses
wget http://internode.dl.sourceforge.net/project/pdcurses/pdcurses/3.4/pdc34dllw.zip
unzip /home/gus/Downloads/pdc34dllw.zip
mv *.h include/
mv pdcurses.lib lib/
mv pdcurses.dll bin/
** pthreads-w32
(NB: I found pthreads-w32 2.9.1 doesn't seem to work properly, transfers time out
early due to sem_timedwait exiting immediately(?))
wget -O lib/libpthread.a ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/lib/libpthreadGC2.a
wget -O include/pthread.h ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/include/pthread.h
wget -O include/sched.h ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/include/sched.h
wget -O include/semaphore.h ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/include/semaphore.h
wget -O lib/libpthread.a ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/lib/libpthreadGC2.a
wget -O bin/pthreadGC2.dll ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/lib/pthreadGC2.dll
** libcurl
wget http://curl.haxx.se/gknw.net/7.33.0/dist-w32/curl-7.33.0-devel-mingw32.zip
unzip curl-7.33.0-devel-mingw32.zip
mv curl-7.33.0-devel-mingw32/include/* include/
mv curl-7.33.0-devel-mingw32/lib/* lib/
mv curl-7.33.0-devel-mingw32/bin/* bin/
rm -rf curl-7.33.0-devel-mingw32
** clean up
rm *.zip
** Building
Below assumes you're building in a "build-win32" or similar directory
inside the sgminer directory. Fix up the -I and -L paths appropriately
if you're building in-tree or someplace else.
Configure command:
CPPFLAGS="-I`pwd`/../../win32/include" LDFLAGS="-L`pwd`/../../win32/lib -lcurldll" ../autogen.sh --prefix=/usr/local/i586-mingw32 --host=i586-mingw32msvc --build=i686-linux
^^^ Plus whatever configure arguments you want to add. Note the paths
to win32 that you may need to change.
And make:
make
After building, the next steps are the same as for native
building as given under "Copy files to a build directory/folder"
(DLLs can all be found in the win32/bin directory.)

Loading…
Cancel
Save