Skip to content

Commit 38960c4

Browse files
committed
- added support for Mac OS X
1 parent 7f1e90a commit 38960c4

File tree

6 files changed

+28
-12
lines changed

6 files changed

+28
-12
lines changed

CMake/Common.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ if (UNIX)
2323
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fopenmp")
2424
endif (UNIX)
2525

26+
if(APPLE)
27+
set(CMAKE_MACOSX_RPATH 1)
28+
endif()
29+
2630
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)

Changelog.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- added support for Mac OS X
12
- added shader support
23
- added automatic computation of inertia tensor for arbitrary triangle meshes
34
- added bunny model to chain demo

Demos/Visualization/MiniGL.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#endif
88

99
#include "GL/glew.h"
10+
1011
#ifdef __APPLE__
1112
#include <OpenGL/GL.h>
1213
#include <OpenGL/GLU.h>
@@ -461,7 +462,9 @@ void MiniGL::init (int argc, char **argv, int width, int height, int posx, int p
461462
glutSpecialFunc (special);
462463
glutDisplayFunc (display);
463464
glutIdleFunc (idlefunc);
465+
#ifndef __APPLE__
464466
glutMouseWheelFunc(mouseWheel);
467+
#endif
465468

466469
// after GLUT initialization
467470
// directly redirect GLUT events to AntTweakBar
@@ -472,7 +475,9 @@ void MiniGL::init (int argc, char **argv, int width, int height, int posx, int p
472475

473476
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
474477

478+
#ifndef __APPLE__
475479
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
480+
#endif
476481
}
477482

478483
void MiniGL::initTexture()
@@ -642,7 +647,11 @@ void MiniGL::keyboard (unsigned char k, int x, int y)
642647

643648
if (k == 27)
644649
{
650+
#ifndef __APPLE__
645651
glutLeaveMainLoop();
652+
#else
653+
exit(0);
654+
#endif
646655
return;
647656
}
648657
else if (k == 97)

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This library supports the physically-based simulation of mechanical effects. In
44

55
The PositionBasedDynamics library allows the position-based handling of many types of constraints in a physically-based simulation. The library uses [CMake](http://www.cmake.org/), [Eigen](http://eigen.tuxfamily.org/) and [AntTweakBar](http://anttweakbar.sourceforge.net/) (only for the demos). All external dependencies are included.
66

7-
The library was tested on Windows 7 and OpenSuse Linux 13.2. However, it should also be possible to use it on Mac OS X systems.
7+
The library was tested on Windows 7, OpenSuse Linux 13.2, Mac OS X 10.10.5. However, it should also be possible to use it on Mac OS X systems.
88

99
**Author**: [Jan Bender](http://www.interactive-graphics.de), **License**: MIT
1010

@@ -16,6 +16,7 @@ http://www.interactive-graphics.de/PositionBasedDynamics/doc/html
1616

1717
## Latest Important Changes
1818

19+
* added support for Mac OS X
1920
* added automatic computation of inertia tensor for arbitrary triangle meshes
2021
* added OBJ file loader
2122
* added target velocity motor slider joint

extern/AntTweakBar/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ endif()
4646
if (APPLE)
4747
include_directories ( /System/Library/Frameworks )
4848
find_library(APPKIT_LIBRARY AppKit)
49-
message("Appkit: ${APPKIT_LIBRARY}")
5049
set(EXTRA_LIBS ${APPKIT_LIBRARY})
5150
set(CMAKE_CXX_FLAGS "-g -Wall -ObjC++ -fPIC -fno-strict-aliasing -D__PLACEMENT_NEW_INLINE")
5251
add_definitions(-D_MACOSX)
@@ -60,8 +59,10 @@ add_library(AntTweakBar STATIC ${ATB_HEADERS} ${ATB_SOURCES})
6059

6160
set_target_properties(AntTweakBar PROPERTIES FOLDER "External Dependencies")
6261

63-
if (UNIX)
64-
target_link_libraries(AntTweakBar X11)
62+
if (APPLE)
63+
target_link_libraries(AntTweakBar)
64+
elseif (UNIX)
65+
target_link_libraries(AntTweakBar X11)
6566
endif()
6667

6768
set(AntTweakBar_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include

extern/glew/CMakeLists.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ if (WIN32)
1414
target_link_libraries(glew opengl32.lib)
1515
endif()
1616

17-
IF(APPLE)
18-
INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
19-
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
20-
FIND_LIBRARY(GLUT_LIBRARY GLUT )
21-
FIND_LIBRARY(OpenGL_LIBRARY OpenGL )
22-
MARK_AS_ADVANCED (COCOA_LIBRARY
17+
if(APPLE)
18+
include_directories ( /System/Library/Frameworks )
19+
find_library(COCOA_LIBRARY Cocoa)
20+
find_library(GLUT_LIBRARY GLUT )
21+
find_library(OpenGL_LIBRARY OpenGL )
22+
mark_as_advanced (COCOA_LIBRARY
2323
GLUT_LIBRARY
2424
OpenGL_LIBRARY)
25-
SET(EXTRA_LIBS ${COCOA_LIBRARY} ${GLUT_LIBRARY} ${OpenGL_LIBRARY})
25+
set(EXTRA_LIBS ${COCOA_LIBRARY} ${GLUT_LIBRARY} ${OpenGL_LIBRARY})
2626
target_link_libraries(glew ${EXTRA_LIBS})
27-
ENDIF (APPLE)
27+
endif (APPLE)

0 commit comments

Comments
 (0)