Hi Erik,

very good point regarding removing hard coded paths not only for iOS. I would like to hijack this and extend also for Android. That would greatly improve maintainability. However, last time I asked it basically went to /dev/null [1]. I have a modified version of the build system here, because I can't stand waiting for the magic of ndk-build. But changes are really drastic but make the cmake system much leaner again.

Btw. have you tested your modification with the latest cmake from MacPorts which include the few modifications for working with Xcode 4.3.x?

/H

[1] http://forum.openscenegraph.org/viewtopic.php?t=9499

On 3/23/2012 12:49 AM, Erik den Dekker wrote:
Hi Robert,


Currently, OSG determines the version of the selected CMAKE_OSX_SYSROOT by comparing its value with a hard-coded path:

IF(${CMAKE_OSX_SYSROOT}STREQUAL"/Developer/SDKs/MacOSX10.7.sdk")
...
ELSEIF(${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.5.sdk" OR ${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.6.sdk") ...
ELSEIF(EXISTS/Developer/SDKs/MacOSX10.4u.sdk)
...
             ELSE()
...
             ENDIF()

Which is fragile because XCode could be installed into another directory than /Developer. (In case XCode is not installed into the /Developer directory CMake can automatically resolve the path via command line utility ${CMAKE_XCODE_SELECT} --print-path)

This issue bites me currently because the latest XCode (Version 4.3.1 - 4E1019) installed through the Mac App Store is per default installed in "/Applications/Xcode.app/Contents/Developer" and hence the 10.7 SDK in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"

Searching the web to find the proper way to determine the version of the Platform SDK programmatically, I found no standard way. I came up with 2 options myself:

1) Parse the path string to extract the version number

2) Read a value from the SDKSettings.plist found in the root of each SDK (e.g., "defaults read ${CMAKE_OSX_ROOT}/SDKSettings.plist CanonicalName" gives "macosx10.7")

I implemented the last option and verified that at least the following Mac OS SDKs (10.3.9, 10.4, 10.5, 10.6, 10.7) support this method. It also looks reasonably future proof. An additional benefit of this method is that it also seems to be compatible with iOS and iOS Simulator SDKs (at least for version 5.1, but I assume this also applies to older versions). This is interesting because the CMake infrastructure to build OSG for iOS currently still contains similar hard-coded paths and even requires you to manually change the cmake file to build for another iOS SDK version. In the near future I hope to address these issues, but I haven't been able to try this yet.

Based on SVN revision 13041





Cheers,

Erik den Dekker



_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to