diff --git a/CMakeLists.txt b/CMakeLists.txt index f387887e47ab1b93e0b38eb988eca548dd6e72d0..e976dce27a4832c2d059df8f7829cab4446ba155 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,6 +186,13 @@ if (ENABLE_STATIC AND UNIX AND NOT APPLE) set (CMAKE_FIND_LIBRARY_SUFFIXES .a) endif() +# Python needed before Boost +find_package(Python 2.4 REQUIRED) +# Split version string +string(REPLACE "." ";" _python_version_list ${PYTHON_VERSION}) +list(GET _python_version_list 0 PYTHON_VERSION_MAJOR) +list(GET _python_version_list 1 PYTHON_VERSION_MINOR) + if(BOOST_VERSION) message(STATUS "forcing boost to version ${BOOST_VERSION}") set(_BOOST_MIN_VERSION ${BOOST_VERSION}) @@ -226,7 +233,6 @@ else() endif() find_package(Eigen 3.2.0 REQUIRED) -find_package(Python 2.4 REQUIRED) find_package(SQLite3 3.7.13 REQUIRED) if(USE_NUMPY) diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 8a9e880968f299d494938f6fa64a6f94b9ce5c75..4ee0d944049fed084c53ea42b9977132c3f51d37 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -770,7 +770,7 @@ macro(ost_match_boost_python_version) # this variable may either be a simple library path or list that contains # different libraries for different build-options. For example: # optimized;<lib1>;debug;<lib2> - set(_BOOST_PYTHON_LIBRARY ${Boost_PYTHON_LIBRARY}) + set(_BOOST_PYTHON_LIBRARY ${BOOST_PYTHON_LIBRARIES}) list(LENGTH _BOOST_PYTHON_LIBRARY _BP_LENGTH) if (_BP_LENGTH GREATER 1) list(FIND _BOOST_PYTHON_LIBRARY optimized _OPTIMIZED_INDEX) @@ -908,8 +908,28 @@ set(_BOOST_MIN_VERSION 1.31) macro(setup_boost) set (Boost_NO_BOOST_CMAKE TRUE) - find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS python REQUIRED) - set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES}) + # starting with CMake 3.11 we could use the following instead of the foreach + # find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS + # python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} REQUIRED) + # set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES}) + # see https://cmake.org/cmake/help/v3.11/module/FindBoost.html + foreach(_python_lib_name python + python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} + python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} + python${PYTHON_VERSION_MAJOR}) + find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS ${_python_lib_name} QUIET) + if(Boost_FOUND) + message(STATUS "Found Boost package: " ${_python_lib_name}) + set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES}) + break() + else() + message(STATUS "Boost package not found: " ${_python_lib_name} + ". Trying alternative names!") + endif() + endforeach(_python_lib_name) + if(NOT BOOST_PYTHON_LIBRARIES) + message(FATAL_ERROR "Failed to find any Boost Python library!") + endif() set(Boost_LIBRARIES) find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS unit_test_framework REQUIRED) diff --git a/modules/bindings/src/tmalign/basic_fun.h b/modules/bindings/src/tmalign/basic_fun.h index 91785c96eccb7f32ac68e66bc4109c64ffcb2f7d..8274428ee8d56b061180855f6205df214ed32e49 100644 --- a/modules/bindings/src/tmalign/basic_fun.h +++ b/modules/bindings/src/tmalign/basic_fun.h @@ -7,7 +7,9 @@ #include <math.h> #include <time.h> #include <string.h> -#ifndef __APPLE__ +// OST-NOTE: ifdef was added here since malloc.h isn't required for Linux/Mac +// and for some compilers (clang, gcc8) it isn't available +#ifdef _WIN32 #include <malloc.h> #endif diff --git a/modules/db/src/CMakeLists.txt b/modules/db/src/CMakeLists.txt index 2e85478c49197df7b8682007c52a8ddb6acc0d22..8c536297f304b1a8ec686500c2259159c7002230 100644 --- a/modules/db/src/CMakeLists.txt +++ b/modules/db/src/CMakeLists.txt @@ -16,7 +16,7 @@ extract_data_helper.cc ) module(NAME db SOURCES ${OST_DB_SOURCES} HEADERS ${OST_DB_HEADERS} - DEPENDS_ON ost_base ost_geom ost_seq LINK sqlite3) + DEPENDS_ON ost_base ost_geom ost_seq LINK ${SQLITE3_LIBRARIES}) if(WIN32) set_target_properties(ost_db PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/sqlite3.def") add_definitions(/DSQLITE_ENABLE_COLUMN_METADATA) diff --git a/modules/img/base/src/raster_image/raster_image.cc b/modules/img/base/src/raster_image/raster_image.cc index 143e1110b2c0e739a5c1b522886e54a409aeacfa..44cfdf1a9e2eeb71e2062db5ea1ac5eed3974581 100644 --- a/modules/img/base/src/raster_image/raster_image.cc +++ b/modules/img/base/src/raster_image/raster_image.cc @@ -24,7 +24,8 @@ Authors: Ansgar Philippsen, Andreas Schenk */ -#ifndef __APPLE__ +#include <stdlib.h> +#ifdef _WIN32 #include <malloc.h> #endif #include <cmath>