Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ set (OPENGV_VERSION_MINOR 0)
# RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO)
# MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)

set(CMAKE_BUILD_TYPE Release)
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")
# Manual setting:
#set(CMAKE_BUILD_TYPE Release)
#set(CMAKE_BUILD_TYPE Debug)

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
Expand All @@ -32,7 +35,16 @@ ENDIF()
IF(MSVC)
add_compile_options(/wd4514 /wd4267 $<$<CONFIG:DEBUG>:/bigobj>)
ELSE()
add_definitions (-Wall -march=native -O3)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
# In the IDE, values are available if you compiled without optimization ie -O0 or just a little bit -O1
# If using -O2 or -O3, you get "optimized out" when printing variables [1],
message("Adding DEBUG mode to " ${PROJECT_NAME} " " ${CMAKE_CXX_FLAGS_DEBUG})
ELSE()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
#add_definitions (-Wall -march=native -O3)
add_definitions (-Wall -march=native)
ENDIF()

IF(BUILD_POSITION_INDEPENDENT_CODE)
Expand Down
4 changes: 2 additions & 2 deletions doc/addons/01_installation.dox
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* If you are only interested in using the library under Matlab, now there is a precompiled mex-library for 64-bit systems available. You can download it from:
*
\verbatim
Windows: http://laurentkneip.github.io/publications/opengv.mexw64
Mac OSX: http://laurentkneip.github.io/publications/opengv.mexmaci64
Windows: https://dl.dropboxusercontent.com/u/23966023/opengv/opengv.mexw64
Mac OSX: https://dl.dropboxusercontent.com/u/23966023/opengv/opengv.mexmaci64
\endverbatim
*
* These versions have been added around March 2016, so please be aware that later additions may not be included in this distribution. You can go immediately to \ref page_matlab "Use under Matlab" to receive further instructions on the Matlab interface.
Expand Down
4 changes: 2 additions & 2 deletions doc/addons/mainpage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* <b>Important note:</b> If you are only interested in using the library under Matlab, now there is a precompiled mex-library for 64-bit systems available. You can download it from:
*
\verbatim
Windows: http://laurentkneip.github.io/publications/opengv.mexw64
Mac OSX: http://laurentkneip.github.io/publications/opengv.mexmaci64
Windows: https://dl.dropboxusercontent.com/u/23966023/opengv/opengv.mexw64
Mac OSX: https://dl.dropboxusercontent.com/u/23966023/opengv/opengv.mexmaci64
\endverbatim
*
* These versions have been added around March 2016, so please be aware that later additions may not be included in this distribution. You can go immediately to \ref page_matlab "Use under Matlab" to receive further instructions on the Matlab interface.
Expand Down
40 changes: 35 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,51 @@

find_package(Boost COMPONENTS python REQUIRED)
option(BUILD_FOR_PYTHON3 "build pyopengv for Python 3" OFF)
set(BOOST_PYTHON3_COMPONENT "python3" CACHE STRING "name of the Boost Python 3 component (python3, python-py36 or python-py37)")

if(${BUILD_FOR_PYTHON3})
set(BOOST_PYTHON_COMPONENT ${BOOST_PYTHON3_COMPONENT})
set(BOOST_NUMPY_COMPONENT numpy3)
set(Python_ADDITIONAL_VERSIONS 3.7 3.6)
set(Python_VERSION_SUFFIX 3)
else()
set(BOOST_PYTHON_COMPONENT python)
set(BOOST_NUMPY_COMPONENT numpy)
set(Python_ADDITIONAL_VERSIONS 2.7)
set(Python_VERSION_SUFFIX "")
endif()

find_package(Boost REQUIRED COMPONENTS ${BOOST_PYTHON_COMPONENT})

if(${Boost_VERSION} LESS 106300)
message("Not using boost/python/numpy.")
set(USE_BOOST_PYTHON_NUMPY "off")
else()
message("Using boost/python/numpy.")
set(USE_BOOST_PYTHON_NUMPY "on")
add_definitions(-DUSE_BOOST_PYTHON_NUMPY)

find_package(Boost 1.63 REQUIRED COMPONENTS
${BOOST_PYTHON_COMPONENT} ${BOOST_NUMPY_COMPONENT})
endif()

include_directories(${Boost_INCLUDE_DIRS})

set(Python_ADDITIONAL_VERSIONS "2.7")
find_package(PythonLibs REQUIRED)
find_package(PythonLibs ${Python_VERSION_SUFFIX} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

find_package(NumPy REQUIRED)
include_directories(${NUMPY_INCLUDE_DIRS})

add_library( pyopengv SHARED pyopengv.cpp )
add_library(pyopengv SHARED pyopengv.cpp)
target_link_libraries(pyopengv opengv)

set_target_properties(pyopengv PROPERTIES
PREFIX ""
SUFFIX ".so"
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)

if(APPLE)
set_target_properties(pyopengv PROPERTIES
LINK_FLAGS "-undefined dynamic_lookup"
Expand All @@ -30,7 +60,7 @@ endif()

# Find whether to install python libs in site-packages or dist-packages
execute_process ( COMMAND
python -c "import distutils.sysconfig; print 'dist-packages' if distutils.sysconfig.get_python_lib().endswith('dist-packages') else 'site-packages'"
python -c "import distutils.sysconfig; print('dist-packages' if distutils.sysconfig.get_python_lib().endswith('dist-packages') else 'site-packages')"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)

set(PYTHON_INSTALL_DIR
Expand Down
Loading