Paketinstallation
sudo port install python27 py27-scipy py27-numpy py27-networkx py27-h5py py27-matplotlib py27-nose nosetests_select
sudo port install boost +python27
sudo port install doxygen graphviz py27-pygraphviz
Mit Git klonen
git clone https://github.com/opengm/opengm.git
cd opengm/
mkdir build
cd build
cmake ..
Externe Bibliothek hinzufügen
make -k externalLibs
Ich weine nicht, auch wenn ich einen Fehler bekomme und aufhöre. .. .. Nur die externe Bibliothek, die kompiliert werden kann, wird zu ../CMakeFile hinzugefügt.
diff:../Änderung von CMakeFile (Beispiel). Hinzufügen einer externen Bibliothek, Boost usw.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5fb1a9..d58c167 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,30 +67,30 @@ endif()
OPTION(BUILD_EXAMPLES "Build Examples" ON)
OPTION(BUILD_TUTORIALS "Build Tutorials" ON)
OPTION(BUILD_COMMANDLINE "Build Commandline" OFF)
-OPTION(WITH_AD3 "Include AD3" OFF)
+OPTION(WITH_AD3 "Include AD3" ON)
OPTION(WITH_CPLEX "Include CPLEX" OFF)
OPTION(WITH_GUROBI "Include GUROBI" OFF)
-OPTION(WITH_BOOST "Include BOOST" OFF)
-OPTION(WITH_HDF5 "Include HDF5" OFF)
-OPTION(WITH_TRWS "Include wrapper for TRWS code" OFF)
+OPTION(WITH_BOOST "Include BOOST" ON)
+OPTION(WITH_HDF5 "Include HDF5" ON)
+OPTION(WITH_TRWS "Include wrapper for TRWS code" ON)
OPTION(WITH_GCO "Include wrapper for GCO code" OFF)
-OPTION(WITH_MRF "Include wrapper for MRF code" OFF)
-OPTION(WITH_QPBO "Include wrapper for QPBO code" OFF)
+OPTION(WITH_MRF "Include wrapper for MRF code" ON)
+OPTION(WITH_QPBO "Include wrapper for QPBO code" ON)
OPTION(WITH_FASTPD "Include wrapper for FastPD code" OFF)
-OPTION(WITH_MAXFLOW "Include wrapper for MAXFLOW code" OFF)
+OPTION(WITH_MAXFLOW "Include wrapper for MAXFLOW code" ON)
OPTION(WITH_MAXFLOW_IBFS "Include wrapper for MAXFLOW-IBFScode" OFF)
OPTION(WITH_LIBDAI "Include wrapper for LIBDAI code" OFF)
OPTION(WITH_DAOOPT "Include wrapper for DAOOPT code" OFF)
OPTION(WITH_MPLP "Include wrapper for MPLP code" OFF)
OPTION(WITH_SRMP "Include wrapper for SRMP code" OFF)
-OPTION(WITH_PLANARITY "Include wrapper for PLANARITY code" OFF)
-OPTION(WITH_BLOSSOM5 "Include wrapper for BLOSSOM5 code" OFF)
+OPTION(WITH_PLANARITY "Include wrapper for PLANARITY code" ON)
+OPTION(WITH_BLOSSOM5 "Include wrapper for BLOSSOM5 code" ON)
OPTION(WITH_OPENMP "Include OpenMP" OFF)
OPTION(WITH_VIGRA "Include VIGRA" OFF)
OPTION(WITH_CONICBUNDLE "Include ConicBundleLibrary" OFF)
OPTION(WITH_MATLAB "Activate MatLab-Code" OFF)
OPTION(BUILD_CONVERTER "Build several converters" OFF)
-OPTION(BUILD_PYTHON_WRAPPER "Build python wrapper" OFF)
+OPTION(BUILD_PYTHON_WRAPPER "Build python wrapper" ON)
OPTION(BUILD_MATLAB_WRAPPER "Build matlab wrapper" OFF)
###Grante needs C++11. Since we have not tested OpenGM under this standard yet, using Grante is realy experimental!!!
###OPTION(WITH_GRANTE "Include wrapper for grante" OFF)
Stellen Sie im Folgenden die Option cmake so ein, dass Sie nicht zum System / usr / bin / python
wechseln (mit macports python2.7).
CMake wieder
rm CMakeCache.txt
cmake .. \
-DPYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python2.7 \
-DPYTHON_INCLUDE_DIR:PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers/ \
-DPYTHON_LIBRARY:FILEPATH=/opt/local/lib/libpython2.7.dylib
Und bauen
make -j 4
Dokumenterstellung
make doc
Und testen
make test
Running tests...
...
100% tests passed, 0 tests failed out of 60
Total Test time (real) = 45.89 sec
Testen Sie die Python-Bindung
make test-python-wrapper
...
Ran 70 tests in 3.584s
OK
[100%] Built target test-python-wrapper
Wenn make test-python-wrapper
sagt, dass es keine Nosetests
gibt
Nasentests zu Nasentests-2.Link zu 7
sudo port select --set nosetests nosetests27
Wenn Sie lokal installieren
make DESTDIR=$HOME/local install
mkdir $HOME/local/usr/local/lib
cp ../build/src/external/libexternal-library-* $HOME/local/usr/local/lib
mit diesem
Wenn Sie keine externe Bibliothek oder Python verwenden, ist OpenGM übrigens nur eine Header-Datei.
~/.bash_Zum Profil hinzufügen
# opengm
export LD_LIBRARY_PATH=$HOME/local/usr/local/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=$HOME/local/usr/local/lib/python2.7/site-packages/:$PYTHONPATH
Danach
macports python2.Führen Sie 7 aus
$ python2.7
Python 2.7.10 (default, Oct 18 2015, 09:28:19)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import opengm
>>>
Recommended Posts