Author Topic: Building openXCom in 64-bits with MinGW on Windows  (Read 27585 times)

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Building openXCom in 64-bits with MinGW on Windows
« on: March 28, 2016, 06:21:57 pm »
Hello,

I have already built the project three or four years ago, and I remember I was stuck with 32-bits building because I was unable to build SDL1.2 by myself.
I have just installed a Mingw64 set which includes a 64-bit SDL2 already compiled. May I try building openXCom with it, or is SDL1.2 mandatory?

Sorry because my question seems a bit noob-like  :-\
« Last Edit: March 29, 2016, 06:47:26 pm by JDarthenay »

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Building with SDL2?
« Reply #1 on: March 28, 2016, 09:45:13 pm »
for now 1.2 is required, but some branches switch to 2.0 because it support android.

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Re: Building with SDL2?
« Reply #2 on: March 28, 2016, 10:27:32 pm »
So, what should I do ? Use a SDL2 branch or try to build a 64-bit SDL1.2?

Edit: My bad, it seems now there is a 64-bit runtime available for download. I guess I will try using it first.
« Last Edit: March 28, 2016, 11:22:04 pm by JDarthenay »

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Re: Building with SDL2?
« Reply #3 on: March 29, 2016, 06:07:22 pm »
Oh my god, I spent this whole f***ing day to try to find how to build SDL 1.2. All that to generate this damn stupid 17Ko libSDLmain.a file. Not even sure I succeeded, all that I have done so far is a black screen test program... Anybody would know a good hello world SDL 1.2 program? I don't know why I am not even finding this.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Building with SDL2?
« Reply #4 on: March 29, 2016, 06:20:26 pm »
Another noob here, so maybe a stupid comment, but...

I compiled OpenXcom under Linux two days ago for the first time using guide on https://ufopaedia.org.
It was super easy.

And yesterday I even compiled a windows EXE under Linux, using Mingw-w64 (on 32-bit Kubuntu btw.).
That was a bit more complicated for a noob, but no rocket science.

In both cases it was either a pre-compiled sdl, or the cmake+make did everything for me... I don't even know.

So, the questions:
- why do you want to compile it yourself?
- isn't the official guide enough?
- do you want it only because of 64bits? if so, just saying you won't get any benefits from it compared to 32bits

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Re: Building with SDL2?
« Reply #5 on: March 29, 2016, 06:38:07 pm »
So, the questions:
- why do you want to compile it yourself?

Because I was unable to find the file SDLmain.a in a 64-bit version.

- isn't the official guide enough?

Which official guide?  :o
If you speak of SDL 1.2 official guide it was saying me to use MSys2 (or MSys, I am not sure) and Avast warned me he was putting Msys2 executable in quarantine because they had malwares so I uninstalled Msys2 and tried doing it with Cygwin. Maybe I was successful.

- do you want it only because of 64bits? if so, just saying you won't get any benefits from it compared to 32bits

Maybe you're right, but I remember not being able to build openXCom in 64-bits 4 years ago even though I succeeded in 32-bits, and I was wondering if I would succeed on doing it this time.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Building with SDL2?
« Reply #6 on: March 29, 2016, 06:54:23 pm »
Which official guide?  :o

I used this one: https://www.ufopaedia.org/index.php/Compiling_with_CMake_%28OpenXcom%29

Basically:
0. git clone https://github.com/SupSuper/OpenXcom.git
1. cd OpenXcom
2. sudo get-apt install .... all dependencies as listed here: https://www.ufopaedia.org/index.php/Compiling_%28OpenXcom%29#Linux.2FBSD
3. mkdir buiild
4. cd build
5. cmake ..
6. make

Done.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #7 on: March 29, 2016, 07:10:37 pm »
Those are excellent instructions, if you are on a (Debian derivative) Linux box.

But the post title states building under windows ;)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #8 on: March 29, 2016, 07:15:01 pm »
OMG.... how could I miss that!

