Re-write Code::Blocks template to work on Linux and Macos (#2073)

* update code::blocks example to support linux

* add macos support

* update screenshot

* update templates readme
This commit is contained in:
Richard Smith 2021-10-19 18:50:21 +01:00 committed by GitHub
parent ae7127232d
commit 8e599908d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 124 additions and 40 deletions

View file

@ -1,16 +1,19 @@
# raylib for Code::Blocks # Raylib template for Code::Blocks
**by D3nX**
<br/> 1. Install Raylib. On Windows you must install the **Windows Installer (with MinGW compiler)** package. On other
Hey! Here it is a project template to use with `Code::Blocks` =) platforms you can install however you like following the instructions in the wiki.
<br/><br/> * https://github.com/raysan5/raylib/releases/download/3.7.0/raylib_installer_v370.mingw.exe
First, you need to download the [raylib installer](https://www.raylib.com) and run it. It will install raylib with the compiler. * https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux
<br/><br/> * https://github.com/raysan5/raylib/wiki/Working-on-macOS
Then, download the template, and open the project with `Code::Blocks`.
2. Install and run Code::Blocks.
Before running the template, make sure following set the raylib compiler for the IDE as show below:
<br> 3. **Windows only**: Select `Settings` `Compiler` `Toolchain executables`.
![Compiler Settings](compiler_settings.png) Change `Compiler's instrallation directory` to `C:\raylib\MingGW`. Do *not* press auto-detect. There is a screenshot
<br/> below showing how it should look. Press `OK`.
Finally, you can run the program and enjoy raylib running on `Code::Blocks`!
<br /><br /> 4. Select `File` `Open` and open the `core_basic_windows.cbp` file.
Hope it helped you =)
![Compiler Settings](compiler_settings.png)
For an example with resources, see https://github.com/electronstudio/raylib-game-template-codeblocks

BIN
projects/CodeBlocks/compiler_settings.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before After
Before After

View file

@ -1,12 +1,8 @@
/*******************************************************************************************-lraylib -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm /*******************************************************************************************
*
* raylib [core] example - Basic window * raylib [core] example - Basic window
* *
* Welcome to raylib! * Welcome to raylib!
* *
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or * You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com * raylib official webpage: www.raylib.com
* *

View file

@ -2,51 +2,136 @@
<CodeBlocks_project_file> <CodeBlocks_project_file>
<FileVersion major="1" minor="6" /> <FileVersion major="1" minor="6" />
<Project> <Project>
<Option title="core_basic_window" /> <Option title="raylib-game-template" />
<Option execution_dir="." />
<Option pch_mode="2" /> <Option pch_mode="2" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Debug (Mac)">
<Option output="bin/Debug/core_basic_window" prefix_auto="1" extension_auto="1" /> <Option platforms="Mac;" />
<Option output="bin/Debug/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Debug/" /> <Option object_output="obj/Debug/" />
<Option type="1" /> <Option type="1" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Compiler> <Compiler>
<Add option="-g" /> <Add option="-g" />
<Add directory="../../src" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="-lraylib -lopengl32 -lgdi32 -lwinmm" /> <Add library="raylib" />
<Add library="../../src/libraylib.a" /> <Add option="-framework OpenGL" />
<Add option="-framework Cocoa" />
<Add option="-framework IOKit" />
<Add option="-framework CoreAudio" />
<Add option="-framework CoreVideo" />
</Linker> </Linker>
</Target> </Target>
<Target title="Release"> <Target title="Release (Mac)">
<Option output="bin/Release/core_basic_window" prefix_auto="1" extension_auto="1" /> <Option platforms="Mac;" />
<Option output="bin/Release/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Release/" /> <Option object_output="obj/Release/" />
<Option type="1" /> <Option type="1" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Compiler> <Compiler>
<Add option="-O2" /> <Add option="-O2" />
<Add directory="../../src" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="-s" /> <Add option="-s" />
<Add option="-lraylib -lopengl32 -lgdi32 -lwinmm" /> <Add library="raylib" />
<Add library="../../src/libraylib.a" /> <Add option="-framework OpenGL" />
<Add option="-framework Cocoa" />
<Add option="-framework IOKit" />
<Add option="-framework CoreAudio" />
<Add option="-framework CoreVideo" />
</Linker>
</Target>
<Target title="Debug (Linux)">
<Option platforms="Unix;" />
<Option output="bin/Debug/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add library="raylib" />
<Add library="GL" />
<Add library="m" />
<Add library="pthread" />
<Add library="dl" />
<Add library="rt" />
<Add library="X11" />
</Linker>
</Target>
<Target title="Release (Linux)">
<Option platforms="Unix;" />
<Option output="bin/Release/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="raylib" />
<Add library="GL" />
<Add library="m" />
<Add library="pthread" />
<Add library="dl" />
<Add library="rt" />
<Add library="X11" />
</Linker>
</Target>
<Target title="Debug (Windows)">
<Option platforms="Windows;" />
<Option output="bin/Debug/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add library="raylib" />
<Add library="opengl32" />
<Add library="gdi32" />
<Add library="winmm" />
<Add option="-static" />
<Add library="pthread" />
</Linker>
</Target>
<Target title="Release (Windows)">
<Option platforms="Windows;" />
<Option output="bin/Release/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="raylib" />
<Add library="opengl32" />
<Add library="gdi32" />
<Add library="winmm" />
<Add option="-static" />
<Add library="pthread" />
</Linker> </Linker>
</Target> </Target>
</Build> </Build>
<Compiler> <Compiler>
<Add option="-Wall -std=c99" /> <Add option="-Wall" />
</Compiler> </Compiler>
<Unit filename="core_basic_window.c"> <Unit filename="core_basic_window.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project> </Project>
</CodeBlocks_project_file> </CodeBlocks_project_file>

View file

@ -7,7 +7,7 @@ IDE | Platform(s) | Source | Example(s)
[4coder](http://4coder.net/) | Windows | ❌ | ✔️ [4coder](http://4coder.net/) | Windows | ❌ | ✔️
[Builder](https://wiki.gnome.org/Apps/Builder) | Linux | ❌ | ✔️ [Builder](https://wiki.gnome.org/Apps/Builder) | Linux | ❌ | ✔️
[CMake](https://cmake.org/) | Windows, Linux, macOS | ✔️ | ✔️ [CMake](https://cmake.org/) | Windows, Linux, macOS | ✔️ | ✔️
[CodeBlocks](http://www.codeblocks.org/) | Windows, Linux | ❌ | ✔️ [CodeBlocks](http://www.codeblocks.org/) | Windows, Linux, macOS | ❌ | ✔️
[Geany](https://www.geany.org/) | Windows, Linux | ✔️ | ✔️ [Geany](https://www.geany.org/) | Windows, Linux | ✔️ | ✔️
[Notepad++](https://notepad-plus-plus.org/) | Windows | ✔️ | ✔️ [Notepad++](https://notepad-plus-plus.org/) | Windows | ✔️ | ✔️
[SublimeText](https://www.sublimetext.com/) | Windows, Linux, macOS | ✔️ | ✔️ [SublimeText](https://www.sublimetext.com/) | Windows, Linux, macOS | ✔️ | ✔️