Skip to content

Implement CMake, mostly for cross-compiling from non-Windows#11

Merged
nsgomez merged 6 commits intonsgomez:mainfrom
Cloudwalk9:cmake
Feb 17, 2026
Merged

Implement CMake, mostly for cross-compiling from non-Windows#11
nsgomez merged 6 commits intonsgomez:mainfrom
Cloudwalk9:cmake

Conversation

@Cloudwalk9
Copy link
Contributor

@Cloudwalk9 Cloudwalk9 commented Oct 29, 2023

This is crude and required a minor code tweak to fix a case sensitivity issue.

I think you have to manually specify the toolchain (e.g. the compiler using CC and CXX environment variables or cmake cache) unless you're using the CMake extension on vscode or codium, and of course you'll need mingw.

I haven't tested the resulting binary, or the system itself on Windows for native compile.

This was done on a burst of energy in an afternoon so I can't promise that I'll return to it.

Wrote this in an afternoon so I could cross-compile from Linux, because I felt like it.

The resulting SCGL.dll is untested at the time of commit, but it will
compile if you have mingw installed. At this time, you must explicitly specify the
compiler if you're not using vscode (or codium) with the CMake extension, which detects
toolchains automagically. Will look into CMake presets if I come back to this.
@Castor215
Copy link

Thank you for this. It builds fine but when I try to run SC4 I get the following error:

0024:err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"C:\\GOG\\SimCity 4 Deluxe Edition\\Plugins\\SCGL.dll") not found
0024:err:module:import_dll Library libstdc++-6.dll (which is needed by L"C:\\GOG\\SimCity 4 Deluxe Edition\\Plugins\\SCGL.dll") not found
0024:err:wgl:egl_init Failed to load libEGL.so.1: libEGL.so.1: cannot open shared object file: No such file or directory
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0024:err:opengl:null_glViewport unsupported
0024:err:opengl:null_glMatrixMode unsupported
0024:err:opengl:null_glLoadIdentity unsupported
0024:err:opengl:null_glOrtho unsupported
0024:err:opengl:null_glMatrixMode unsupported
0024:err:opengl:null_glViewport unsupported
0024:err:opengl:null_glMatrixMode unsupported
0024:err:opengl:null_glLoadIdentity unsupported
0024:err:opengl:null_glOrtho unsupported
0024:err:opengl:null_glMatrixMode unsupported

I have the libEGL1 package installed, so it's not because the libEGL package is missing. Did I build it wrong?

@Cloudwalk9
Copy link
Contributor Author

Did I build it wrong?

@Castor215 probably not. I actually didn't personally test this but pulling in libgcc means it needs to be statically linked.

As for the libEGL part, what's your distro and GPU?

@Castor215
Copy link

As for the libEGL part, what's your distro and GPU?

I am on Debian 13 (trixie) but using WINE from the winehq repository. installing the 'nvidia-egl-icd:i386` package solved this issue.

@Castor215 probably not. I actually didn't personally test this but pulling in libgcc means it needs to be statically linked.

I built it passing -static -static-libgcc -static-libstdc++ to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS and now it doesn't open SC4 at all with the following error

0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0024:fixme:dbghelp:elf_search_auxv can't find symbol in module
0124:fixme:dbghelp:elf_search_auxv can't find symbol in module

I have also tried separately passing -static-libgcc to CMAKE_C_FLAGS and -static-libstdc++ to CMAKE_CXX_FLAGS.

@nsgomez nsgomez merged commit dc80fae into nsgomez:main Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments