From 93eea0ed743e527bef3dc1491a3a544569319e1e Mon Sep 17 00:00:00 2001 From: Michel Ferrero Date: Mon, 2 Sep 2013 14:26:32 +0200 Subject: [PATCH] Get rid of boost compilation from sources Also change pytriqs.boost to boost --- CMakeLists.txt | 102 +++-------- cmake/CompileBoost.cmake | 302 ------------------------------- foreignlibs/boost/CMakeLists.txt | 90 --------- foreignlibs/boost/__init__.py | 10 - pytriqs/utility/mpi.py | 2 +- pytriqs/utility/mpi_mpi4py.py | 5 - 6 files changed, 29 insertions(+), 482 deletions(-) delete mode 100644 cmake/CompileBoost.cmake delete mode 100644 foreignlibs/boost/CMakeLists.txt delete mode 100644 foreignlibs/boost/__init__.py diff --git a/CMakeLists.txt b/CMakeLists.txt index c71b0e28..dab9f78a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,85 +148,39 @@ message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}") # ################################# message( STATUS "-------- Boost detection -------------") -# Check user input for BOOST_SOURCE_DIR -# If user has defined BOOST_SOURCE_DIR in environment variable, -# and not overruled in on the command line -DBOOST_SOURCE_DIR, we take it -# If -DBOOST_SOURCE_DIR is not set, nor is the env variable BOOST_SOURCE_DIR, -# we take the installed one. -set (BOOST_SOURCE_DIR_ENV $ENV{BOOST_SOURCE_DIR}) -if (NOT BOOST_SOURCE_DIR AND BOOST_SOURCE_DIR_ENV) - set (BOOST_SOURCE_DIR ${BOOST_SOURCE_DIR_ENV}) + +# if static build, request static lib +if(TRIQS_BUILD_STATIC) + set(Boost_USE_STATIC_LIBS ON) +else() + set(Boost_USE_STATIC_LIBS OFF) endif() -if(BOOST_SOURCE_DIR) - if(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR}) - Message(FATAL_ERROR "You must specify an absolute path for BOOST_SOURCE_DIR.") - endif(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR}) - STRING(REGEX MATCH "~\\/" TILDE "${BOOST_SOURCE_DIR}") - if(TILDE) - Message(FATAL_ERROR "You should not use the tilde symbol ~. Please write the full absolute path for BOOST_SOURCE_DIR.") - endif(TILDE) - # compile boost if necessary - set(ALPS_BOOST_LIBRARY_NAME "boost_for_triqs" ) - set(ALPS_HAVE_MPI 1) - set(ALPS_HAVE_BOOST_MPI 1) - set(BUILD_BOOST_MPI TRUE) - set(BUILD_BOOST_PYTHON TRUE) - add_subdirectory(foreignlibs/boost) - include_directories(SYSTEM ${BOOST_INCLUDE_DIR}) - -else(BOOST_SOURCE_DIR) - - if (NOT Boost_ROOT_DIR_found) - set( Boost_ROOT_DIR ${BOOST_ROOT_DIR}) - endif (NOT Boost_ROOT_DIR_found) - - # if static build, request static lib - if(TRIQS_BUILD_STATIC) - set(Boost_USE_STATIC_LIBS ON) - else() - set(Boost_USE_STATIC_LIBS OFF) - endif() - # icc requires a higher version - if(CMAKE_COMPILER_IS_ICC) - set(BOOST_VERSION 1.53) - else() - set(BOOST_VERSION 1.46) - endif() - if (PythonSupport) - find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS mpi python serialization system ) #filesystem ) - Else() - find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS mpi serialization system ) #filesystem ) - endif() - if (NOT Boost_FOUND) - message(FATAL_ERROR "Boost not found") - endif() - message(STATUS "BOOST has been detected") - include_directories(${Boost_INCLUDE_DIRS}) - #include_directories(${BOOST_INSTALL_ROOT_DIR}/include) - set(BOOST_LIBRARY ${Boost_LIBRARIES}) #${BOOST_PYTHON_LIB} ${BOOST_SERIALIZATION_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_MPI_LIB}) - set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS}) -endif(BOOST_SOURCE_DIR) - -message(STATUS "Boost include dir : ${BOOST_INCLUDE_DIR}") -message(STATUS "Boost libraries : ${BOOST_LIBRARY}") - -#------------------------ -# copy boost into pytriqs/boost -#------------------------ +# icc requires a higher version +if(CMAKE_COMPILER_IS_ICC) + set(BOOST_VERSION 1.53) +else() + set(BOOST_VERSION 1.46) +endif() if (PythonSupport) - if(NOT BOOST_SOURCE_DIR) - if(NOT BOOST_MODULE_DIR) - EXEC_PYTHON_SCRIPT ("import boost; print boost.__path__[0]" BOOST_MODULE_DIR) - endif(NOT BOOST_MODULE_DIR) - # first create the dir, since pytriqs will be configured later - execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/pytriqs/ ) - execute_process(COMMAND ln -fs ${BOOST_MODULE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/pytriqs/) - install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pytriqs/boost DESTINATION ${TRIQS_PYTHON_LIB_DEST}) - endif(NOT BOOST_SOURCE_DIR) -endif (PythonSupport) + find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS mpi python serialization system ) +else() + find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS mpi serialization system ) +endif() +if (NOT Boost_FOUND) + message(FATAL_ERROR "Boost not found") +endif() +include_directories(${Boost_INCLUDE_DIRS}) +set(BOOST_LIBRARY ${Boost_LIBRARIES}) +set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS}) + +message(STATUS "Boost include dir: ${BOOST_INCLUDE_DIR}") +message(STATUS "Boost libraries: ${BOOST_LIBRARY}") + +# ################################# # on 64 bit machines +# ################################# if (CMAKE_SIZEOF_VOID_P EQUAL 8) # for 64 bits machines message( STATUS "64 bit machine : Adding -fpic ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic" ) diff --git a/cmake/CompileBoost.cmake b/cmake/CompileBoost.cmake deleted file mode 100644 index 472a5bb4..00000000 --- a/cmake/CompileBoost.cmake +++ /dev/null @@ -1,302 +0,0 @@ -# Copyright Olivier Parcollet 2011 : modified to remove pyalps install -# Copyright Matthias Troyer 2009 - 2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -# -# libboost -# - -set (Boost_ROOT_DIR ${BOOST_SOURCE_DIR}) - -set(BOOST_SOURCES "") -set(BOOST_MPI_PYTHON_SOURCES "") -set(BOOST_LINK_LIBS "") - -# Boost.Date_Time -if(BUILD_BOOST_DATE_TIME) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/date_time/src") - set(SOURCES gregorian/date_generators.cpp gregorian/greg_month.cpp gregorian/greg_weekday.cpp - gregorian/gregorian_types.cpp posix_time/posix_time_types.cpp) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_DATE_TIME) - -# Boost.Filesystem -if(BUILD_BOOST_FILESYSTEM) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/filesystem") - set(SOURCES - codecvt_error_category.cpp operations.cpp path.cpp path_traits.cpp - portability.cpp unique_path.cpp utf8_codecvt_facet.cpp - windows_file_codecvt.cpp v2_operations.cpp v2_path.cpp v2_portability.cpp) - foreach (D ${DIRECTORY}/src ${DIRECTORY}/v2/src ${DIRECTORY}/v3/src) - foreach(S ${SOURCES}) - if(EXISTS ${D}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${D}/${S}) - endif(EXISTS ${D}/${S}) - endforeach(S) - endforeach(D) -endif(BUILD_BOOST_FILESYSTEM) - -# Boost.ProgramOptions -if(BUILD_BOOST_PROGRAM_OPTIONS) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/program_options/src") - set(SOURCES cmdline.cpp config_file.cpp options_description.cpp parsers.cpp - variables_map.cpp value_semantic.cpp positional_options.cpp utf8_codecvt_facet.cpp - convert.cpp winmain.cpp) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_PROGRAM_OPTIONS) - -# Boost.Regex -if(BUILD_BOOST_REGEX) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/regex/src") - set(SOURCES c_regex_traits.cpp cpp_regex_traits.cpp cregex.cpp fileiter.cpp icu.cpp - instances.cpp posix_api.cpp regex.cpp regex_debug.cpp regex_raw_buffer.cpp - regex_traits_defaults.cpp static_mutex.cpp usinstances.cpp w32_regex_traits.cpp - wc_regex_traits.cpp wide_posix_api.cpp winstances.cpp) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_REGEX) - - -# Boost.Serialization -if(BUILD_BOOST_SERIALIZATION) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/serialization/src") - set(SOURCES archive_exception.cpp basic_archive.cpp - basic_iarchive.cpp basic_iserializer.cpp basic_oarchive.cpp - basic_oserializer.cpp basic_pointer_iserializer.cpp - basic_pointer_oserializer.cpp basic_serializer_map.cpp - basic_text_iprimitive.cpp basic_text_oprimitive.cpp - basic_text_wiprimitive.cpp basic_text_woprimitive.cpp - basic_xml_archive.cpp binary_iarchive.cpp binary_oarchive.cpp - binary_wiarchive.cpp binary_woarchive.cpp codecvt_null.cpp - extended_type_info.cpp extended_type_info_no_rtti.cpp - extended_type_info_typeid.cpp polymorphic_iarchive.cpp - polymorphic_oarchive.cpp shared_ptr_helper.cpp stl_port.cpp - text_iarchive.cpp text_oarchive.cpp text_wiarchive.cpp - text_woarchive.cpp utf8_codecvt_facet.cpp void_cast.cpp - xml_archive_exception.cpp xml_grammar.cpp xml_iarchive.cpp - xml_oarchive.cpp xml_wgrammar.cpp xml_wiarchive.cpp - xml_woarchive.cpp) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_SERIALIZATION) - -# Boost.Python -if(BUILD_BOOST_PYTHON) - set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS} ${PYTHON_LIBRARY} ${PYTHON_EXTRA_LIBS}) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/python/src") - set(SOURCES dict.cpp errors.cpp exec.cpp import.cpp list.cpp long.cpp - module.cpp numeric.cpp object_operators.cpp object_protocol.cpp slice.cpp - str.cpp tuple.cpp wrapper.cpp converter/arg_to_python_base.cpp - converter/builtin_converters.cpp converter/from_python.cpp - converter/registry.cpp converter/type_id.cpp object/class.cpp - object/enum.cpp object/function.cpp object/function_doc_signature.cpp - object/inheritance.cpp object/iterator.cpp object/life_support.cpp - object/pickle_support.cpp object/stl_iterator.cpp - ) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) - add_definitions(-DBOOST_PYTHON_SOURCE) -endif(BUILD_BOOST_PYTHON) - -# Boost.System -if(BUILD_BOOST_SYSTEM) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/system/src") - set(SOURCES error_code.cpp) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_SYSTEM) - -# Boost.MPI -if(BUILD_BOOST_MPI) - IF(NOT WIN32) - set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS} ${MPI_LIBRARIES}) - ENDIF(NOT WIN32) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/mpi/src") - set(SOURCES broadcast.cpp communicator.cpp computation_tree.cpp - content_oarchive.cpp environment.cpp exception.cpp graph_communicator.cpp - group.cpp intercommunicator.cpp mpi_datatype_cache.cpp - mpi_datatype_oarchive.cpp packed_iarchive.cpp packed_oarchive.cpp - packed_skeleton_iarchive.cpp packed_skeleton_oarchive.cpp - point_to_point.cpp request.cpp timer.cpp - ) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_MPI) - -# Boost.Thread -if(BUILD_BOOST_THREAD) - if (NOT WIN32) - set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS} ${PTHREAD_LIBRARY}) - endif (NOT WIN32) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/thread/src") - if (WIN32) - set(SOURCES win32/thread.cpp win32/tss_dll.cpp win32/tss_pe.cpp) - else (WIN32) - set(SOURCES pthread/once.cpp pthread/thread.cpp) - endif(WIN32) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) -endif(BUILD_BOOST_THREAD) - - -# Boost.MPI Python bindings -if (BUILD_BOOST_MPI AND BUILD_BOOST_PYTHON AND NOT ALPS_BUILD_SOURCE AND Boost_ROOT_DIR) - - set(DIRECTORY "${Boost_ROOT_DIR}/libs/mpi/src/python") - set(SOURCES collectives.cpp py_communicator.cpp datatypes.cpp - documentation.cpp py_environment.cpp py_nonblocking.cpp py_exception.cpp - module.cpp py_request.cpp skeleton_and_content.cpp status.cpp py_timer.cpp - serialize.cpp - ) - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(BOOST_MPI_PYTHON_SOURCES ${BOOST_MPI_PYTHON_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) - - if (BOOST_MPI_PYTHON_SOURCES) - python_add_module(mpi ${BOOST_MPI_PYTHON_SOURCES}) - if(BUILD_SHARED_LIBS) - set_target_properties(mpi PROPERTIES COMPILE_DEFINITIONS "${ALPS_SHARED_CPPFLAGS}") - if(WIN32 AND NOT UNIX) - set_target_properties(mpi PROPERTIES SUFFIX ".pyd") - endif(WIN32 AND NOT UNIX) - endif (BUILD_SHARED_LIBS) - - set_target_properties(mpi PROPERTIES PREFIX "") - target_link_libraries(mpi ${ALPS_BOOST_LIBRARY_NAME} ${BOOST_LINK_LIBS}) - - endif(BOOST_MPI_PYTHON_SOURCES) - -endif (BUILD_BOOST_MPI AND BUILD_BOOST_PYTHON AND NOT ALPS_BUILD_SOURCE AND Boost_ROOT_DIR) - - -####################################################################### -# install -####################################################################### - -# Setting "boost" target not needed when precompiled Boost libraries found. - -if (NOT Boost_FOUND) - add_library(${ALPS_BOOST_LIBRARY_NAME} ${BOOST_SOURCES}) - target_link_libraries(${ALPS_BOOST_LIBRARY_NAME} ${BOOST_LINK_LIBS}) - - # Boost.Test - if(BUILD_BOOST_TEST AND NOT ALPS_FOR_VISTRAILS) - set(DIRECTORY "${Boost_ROOT_DIR}/libs/test/src") - - set(SOURCES compiler_log_formatter.cpp debug.cpp - execution_monitor.cpp framework.cpp - interaction_based.cpp logged_expectations.cpp plain_report_formatter.cpp - progress_monitor.cpp results_collector.cpp results_reporter.cpp - test_tools.cpp unit_test_log.cpp unit_test_main.cpp - unit_test_monitor.cpp unit_test_parameters.cpp unit_test_suite.cpp - xml_log_formatter.cpp xml_report_formatter.cpp - ) - set (TEST_EXEC_MON_SOURCES "") - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(TEST_EXEC_MON_SOURCES ${TEST_EXEC_MON_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) - - set(SOURCES ${SOURCES} exception_safety.cpp) - set (UTF_SOURCES "") - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(UTF_SOURCES ${UTF_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) - - set(SOURCES execution_monitor.cpp debug.cpp cpp_main.cpp ) - set (PRG_EXEC_MON_SOURCES "") - foreach(S ${SOURCES}) - if(EXISTS ${DIRECTORY}/${S}) - set(PRG_EXEC_MON_SOURCES ${PRG_EXEC_MON_SOURCES} ${DIRECTORY}/${S}) - endif(EXISTS ${DIRECTORY}/${S}) - endforeach(S) - - add_library(boost_unit_test_framework ${UTF_SOURCES}) - add_library(boost_test_exec_monitor ${TEST_EXEC_MON_SOURCES}) - add_library(boost_prg_exec_monitor ${PRG_EXEC_MON_SOURCES}) - - if(BUILD_SHARED_LIBS) - set_target_properties(boost_unit_test_framework PROPERTIES COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1) - set_target_properties(boost_test_exec_monitor PROPERTIES COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1) - set_target_properties(boost_prg_exec_monitor PROPERTIES COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1) - endif(BUILD_SHARED_LIBS) - - endif(BUILD_BOOST_TEST AND NOT ALPS_FOR_VISTRAILS) - - - if(WIN32) - if(BUILD_SHARED_LIBS) - set_target_properties(boost PROPERTIES COMPILE_DEFINITIONS BOOST_THREAD_BUILD_DLL=1) - else(BUILD_SHARED_LIBS) - set_target_properties(boost PROPERTIES COMPILE_DEFINITIONS BOOST_THREAD_BUILD_LIB=1) - endif(BUILD_SHARED_LIBS) - endif(WIN32) - - if (NOT ALPS_BUILD_SOURCE) - if(MSVC) - get_target_property(LIB_NAME ${ALPS_BOOST_LIBRARY_NAME} LOCATION) - add_custom_command(TARGET ${ALPS_BOOST_LIBRARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_NAME} ${PROJECT_BINARY_DIR}/bin) - endif(MSVC) - - if (ALPS_FOR_VISTRAILS) - SET_TARGET_PROPERTIES(${ALPS_BOOST_LIBRARY_NAME} - PROPERTIES BUILD_WITH_INSTALL_RPATH ON - INSTALL_NAME_DIR "@executable_path/../Frameworks" - ) - endif (ALPS_FOR_VISTRAILS) - - if (ALPS_INSTALL_VISTRAILS_PACKAGES) - install(TARGETS ${ALPS_BOOST_LIBRARY_NAME} COMPONENT vistrails - RUNTIME DESTINATION ${VISTRAILS_DYLIB_DIR} - ARCHIVE DESTINATION ${VISTRAILS_DYLIB_DIR} - LIBRARY DESTINATION ${VISTRAILS_DYLIB_DIR}) - endif (ALPS_INSTALL_VISTRAILS_PACKAGES) - if (NOT ALPS_FOR_VISTRAILS) - install(TARGETS ${ALPS_BOOST_LIBRARY_NAME} COMPONENT libraries - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) - if (ALPS_INSTALL_BOOST_TEST) - install(TARGETS boost_unit_test_framework boost_test_exec_monitor boost_prg_exec_monitor - COMPONENT libraries - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) - endif(ALPS_INSTALL_BOOST_TEST) - endif (NOT ALPS_FOR_VISTRAILS) - endif (NOT ALPS_BUILD_SOURCE) -endif (NOT Boost_FOUND) diff --git a/foreignlibs/boost/CMakeLists.txt b/foreignlibs/boost/CMakeLists.txt deleted file mode 100644 index 938ab32d..00000000 --- a/foreignlibs/boost/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -# boost libraries -# python and mpi have already be set before. -# here add the other boost part we want to compile - -# we can not be here if boost is installed.. just check -if(NOT BOOST_SOURCE_DIR) - message( FATAL_ERROR " cmake error in boost") -endif(NOT BOOST_SOURCE_DIR) - -# Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp -# Read the whole file: -# -set(BOOST_VERSION 0) -set(BOOST_LIB_VERSION "") -file(READ "${BOOST_SOURCE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) -# message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") - -string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") -string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - -if(NOT "${Boost_VERSION}" STREQUAL "0") - math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") -endif(NOT "${Boost_VERSION}" STREQUAL "0") - -message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "version.hpp reveals boost " - "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - - ### -set(BOOST_INCLUDE_DIR ${BOOST_INSTALL_ROOT_DIR}/include PARENT_SCOPE) - -# Test version is high enough ... -if(CMAKE_COMPILER_IS_ICC) - if ( "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" VERSION_LESS "1.53.0") - MESSAGE(FATAL_ERROR "With Intel compiler, you need boost version >= 1.53, while this is ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} ") - endif() -endif() - -MESSAGE(STATUS "I am using boost sources from ${BOOST_SOURCE_DIR} to compile a mini boost_for_triqs ") - -# what to compile ? -SET( BUILD_BOOST_SERIALIZATION ON) -#SET( BUILD_BOOST_FILESYSTEM ON) -SET( BUILD_BOOST_SYSTEM ON) - -SET( BUILD_BOOST_FILESYSTEM OFF) -SET (BUILD_BOOST_THREAD ON) -SET (BUILD_BOOST_DATE_TIME OFF ) -SET (BUILD_BOOST_PROGRAM_OPTIONS OFF) -SET (BUILD_BOOST_REGEX OFF) - -set(ALPS_BOOST_LIBRARY_NAME "boost_for_triqs" ) -include (CompileBoost) - -include_directories(${BOOST_SOURCE_DIR}) # this one is for the compilation in this dir -if(TRIQS_BUILD_STATIC) - set(BOOST_LIBRARY boost_for_triqs mpi ${ALPS_EXTRA_LIBRARIES} PARENT_SCOPE ) -else(TRIQS_BUILD_STATIC) - set(BOOST_LIBRARY boost_for_triqs ${ALPS_EXTRA_LIBRARIES} PARENT_SCOPE ) -endif(TRIQS_BUILD_STATIC) -set(BOOST_INCLUDE_DIR ${BOOST_SOURCE_DIR} PARENT_SCOPE) # this is for later compilation in the project - -# install the python sources -SET(PYTHON_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py - ) - -if(TRIQS_BUILD_STATIC) - - set_property(GLOBAL APPEND PROPERTY Modules_actually_compiled mpi) - -else(TRIQS_BUILD_STATIC) - - install (FILES ${PYTHON_SOURCES} DESTINATION ${TRIQS_PYTHON_LIB_DEST}/boost) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/mpi.so DESTINATION ${TRIQS_PYTHON_LIB_DEST}/boost) - - # for tests - FILE (COPY ${PYTHON_SOURCES} DESTINATION ${CMAKE_BINARY_DIR}/pytriqs/boost) - execute_process(COMMAND ln -fs ${CMAKE_CURRENT_BINARY_DIR}/mpi.so ${CMAKE_BINARY_DIR}/pytriqs/boost) - -endif(TRIQS_BUILD_STATIC) - -if(Install_dev) - install(DIRECTORY numeric DESTINATION include/boost) -endif(Install_dev) diff --git a/foreignlibs/boost/__init__.py b/foreignlibs/boost/__init__.py deleted file mode 100644 index ffd3862e..00000000 --- a/foreignlibs/boost/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -import sys -if sys.platform == 'linux2': - import DLFCN as dl - flags = sys.getdlopenflags() - sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL) - import mpi - sys.setdlopenflags(flags) -else: - import mpi - diff --git a/pytriqs/utility/mpi.py b/pytriqs/utility/mpi.py index 190b67be..b17de56f 100644 --- a/pytriqs/utility/mpi.py +++ b/pytriqs/utility/mpi.py @@ -27,7 +27,7 @@ myprint_out = lambda x : sys.stdout.write("%s\n"%x) if 'additional_builtin_modules' in dir(sys) and 'mpi' in sys.additional_builtin_modules: #link is static from mpi import * else : - from pytriqs.boost.mpi import * + from boost.mpi import * if rank==0 : myprint_err ("Starting on %s Nodes at : %s"%(size,str(datetime.datetime.now()))) diff --git a/pytriqs/utility/mpi_mpi4py.py b/pytriqs/utility/mpi_mpi4py.py index 696ea449..453015b3 100644 --- a/pytriqs/utility/mpi_mpi4py.py +++ b/pytriqs/utility/mpi_mpi4py.py @@ -24,11 +24,6 @@ import os,sys,datetime myprint_err = lambda x : sys.stderr.write("%s\n"%x) myprint_out = lambda x : sys.stdout.write("%s\n"%x) -#if 'additional_builtin_modules' in dir(sys) and 'mpi' in sys.additional_builtin_modules: #link is static -# from mpi import * -#else : -# from pytriqs.boost.mpi import * - from mpi4py import MPI world = MPI.COMM_WORLD