Skip to content

Commit 9b12fac

Browse files
Michel Schmidg3force
authored andcommitted
add option to build ODE from source
On some systems the packaged ODE (e.g. the Manjaro ode package at time of writing) causes grSim to crash almost instantly. This *may* be caused by the package having been built without double precision support, but I don't know what exactly breaks. Additionally add this as a hint to INSTALL.md.
1 parent 8a5ddd8 commit 9b12fac

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

CMakeLists.txt

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,34 @@ find_package(Qt5 COMPONENTS Core Widgets OpenGL Network REQUIRED)
8080
list(APPEND libs Qt5::Core Qt5::Widgets Qt5::OpenGL Qt5::Network)
8181

8282
# ODE
83-
if(WIN32)
83+
if(BUILD_ODE)
84+
# build ODE, because some versions of it cause grSim to segfault somewhere
85+
# could be because in some packages the double precision is turned off
86+
include(ExternalProject)
87+
88+
set(ODE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/ode_install")
89+
90+
ExternalProject_Add(ode_external
91+
GIT_REPOSITORY https://bitbucket.org/odedevs/ode.git
92+
GIT_TAG 0.16.4
93+
INSTALL_DIR "${ODE_INSTALL_DIR}"
94+
CMAKE_ARGS
95+
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
96+
-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
97+
-DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER}
98+
-DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER}
99+
-DCMAKE_MAKE_PROGRAM:PATH=${CMAKE_MAKE_PROGRAM}
100+
# necessary, because it does not build the static libs if this is ON
101+
-DBUILD_SHARED_LIBS=OFF
102+
# if this is OFF grSim just dies instantly and INSTALL.md says it should be ON
103+
-DODE_DOUBLE_PRECISION=ON
104+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
105+
)
106+
add_dependencies(${app} ode_external)
107+
108+
set(ODE_LIBRARY "${ODE_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ode${CMAKE_STATIC_LIBRARY_SUFFIX}")
109+
list(APPEND libs ${ODE_LIBRARY})
110+
elseif(WIN32)
84111
find_package(ODE CONFIG REQUIRED)
85112
list(APPEND libs ODE::ODE)
86113
else()

INSTALL.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ $ sudo make install
159159
grSim will be — by default — installed on the `/usr/local` directory.
160160

161161

162-
if you face any problem regarding of updating the grsim version, you can try removing the `grsim.xml`.
162+
## Troubleshooting
163+
164+
If you face any problem regarding of updating the grsim version, you can try removing the `grsim.xml`.
165+
If grSim crashes almost instantly with some ODE error the issue might by your ODE version.
166+
Try adding -DBUILD_ODE=TRUE to build ODE from source instead of using the system dependency.
163167

164168
## Notes on the performance
165169

0 commit comments

Comments
 (0)