Skip to content

Get cross-compilation working again. #6652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BMagnu
Copy link
Member

@BMagnu BMagnu commented Mar 29, 2025

Fixes some issues in CMake and in the code (notably the case-sensitive includes) that make cross-compilation from linux to windows using MinGW possible again.

To get this to work, you now need the following CMake settings:

#Enable cross-compilation
-DCMAKE_TOOLCHAIN_FILE=./cmake/cross_compile/mingw64.cmake 
#FSO needs access to some of the dll's, so we need to provide it any reasonably up-to-date build directory from windows to pull them from
-DIMPORT_EXE_DIR:FILEPATH=<path to a windows FSO build dir>
#Freetype, for some reason, needs additional special handling, and a direct path to a windows freetype281.lib, typically available here
-Dfreetype_LOCATION:FILEPATH=<path to a windows FSO build dir>/lib/prebuilt/freetype/lib/freetype281.lib
#Shaders and default tables are embedded with a custom executable. Since we're building for windows, we're also building this custom embed tool for windows. So just tell CMake to use a different one we've purpose-built for linux in the past.
-DEMBEDFILE_PATH:FILEPATH=<path to a linux FSO build dir>/bin/embedfile
#SIMD detection does not work since this relies on making and running a custom executable as well, so just force SSE2
-DFORCED_NATIVE_SIMD_INSTRUCTIONS:BOOL=OFF
-DFSO_INSTRUCTION_SET=SSE2
#It's likely possible to get this to build as well somehow, but it's not that critical for distributing test builds, so just disable them for now.
-DFSO_BUILD_WITH_DISCORD:BOOL=OFF
-DFSO_BUILD_FRED2:BOOL=OFF
-DFSO_USE_SPEECH:BOOL=OFF
-DFSO_USE_VOICEREC:BOOL=OFF

@BMagnu BMagnu added the build An issue related to the build systems label Mar 29, 2025
Copy link
Contributor

@Goober5000 Goober5000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to configure CMake to set or prompt for those settings?

One of the things that's nice about the current FSO cmake config is that it does a really good job of figuring almost everything out for you. It would be super helpful if these settings were also automatic, or at least prompted.

@JohnAFernandez
Copy link
Contributor

JohnAFernandez commented Apr 3, 2025

We could merge this now and make an issue for someone to work on it later.

@Goober5000
Copy link
Contributor

Lafiel said he's already made progress on some of these, so let's hold off just a little bit.

@JohnAFernandez JohnAFernandez marked this pull request as draft April 10, 2025 16:25
@JohnAFernandez
Copy link
Contributor

Set to draft to help with sorting of open PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build An issue related to the build systems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants