Code Monkey home page Code Monkey logo

Comments (12)

bkaradzic avatar bkaradzic commented on May 20, 2024

What's the error? It shouldn't be unstable.

from fips-bgfx.

bkaradzic avatar bkaradzic commented on May 20, 2024

I just built it without warnings. I'm on 10.9.5.

-- The C compiler identification is AppleClang 6.0.0.6000056
-- The CXX compiler identification is AppleClang 6.0.0.6000056

It spews also all compiler commands. I don't remember being like that before?

from fips-bgfx.

fungos avatar fungos commented on May 20, 2024

For the compiler error on windows I've added the missing define here #3.

Now about the error running samples on macos, isn't there anything to do with windowed/cmdline? Is it creating a bundle?

To be sure, I ran here on linux and windows all 25 samples with ./fips run and no problems. But from inside visual studio we need set the workdir as expected otherwise samples that require data crash.

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

Windows version compiles and runs fine now with this PR, on OSX it's still not picking up the working directory. Since I also have this problem with the turbobadger demo I suspect I broke something in fips on OSX. I'll have a look at it in the evening. Thanks for the fix!

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

Ok, so the 'current working dir' problem on OSX has to do with the samples being compiled as fips cmdline apps instead of 'windowed' app (which produces a mac .app bundle). For some reason starting such an executable ignores the current directory, it doesn't even work running directly from the shell inside the fips-bgfx/bgfx/examples/runtime directory. You'll have to copy the executable to this directory in order to make it work.

This is most likely also the reason why the turbobadger demo doesn't work on OSX>

I'll see if I can find out more...

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

Ok found the problem, at least for the fips-bgfx demos:

entry_osx.mm has code which changes the working directory:

https://github.com/bkaradzic/bgfx/blob/master/examples/common/entry/entry_osx.mm#L66

If compiled as command line executable, 'path' points to the directory where the executable lives, and thus overrides the current working directory where the program was started from which causes the startup error when building as fips-bgfx demo.

Now the curious case why it works as OSX app bundle: in this case the path is resolved to a directory inside the bundle directory e.g. /Users/floh/...../01-cubes.app/Contents/Resources
BUT the Resources subdirectory doesn't exist, thus the chdir() call fails, and the current working directory remains set which when started as fips-bgfx demo, points to bgfx/examples/runtime.

@bkaradzic: what do you think about a new C preprocessor define which prevents this chdir() when set, but defaults to the current behaviour?

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

PS: turbobadger has a similar problem, to workaround a (non-existing) problem in GLFW, and also only on OSX. GLFW can be compiled to set the current working directory to the applications Resources directory here:

https://github.com/glfw/glfw/blob/1634742177eded4b8412d7ab11494ed662d20905/src/cocoa_init.m#L203

...and the turbobadger demo has this line which tries to undo this in a rather naive (or rather, 'hacky') way:

https://github.com/fungos/turbobadger/blob/master/Demo/platform/port_glfw.cpp#L453

@fungos since you have forked turbobadger anyway, I would propose to add a new define which controls this behaviour, and default to the current behaviour of calling chdir()?

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

PS: @bkaradzic the spammy compiler output is because of xcodebuild which is the default config on OSX. If you use 'fips set config osx-make-release' or 'fips set config osx-ninja-release', the output is more commandline-friendly :)

from fips-bgfx.

fungos avatar fungos commented on May 20, 2024

Ouch, good find. Yes, I will patch this tomorrow on my fork and try to push mainline too as I've already done something similar for linux.

UPDATE: Probably fixed fungos/fips-turbobadger@043b8c5 and https://github.com/fungos/turbobadger/commit/adb6601155b97b04807afb55c2cb0ec4bbd264c2

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

The second commit had a small problem (#ifdef instead of #if used), I provided a PR which fixes this, with this fix the turbobadger demo works fine on OSX: https://github.com/fungos/turbobadger/pull/1

from fips-bgfx.

fungos avatar fungos commented on May 20, 2024

I think you can close this too. :)

from fips-bgfx.

floooh avatar floooh commented on May 20, 2024

Okidoki

from fips-bgfx.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.