-
Notifications
You must be signed in to change notification settings - Fork 2
Cross compilation
Daijiro Fukuda edited this page Dec 16, 2022
·
2 revisions
The way to build and run Windows-exe from Ubuntu using external GLFW is as follows.
Refer to https://www.glfw.org/docs/3.3/compile.html#compile_mingw_cross
- Prepare tools
Install mingw-w64 and wine.
$ sudo apt install mingw-w64 wineClone freetype binaries: https://github.com/ubawurinna/freetype-windows-binaries
$ git clone https://github.com/ubawurinna/freetype-windows-binaries.git- Build the forked GLFW in which we are developing IME support: https://github.com/clear-code/glfw/tree/3.4-2022-09-21+im-support-all
- Specify
CMAKE_TOOLCHAIN_FILEas follows for cross-build
- Specify
$ git clone --branch=3.4-2022-09-21+im-support-all https://github.com/clear-code/glfw.git
$ cd glfw
$ cmake -B build \
-DCMAKE_INSTALL_PREFIX=bin \
-DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake
$ make -C build -j$(nproc) install- Build the forked raylib in which we are developing IME support: https://github.com/clear-code/raylib/tree/4.2-2022-12-14+better-ime-support-all
- Set
USE_EXTERNAL_GLFWON - Specify the path of
x86_64-w64-mingw32.cmaketoCMAKE_TOOLCHAIN_FILE- We can use the file in GLFW repo (the same file as step-2)
- Ex:
/test/glfw/CMake/x86_64-w64-mingw32.cmake
- Specify the path of GLFW built in step-2 to
CMAKE_PREFIX_PATH- Ex:
-DCMAKE_PREFIX_PATH=/test/glfw/bin
- Ex:
- Set
$ git clone --branch=4.2-2022-12-14+better-ime-support-all https://github.com/clear-code/raylib.git
$ cd raylib
$ cmake -B build \
-DCMAKE_INSTALL_PREFIX=bin \
-DUSE_EXTERNAL_GLFW=ON \
-DCMAKE_TOOLCHAIN_FILE="{path of GLFW repo}/CMake/x86_64-w64-mingw32.cmake" \
-DCMAKE_PREFIX_PATH="{path of GLFW built in step-2}"
$ make -C build -j$(nproc) install- Build and run this app
- Set
USE_EXTERNAL_GLFWON - Set
USE_SOFT_FULLSCREENON - Specify the path of
x86_64-w64-mingw32.cmaketoCMAKE_TOOLCHAIN_FILE- We can use the file in GLFW repo (the same file as step-2)
- Ex:
/test/glfw/CMake/x86_64-w64-mingw32.cmake
- Specify the path of freetype to
FREETYPE- Ex:
-DFREETYPE="/test/freetype-windows-binaries"
- Ex:
- Specify the path of GLFW built in step-2 to
GLFW- Ex:
-DGLFW="/test/glfw/bin"
- Ex:
- Specify the path of raylib built in step-3 to
RAYLIB- Ex:
-DRAYLIB="/test/raylib/bin"
- Ex:
- Use
wineto run the exe
- Set
$ cmake -B build \
-DCMAKE_INSTALL_PREFIX=bin \
-DUSE_EXTERNAL_GLFW=ON \
-DUSE_SOFT_FULLSCREEN=ON \
-DCMAKE_TOOLCHAIN_FILE="{path of GLFW repo}/CMake/x86_64-w64-mingw32.cmake" \
-DFREETYPE="{path of freetype windows binaries}" \
-DGLFW="{path of GLFW built in step-2}" \
-DRAYLIB="{path of raylib built in step-3}"
$ make -C build -j$(nproc) install
$ wine bin/RaylibIMEInputSampleApp.exe