To stay on topic, I have in fact succeeded in building on Windows without VS. For this I used msys2/MinGW-w64.
I did have to edit some files to get it to work:
- src/Makefile.gcc-pch
On line 25, change
CXXFLAGS ?= -Wall -Wextra -Wno-unused-function -O2 -rdynamic -g -D_DEBUG
to
CXXFLAGS ?= -Wall -Wextra -Wno-unused-function -O2 -g -D_DEBUG
The -rdynamic flag apparently doesn't exist in MinGW (https://stackoverflow.com/questions/17483306/compiling-with-mingw-unrecognized-command-line-option).
On line 30, change
LIBS = $(shell $(PKG-CONFIG) --libs sdl yaml-cpp) -lSDL_gfx -lSDL_mixer -lSDL_image -lGL
to
LIBS = $(shell $(PKG-CONFIG) --libs sdl yaml-cpp) -lSDL_gfx -lSDL_mixer -lSDL_image -lopengl32 -lshlwapi
- src/Engine/Zoom.cpp
Find the following lines
#ifdef __GNUC__
#if (__i386__ || __x86_64__)
#include <cpuid.h>
#endif
#endif
and delete them. I built using the x86_64 toolchain, which causes a problem with this. Chalk it up to A Windows Thing.
To build, go into src/ and invoke
make -f Makefile.gcc-pch
Unfortunately, this process does not at this time seem to work for OpenXComExtended+. When linking it errors out with
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/WarningMessage.o: in function `OpenXcom::WarningMessage::WarningMessage(int, int, int, int)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/WarningMessage.cpp:41: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/CannotReequipState.o: in function `OpenXcom::CannotReequipState::CannotReequipState(std::vector<OpenXcom::ReequipStat, std::allocator<OpenXcom::ReequipStat> >)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/CannotReequipState.cpp:73: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/InfoboxState.o: in function `OpenXcom::InfoboxState::InfoboxState(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/InfoboxState.cpp:58: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/AliensCrashState.o: in function `OpenXcom::AliensCrashState::AliensCrashState()':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/AliensCrashState.cpp:67: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/InfoboxOKState.o: in function `OpenXcom::InfoboxOKState::InfoboxOKState(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/InfoboxOKState.cpp:70: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/BuildNewBaseState.o:d:\Games\OpenXCOM\OXCE+\src/Geoscape/BuildNewBaseState.cpp:136: more undefined references to `OpenXcom::Text::setWordWrap(bool, bool)' follow
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile.gcc-pch:42: ../bin/openxcom] Error 1
It seems the function declaration of setWordWrap has changed to accept a third argument, which VC apparently accepts but g++ does not.
Edit: I tried adding in the old definition of that function from vanilla OXC, and that remedies the issue. I have successfully built OXCE+ this way as well.
To stay on topic, I have in fact succeeded in building on Windows without VS. For this I used msys2/MinGW-w64.
I did have to edit some files to get it to work:
- src/Makefile.gcc-pch
On line 25, change
CXXFLAGS ?= -Wall -Wextra -Wno-unused-function -O2 -rdynamic -g -D_DEBUG
to
CXXFLAGS ?= -Wall -Wextra -Wno-unused-function -O2 -g -D_DEBUG
The -rdynamic flag apparently doesn't exist in MinGW (https://stackoverflow.com/questions/17483306/compiling-with-mingw-unrecognized-command-line-option).
On line 30, change
LIBS = $(shell $(PKG-CONFIG) --libs sdl yaml-cpp) -lSDL_gfx -lSDL_mixer -lSDL_image -lGL
to
LIBS = $(shell $(PKG-CONFIG) --libs sdl yaml-cpp) -lSDL_gfx -lSDL_mixer -lSDL_image -lopengl32 -lshlwapi
- src/Engine/Zoom.cpp
Find the following lines
#ifdef __GNUC__
#if (__i386__ || __x86_64__)
#include <cpuid.h>
#endif
#endif
and delete them. I built using the x86_64 toolchain, which causes a problem with this. Chalk it up to A Windows Thing.
To build, go into src/ and invoke
make -f Makefile.gcc-pch
Unfortunately, this process does not at this time seem to work for OpenXComExtended+. When linking it errors out with
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/WarningMessage.o: in function `OpenXcom::WarningMessage::WarningMessage(int, int, int, int)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/WarningMessage.cpp:41: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/CannotReequipState.o: in function `OpenXcom::CannotReequipState::CannotReequipState(std::vector<OpenXcom::ReequipStat, std::allocator<OpenXcom::ReequipStat> >)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/CannotReequipState.cpp:73: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/InfoboxState.o: in function `OpenXcom::InfoboxState::InfoboxState(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/InfoboxState.cpp:58: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/AliensCrashState.o: in function `OpenXcom::AliensCrashState::AliensCrashState()':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/AliensCrashState.cpp:67: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/InfoboxOKState.o: in function `OpenXcom::InfoboxOKState::InfoboxOKState(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)':
d:\Games\OpenXCOM\OXCE+\src/Battlescape/InfoboxOKState.cpp:70: undefined reference to `OpenXcom::Text::setWordWrap(bool, bool)'
C:/Programs/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../obj/linux/BuildNewBaseState.o:d:\Games\OpenXCOM\OXCE+\src/Geoscape/BuildNewBaseState.cpp:136: more undefined references to `OpenXcom::Text::setWordWrap(bool, bool)' follow
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile.gcc-pch:42: ../bin/openxcom] Error 1
It seems the function declaration of setWordWrap has changed to accept a third argument, which VC apparently accepts but g++ does not.
Edit: I tried adding in the old definition of that function from vanilla OXC, and that remedies the issue. I have successfully built OXCE+ this way as well.
For OXCE and OXCE+ you probably should use `src/Makefile.mingw`or `Makefile.mingw-w64` and more importantly cleanup all build files before building different branch.