SFML community forums

Help => General => Topic started by: kenpower on December 01, 2021, 10:50:07 pm

Title: Forcing a x86 build on x64 machine CI sever (github actions)
Post by: kenpower on December 01, 2021, 10:50:07 pm
Hi,

I am running a github action to build/test an app using SFML.
As part of the build script, it clones SFML and builds it.

The problem occurs when I link the app with a x86 config, it complains (one error for every sfml call)

"error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall sf::Time::asMilliseconds(void)const"[/tt]
and
C:\Program Files (x86)\SFML\lib\sfml-window-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'

The problem goes away if I build my app with x64 config. But I need a 32bit build.

I've looked at the SFML Cmake files and it seems that the 32/64 build decision is based on a size of a pointer, so not easily configurable.

How can I force a 32bit build of SFML on a 64bit machine?
Title: Re: Forcing a x86 build on x64 machine CI sever (github actions)
Post by: eXpl0it3r on December 02, 2021, 12:09:10 am
You need to tell CMake what architecture you want to use.

See the generators CMake lists.
For VS 2019 and 2022 you need to specify the architecture with the -A flag.

(https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=28325.0;attach=5434)
Title: Re: Forcing a x86 build on x64 machine CI sever (github actions)
Post by: kenpower on December 02, 2021, 10:05:55 am
Thanks:
 
For people finding this question, I did (for dynamic linked libs in x86):

cmake -B build -DSFML_USE_STATIC_STD_LIBS=FALSE -DBUILD_SHARED_LIBS=TRUE -A Win32

I guess I was confused as I could not see a x86 option in ci.yml. I was couldn't see how the 32 bit builds were generated.