Skip to content

Commit aafd804

Browse files
JamesJames
James
authored and
James
committedMar 27, 2012
Fixed building/ packaging on mac.
1 parent 0722940 commit aafd804

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed
 

‎CMakeLists.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ add_definitions(-DBOOST_THREAD_USE_LIB)
129129
if (WITH_PREFER_STATIC OR MINGW)
130130
add_definitions(-DOSG_LIBRARY_STATIC)
131131
endif()
132+
if(APPLE)
133+
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)
134+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
135+
set(CMAKE_EXE_LINKER_FLAGS "-framework cocoa -framework carbon")
136+
endif()
132137
if (MSVC)
133138
add_definitions( -D_USE_MATH_DEFINES)
134139
endif()
@@ -193,7 +198,7 @@ install(FILES ${ARKOSG_HDRS} DESTINATION include/arkosg COMPONENT Dev)
193198
# link libraries
194199
set(ARKOSG_LINK_LIBRARIES
195200
${Boost_LIBRARIES}
196-
${OSG_PLUGINS_LIBRARIES}
201+
${OSGPLUGIN_LIBRARIES}
197202
${OPENSCENEGRAPH_LIBRARIES}
198203
${OPENGL_LIBRARIES}
199204
${QT_LIBRARIES}
@@ -269,6 +274,10 @@ if (WITH_BUILD_TESTS)
269274
RUNTIME DESTINATION "bin" COMPONENT Runtime
270275
BUNDLE DESTINATION "/Applications" COMPONENT Runtime
271276
)
277+
if(APPLE)
278+
add_custom_command(TARGET arkosgTest POST_BUILD COMMAND macdeployqt ${CMAKE_BINARY_DIR}/arkosgTest.app)
279+
add_custom_command(TARGET arkosgTest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory /opt/local/lib/Resources/qt_menu.nib ${CMAKE_BINARY_DIR}/arkosgTest.app/Contents/Resources/qt_menu.nib)
280+
endif()
272281
endif()
273282

274283
### packaging

‎test/MainWindow.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
// Static linking of OSG needs special macros
2929
#ifdef OSG_LIBRARY_STATIC
3030
#include <osgDB/Registry>
31-
USE_GRAPHICSWINDOW();
31+
32+
#if defined(__APPLE__)
33+
USE_GRAPICSWINDOW_IMPLEMENTATION(Cocoa)
34+
#else
35+
USE_GRAPHICSWINDOW()
36+
#endif
37+
3238
USE_OSGPLUGIN(rgb);
3339
USE_OSGPLUGIN(ac);
3440
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.