diff --git a/sc2/build/unix/README.crossbuild b/sc2/build/unix/README.crossbuild index 8b6501771..2c3e60bff 100644 --- a/sc2/build/unix/README.crossbuild +++ b/sc2/build/unix/README.crossbuild @@ -38,9 +38,9 @@ library dirs in LDFLAGS. Run configure: ./build.sh uqm config -This will produce the file 'build.vars' and 'config_unix.h'. If there -are any problems during the build, you can usually easilly solve them -by editing these files manually. +This will produce the file 'build.vars' and 'config_unix.h' (or config_win.h +on MinGW or Cygwin). If there are any problems during the build, you can +usually easilly solve them by editing these files manually. Start the compilation: ./build.sh uqm diff --git a/sc2/build/unix/build.config b/sc2/build/unix/build.config index 23ed862dd..06fc4d3a4 100644 --- a/sc2/build/unix/build.config +++ b/sc2/build/unix/build.config @@ -236,9 +236,16 @@ uqm_process_config() { CFLAGS="$CFLAGS -I \"$BUILD_WORK\"" # Export the HAVE_ symbols to config_unix.h, using config_unix.h.in - # as template. + # as template (or config_win.h/config_win.h.in). SUBSTITUTE_VARS="$HAVE_SYMBOLS CONTENTDIR" - SUBSTITUTE_FILES="config_unix.h" + case "$HOST_SYSTEM" in + MINGW32*|CYGWIN*) + SUBSTITUTE_FILES="config_win.h" + ;; + *) + SUBSTITUTE_FILES="config_unix.h" + ;; + esac substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES src "$BUILD_WORK" # Make build.vars from build.vars.in, substituting variables. @@ -379,4 +386,15 @@ uqm_install_osx() { cp $uqm_NAME "$INSTROOT/MacOS/The Ur-Quan Masters" } +uqm_clean() { + case "$HOST_SYSTEM" in + MINGW32*|CYGWIN*) + rm -f "$BUILD_WORK/config_win.h" + ;; + *) + rm -f "$BUILD_WORK/config_unix.h" + ;; + esac +} + diff --git a/sc2/build/unix/build_functions b/sc2/build/unix/build_functions index 732278029..53f63d022 100644 --- a/sc2/build/unix/build_functions +++ b/sc2/build/unix/build_functions @@ -130,7 +130,8 @@ build_clean() { eval DEPEND_FILE="\$BUILD_WORK/\${${BUILD_PROJECT}_OBJS}${DEPEND_NAME}" rm -f "$DEPEND_FILE" "$BUILD_WORK/build.vars" \ - "$BUILD_WORK/config.state" "$BUILD_WORK/config_unix.h" + "$BUILD_WORK/config.state" + eval "${TARGET}_clean" } build_cleanall() { diff --git a/sc2/src/config.h b/sc2/src/config.h index 3180203ef..51e673a01 100644 --- a/sc2/src/config.h +++ b/sc2/src/config.h @@ -7,6 +7,10 @@ * If you want anything else than the defaults, you'll have to edit * that file manually. */ # include "msvc++/config.h" +#elif defined (__MINGW32__) || defined (__CYGWIN__) + /* If we're compiling on MS Windows using build.sh, use + * config_win.h, generated from * src/config_win.h.in. */ +# include "config_win.h" #else /* If we're compiling in unix, use config_unix.h, generated from * src/config_unix.h.in by build.sh. */ diff --git a/sc2/src/config_unix.h.in b/sc2/src/config_unix.h.in index 03dbf92ea..12550c7b5 100644 --- a/sc2/src/config_unix.h.in +++ b/sc2/src/config_unix.h.in @@ -1,8 +1,10 @@ /* This file contains some compile-time configuration options for *nix * systems. * config_unix.h is generated from config_unix.h.in by build.sh - * For windows, you'll have to edit src/msvc++/config.h manually - * if you want anything else than the defaults. + * When building on MS Windows using build.sh (MinGW, Cygwin), + * config_win.h is generated from src/config_win.h.in. + * When using MSVC on MS Windows, you'll have to edit src/msvc++/config.h + * manually if you want anything else than the defaults. */ #ifndef _CONFIG_UNIX_H diff --git a/sc2/src/config_win.h.in b/sc2/src/config_win.h.in new file mode 100644 index 000000000..b95c88107 --- /dev/null +++ b/sc2/src/config_win.h.in @@ -0,0 +1,58 @@ +/* This file contains some compile-time configuration options for MS Windows + * systems when building using build.sh (MinGW, Cygwin). + * config_win.h is generated from src/config_win.h.in by build.sh + * For building using MSVC, you'll have to edit src/msvc++/config.h manually + * if you want anything else than the defaults. + * For *nix systems, config_unix.h is used, which is generated by build.sh + * from src/config_unix.h.in. + */ + +#ifndef _CONFIG_WIN_H +#define _CONFIG_WIN_H + +/* Directory where the UQM game data is located */ +#define CONTENTDIR "@CONTENTDIR@" + +/* Directory where game data will be stored */ +//#define USERDIR "../userdata/" +#define USERDIR "%APPDATA%/uqm/" + +/* Directory where config files will be stored */ +#define CONFIGDIR USERDIR + +/* Directory where supermelee teams will be stored */ +#define MELEEDIR "%UQM_CONFIG_DIR%teams/" + +/* Directory where save games will be stored */ +#define SAVEDIR "%UQM_CONFIG_DIR%save/" + +/* Defined if words are stored with the most significant byte first */ +@WORDS_BIGENDIAN@ + +/* Defined if your system has readdir_r of its own */ +@HAVE_READDIR_R@ + +/* Defined if your system has setenv of its own */ +@HAVE_SETENV@ + +/* Defined if your system has strupr of its own */ +@HAVE_STRUPR@ + +/* Defined if your system has stricmp of its own */ +@HAVE_STRICMP@ + +/* Defined if your system has getopt.h */ +@HAVE_GETOPT_H@ + +/* Defined if your system has iswgraph of its own*/ +@HAVE_ISWGRAPH@ + +/* Defined if your system has wchar_t of its own */ +@HAVE_WCHAR_T@ + +/* Defined if your system has wint_t of its own */ +@HAVE_WINT_T@ + +#endif /* _CONFIG_WIN_H */ + + diff --git a/sc2/src/msvc++/config.h b/sc2/src/msvc++/config.h index dd4271f93..3307762aa 100644 --- a/sc2/src/msvc++/config.h +++ b/sc2/src/msvc++/config.h @@ -1,8 +1,10 @@ /* This file contains some compile-time configuration options for MS Windows - * systems. + * systems when building using MSVC. * Change the values below if you want anything other than the defaults. - * For *nix systems, src/config.h is used, which is generated by - * build.sh from src/config.h.in. + * For *nix systems, config_unix.h is used, which is generated by build.sh + * from src/config_unix.h.in. + * When building on MS Windows using build.sh (MinGW, Cygwin), + * config_win.h is generated from src/config_win.h.in. */ #ifndef _CONFIG_H