... if you need me, I'll be in the corner of shame.

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #9 on: March 29, 2016, 07:16:30 pm »
I won't blame you for not reading the new title I put one hour ago  ;D

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #10 on: March 29, 2016, 08:10:53 pm »
There's also a guide for MinGW: https://www.ufopaedia.org/index.php/Compiling_with_MinGW_(OpenXcom)

Although it's 32-bit, not 64-bit, but the steps shouldn't be too different. CMake might also be able to generate a MinGW-configured Makefile.

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #11 on: March 29, 2016, 08:19:17 pm »
Speaking of that... I think it's me who wrote it  ::)

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #12 on: March 29, 2016, 08:43:10 pm »
It's not necessary to answer to my post. Just interesting.
What is a point of 64 bit version of openxcom? You don't need to use more than 4 GB at once of RAM. You don't really need a performance gain over 32 bit version like modern games with heavy physics and graphics. You can run 32 bit version without a problems in 64 bit version and also in 32 bit version of windows. So what is a really point of 64 bit version of openxcom? I don't understand.

Offline JDarthenay

  • Captain
  • ***
  • Posts: 55
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #13 on: March 29, 2016, 08:55:47 pm »
Like I said sooner, the true reason is I failed in the past and I hope I can succeed now.

Also I could say we could need it if someone creates a custom build with a lot more stuff requiring a lot of memory, but this would obviously be mostly bad faith.

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Building openXCom in 64-bits with MinGW on Windows
« Reply #14 on: March 29, 2016, 10:21:13 pm »
For mingw (with msys) build I used this makefile:
Code: [Select]
# Directories and files
OBJDIR = ../obj/
BINDIR = ../bin/
SRCS_SDL = /C/MinGW/include/SDL/
SRCS_BOOST = ../../lib/boost/
SRCS_YAML = ../../lib/yaml-cpp/
SRCS_YAML_CPP = $(wildcard $(SRCS_YAML)src/*.cpp $(SRCS_YAML)src/contrib/*.cpp)
SRCS = $(wildcard *.cpp */*.cpp */*/*.cpp)
OBJS = $(patsubst %.cpp, $(OBJDIR)%.o, $(notdir $(SRCS))) $(patsubst %.cpp, $(OBJDIR)yaml/%.o, $(notdir $(SRCS_YAML_CPP)))

BIN = OpenXcom

# Compiler settings
CXXFLAGS ?= -Og
CXXFLAGS += -Wall -std=gnu++11

CXXFLAGS += -I$(SRCS_YAML)include -I$(SRCS_BOOST) -I$(SRCS_SDL)

LIBS = -lshlwapi -lws2_32 -lopengl32 -lglu32 -mwindows -lmingw32 -lpthread -static -static-libstdc++ -lwinmm -lSDL_gfx -lSDL_mixer -lSDLmain -lSDL_Image -lSDL.dll -lm -luser32 -lgdi32 -lwinmm -ldxguid -lDbgHelp

# Rules
all: $(BINDIR)$(BIN)

$(BINDIR)$(BIN): $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) $(LIBS) -o $(BINDIR)$(BIN)

$(OBJDIR)%.o:: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Basescape/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Battlescape/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Engine/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Engine/Scalers/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Engine/Adlib/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Geoscape/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Interface/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Menu/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Mod/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Savegame/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Ufopaedia/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)yaml/%.o:: $(SRCS_YAML)src/%.cpp
@mkdir -p $(OBJDIR)yaml
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)yaml/%.o:: $(SRCS_YAML)src/contrib/%.cpp
@mkdir -p $(OBJDIR)yaml
$(CXX) $(CXXFLAGS) -c -o $@ $<

clean:
rm -f $(BINDIR)$(BIN) $(OBJDIR)*.o

.PHONY: all clean
Its need src of yaml-cpp and precompiled SDL libs (if I recall correctly from main page links). With new version yaml-cpp you could drop `boost` from it.