MacOSX codeblocks compiling

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

MacOSX codeblocks compiling

Post by netpipe »

i was wondering if anyone knows how to compile irrlicht on macosx using codeblocks. sofar i was only able to compile the demo's in CB after compiling them with the irrlicht lib created from xcode.

things to try -lobjc -fobjc-arc -x objective-c



add this to your example.cbp to compile the demos


<Target title="Mac">
<Option platforms="Mac;" />
<Option output="../../bin/Mac/HelloWorld" prefix_auto="0" extension_auto="0" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-m64" />
<Add option="-g" />
<Add option="-D_IRR_STATIC_LIB_" />
<Add option="-DMACOSX" />
<Add option="-D__x86_64__" />
</Compiler>
<Linker>
<Add option="-m64" />
<Add option="-framework Foundation" />
<Add option="-framework OpenGL" />
<Add option="-framework Cocoa" />
<Add option="-framework Carbon" />
<Add option="-framework AppKit" />
<Add option="-framework IOKit" />
<Add library="GL" />
<Add directory="../../lib/Mac" />
<Add directory="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries" />
</Linker>
</Target>
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

oh also add
#include <Carbon/Carbon.h>
#include <CoreFoundation/CFBundle.h>
#include <CoreFoundation/CFString.h>
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
woxika3363
Posts: 3
Joined: Mon Jul 26, 2021 9:53 pm

Re: MacOSX codeblocks compiling

Post by woxika3363 »

I still didnt understand how can i run it on simulator
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

duplicate post from viewtopic.php?p=306239&hilit=osx#p306239

I was able to compile irrlicht 1.8.5 with codeblocks only on macosx using clang i did have to comment out archive loading and some zlib files that were still there after.

modified the compilers section to point the llvm-ar path to just ar

the first example use the "example copy.cbp" file hello world , software render does not work but opengl does. also the example has to be ran afterwards manually because the play button on codeblocks does not work.

https://drive.google.com/file/d/1LEYUWX ... sp=sharing

https://drive.google.com/file/d/15YWUW8 ... sp=sharing
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

the weird part is one windows and linux the FPS weapon scene node works fine but on osx it requires a click to move also wasd dont seem to be working.
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

actually must be my compile its working on my first demo but not my other one. will look into it
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

if the app is not launched from a app container properly the mouse and keyboard wont work only the terminal gets the input for now. it seems SExposedVideoData.h is missing macosx
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: MacOSX codeblocks compiling

Post by CuteAlien »

If you have patches - I'm pretty accepting when it comes to OSX (aka - unless something seems suspect I usually apply them and hope other OSX users will figure out if something is wrong). I'm even pretty open to getting another OSX maintainer as we don't really have anyone dedicated to it right now.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

this needs to be added to all the demos aswell as a sample app folder with the medias in it. the media goes into the example.app/media folder

Code: Select all

<Target title="Mac">
				<Option platforms="Mac;" />
				<Option output="./example" prefix_auto="0" extension_auto="0" />
				<Option type="1" />
				<Option compiler="clang" />
				<Compiler>
					<Add option="-g" />
					<Add option="-x objective-c++" />
					<Add option="-D_IRR_STATIC_LIB_" />
					<Add option="-DMACOSX" />
					<Add option="-D__x86_64__" />
				</Compiler>
				<Linker>
					<Add option="-framework Foundation" />
					<Add option="-framework OpenGL" />
					<Add option="-framework Cocoa" />
					<Add option="-framework Carbon" />
					<Add option="-framework AppKit" />
					<Add option="-framework IOKit" />
					<Add library="GL" />
					<Add library="png" />
					<Add library="z" />
					<Add directory="../../lib/Mac" />
					<Add directory="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries" />
				</Linker>
				<ExtraCommands>
					<Add after="cp ./example ./example.app/Contents/bin/example" />
					<Add after="open ./example.app" />
					<Mode after="always" />
				</ExtraCommands>
			</Target>
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: MacOSX codeblocks compiling

Post by CuteAlien »

Hm, copying all media is bad. Can't it be done like other platforms? So Output something like ../../bin/OSX (or maybe ../../bin/OSX_cb) and then it finds media with usual relative ../../media? You seemed to do that in your first post.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

if we zip whole media folder then its 7mb per demo or since each demo only uses one or 2 models max put the copy commands for each demos media in the copy command <ExtraCommands> section. if we dont put the whole thing in example.app container it wont run the demos properly, (not finding textures) not able to use mouse/keyboard.
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: MacOSX codeblocks compiling

Post by CuteAlien »

Copy on build is fine - that wouldn't be in source-control. But having real copies of media is bad. Not just because of space (thought that's part of it), but we would have to keep media folders synced from there on which raises the maintenance costs.
There's usually some copy on change commands (like on bash it would be: cp -u) so first build on users system would have some extra copy, but from there on it wouldn't be too bad. But I don't remember right now how that worked inside C::B (I'm pretty sure I did that before, but just did go over my projects and not finding it anymore).

Well, if it's a problem then let's just keep on refering people to your posts here.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: MacOSX codeblocks compiling

Post by netpipe »

https://drive.google.com/drive/folders/ ... 981n5FJTpV here is a link for codeblocks on intel macs, makes it easier to compile irrlicht.cbp with mac target on newer os's like big sur also we can run the bianry's without containers now it seems so no need to modify the examples much now. (might put together a proper mac cb version soon)

ps had to install and point linker search path to brews libpng directory to compile demos
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
Post Reply