iOS: "Symbols hidden by default" to yes in cmake

Minor issues with the Ogre API that can be trivial to fix
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

iOS: "Symbols hidden by default" to yes in cmake

Post by Brocan »

Hi everyone!

I've been working over iOS and xcode, and i've reached tons of "bad codegen: pointer diff..." problems in release compiling. All this problems are related to the symbol visibility in iOS compilation. By default, the xcode ogre project generated by the cmake tool sets the symbols hidden by default to off, generating "bad codegen" problems in the linking phase on the projects that use ogre. All my problems have dissapeared when i hve recompiled ogre with "Symbols hidden by default" set to ON.

My papercut request is that CMAKE should generate the ogre project with the "Symbols hidden by default" to ON on all targets.

I don't know if this option is in OFF by some reason, but its change has solved all my problems!

Cheers!
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: iOS: "Symbols hidden by default" to yes in cmake

Post by masterfalcon »

Are you building with GCC or Clang? The current check only works for GCC. To enable visibility with Clang make this change in the root CMakeLists.txt:

Code: Select all

if (CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
to

Code: Select all

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG AND NOT MINGW)
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: iOS: "Symbols hidden by default" to yes in cmake

Post by Brocan »

I'll try tomorrow at work. But i think that i'm using GCC.

This option sets "Symbols hidden by default" to ON or makes visible an option to check it in cmake?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: iOS: "Symbols hidden by default" to yes in cmake

Post by masterfalcon »

On second thought, there should be more than that.

Maybe someone else can shed light on this because I don't remember why. Visibility is disabled for static builds on all platforms. I'm sure it is a good reason, but I just don't recall what it is.

One solution for this that will prevent an ugly hack to enable visibility just for iOS is to change the settings in your project to have "Symbols hidden by default" set to OFF so that it matches Ogre.