-
Notifications
You must be signed in to change notification settings - Fork 5
Fix Linux MinGW cross-build incompatibilities #1
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
base: master
Are you sure you want to change the base?
Fix Linux MinGW cross-build incompatibilities #1
Conversation
…nsitivity
Currently when building wkbre on a case-sensitive operating/file system
CMake will emit the following warning:
```
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:4 (add_subdirectory):
The source directory
wkbre/bzip2
does not contain a CMakeLists.txt file.
CMake does not support this case but it used to work accidentally and is
being allowed for compatibility.
Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run
"cmake --help-policy CMP0014" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done (0.3s)
```
This is probably due to the fact that the /bzip/CMakeLists.TXT file
not named as "CMakeLists.txt" as required by the CMake documentation[1]
, while it still work as expected on Windows due to files being accessed
case-insensitively this won't work on case-sensitive operating/file
systems like GNU/Linux.
This patch fixes the problem by renaming the file without changing its content.
[1]: https://cmake.org/cmake/help/book/mastering-cmake/chapter/Writing%20CMakeLists%20Files.html
Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
…shes(preprocessor directives)
Currently cross-building on Linux will fail during compilation stage
with the following error message:
```
[ 13%] Building CXX object CMakeFiles/wkbre.dir/gameset/loadgameset.cpp.obj
wkbre/gameset/loadgameset.cpp:17:10: fatal error: ..\global.h: No such file or directory
17 | #include "..\global.h"
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/wkbre.dir/build.make:594: CMakeFiles/wkbre.dir/gameset/loadgameset.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/wkbre.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
```
This is due to the backslash usage in the #include pre-processor
directives which is not compatible in Unix operating systems. This
patch fixes the problem by replacing them with forward slashes which
should be compatible with both Windows and Linux platforms.
Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
…tivity(windows.h)
Currently cross-building on Linux will fail during compilation stage
with the following error message:
```
[ 35%] Building CXX object CMakeFiles/wkbre.dir/cursor.cpp.obj
In file included from wkbre/anim.cpp:17:
wkbre/global.h:27:10: fatal error: Windows.h: No such file or directory
27 | #include <Windows.h>
| ^~~~~~~~~~~
compilation terminated.
```
This is due to the filename casing of the "Windows.h" header file which
is not accessible in the case-sensitive file/operating systems like
GNU/Linux.
This patch fixes the problem by replacing them with "windows.h" as it
seems to be the proper filename casing in the Windows platform[1] as
well as in MinGW[2].
[1]: https://en.wikibooks.org/wiki/Windows_Programming/windows.h
[2]: https://stackoverflow.com/questions/1549123/how-to-use-the-windows-api-in-mingw
Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
…tivity(OpenGL headers)
Currently cross-building on Linux will fail during compilation stage
with the following error message:
```
[ 16%] Building CXX object CMakeFiles/wkbre.dir/wkbre.cpp.obj
wkbre/renderer_ogl1.cpp:18:10: fatal error: gl/gl.h: No such file or directory
18 | #include <gl/gl.h>
| ^~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/wkbre.dir/build.make:314: CMakeFiles/wkbre.dir/renderer_ogl1.cpp.obj] Error 1
```
This is due to the filename casing of the OpenGL header files which
is not accessible in the case-sensitive file/operating systems like
GNU/Linux.
This patch fixes the problem by using the upper-case GL header directory
as it seems to be the proper filename casing of the OpenGL headers.
Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
…shes(resources compiler) Currently cross-building on Linux will fail with the following error message: ``` [ 13%] Building RC object CMakeFiles/wkbre.dir/wkbre.rc.res /usr/bin/x86_64-w64-mingw32-windres: can't open icon file `.\icon.ico': No such file or directory make[2]: *** [CMakeFiles/wkbre.dir/build.make:873: CMakeFiles/wkbre.dir/wkbre.rc.res] Error 1 make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/wkbre.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 ``` This is due to the backslash usage in the resource compiler definition file(wkbre.rc), which is not compatible with Unix-like operating systems. This patch fixes the problem by replacing them with forward slashes which should be compatible with both Windows and Linux platforms. Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
abbc4f9 to
26fbfbd
Compare
|
Thank you for the pull request! Indeed, I have only compiled it on Windows, hence why the backslashes and case issues. Note that I no longer work on this project, since it is superseded by the newer one wkbre2, especially once I implement editing functionality in wkbre2 which it is currently lacking. I might consider merging it, in case people would like to experiment it on Linux (though they still would have to use Wine to run it). |
I would suggest merging it, as:
If the application can indeed run properly on Wine/Linux, I can even package it as a snap which can be distributed and installed by the wider Linux userbase that plays the game via Wine/Proton, but that's too far to tell by now. |
This patch series along with #2 fixes cross-building against the MinGW-w64 platform on a Ubuntu Linux system. For details, please take a look at the individual commit messages and this note.
Unfortunately, I don't have a Windows environment ATM to test on so please test it before merging.