3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 06:14:14 +01:00
dft_tools/cmake/TRIQSConfig.cmake.in
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

102 lines
4.5 KiB
CMake

# version
set(TRIQS_VERSION @TRIQS_VERSION@)
set(TRIQS_GIT_HASH @TRIQS_GIT_HASH@)
#definitions
set(TRIQS_CXX_DEFINITIONS @TRIQS_CXX_DEFINITIONS@)
# Includes
set(TRIQS_INCLUDE @CMAKE_INSTALL_PREFIX@/include)
set(TRIQS_INCLUDE_BOOST @BOOST_INCLUDE_DIR@)
set(TRIQS_INCLUDE_MPI @TRIQS_INCLUDE_MPI@)
set(TRIQS_INCLUDE_PYTHON @TRIQS_INCLUDE_PYTHON@)
set(TRIQS_INCLUDE_HDF5 @TRIQS_INCLUDE_HDF5@)
set(TRIQS_INCLUDE_FFTW @TRIQS_INCLUDE_FFTW@)
set(TRIQS_INCLUDE_GMP @TRIQS_INCLUDE_GMP@)
set(TRIQS_INCLUDE_GSL @GSL_INCLUDE_DIR@)
# Libraries
set(TRIQS_LIBRARY -L@CMAKE_INSTALL_PREFIX@/lib -ltriqs)
set(TRIQS_LIBRARY_BOOST @BOOST_LIBRARY@)
set(TRIQS_LIBRARY_MPI @TRIQS_LIBRARY_MPI@)
set(TRIQS_LIBRARY_PYTHON @TRIQS_LIBRARY_PYTHON@)
set(TRIQS_LIBRARY_HDF5 @TRIQS_LIBRARY_HDF5@)
set(TRIQS_LIBRARY_LAPACK @TRIQS_LIBRARY_LAPACK@)
set(TRIQS_LIBRARY_FFTW @TRIQS_LIBRARY_FFTW@)
set(TRIQS_LIBRARY_GMP @TRIQS_LIBRARY_GMP@)
set(TRIQS_LIBRARY_GSL @GSL_LIBRARIES@)
# Misc
set(TRIQS_HDF5_DIFF_EXECUTABLE @TRIQS_HDF5_DIFF_EXECUTABLE@)
# for people who want to quickly add everything TRIQS has detected...
set(TRIQS_LIBRARY_ALL ${TRIQS_LIBRARY} ${TRIQS_LIBRARY_BOOST} ${TRIQS_LIBRARY_PYTHON} ${TRIQS_LIBRARY_MPI} ${TRIQS_LIBRARY_HDF5} ${TRIQS_LIBRARY_LAPACK} ${TRIQS_LIBRARY_FFTW} ${TRIQS_LIBRARY_GMP} ${TRIQS_LIBRARY_GSL} )
set(TRIQS_INCLUDE_ALL ${TRIQS_INCLUDE} ${TRIQS_INCLUDE_BOOST} ${TRIQS_INCLUDE_PYTHON} ${TRIQS_INCLUDE_MPI} ${TRIQS_INCLUDE_HDF5} ${TRIQS_INCLUDE_LAPACK} ${TRIQS_INCLUDE_FFTW} ${TRIQS_INCLUDE_GMP} ${TRIQS_INCLUDE_GSL} )
list (REMOVE_DUPLICATES TRIQS_INCLUDE_ALL)
# Python specific stuff
set (TRIQS_PYTHON_INTERPRETER @PYTHON_INTERPRETER@)
# Fix the rpath
set(CMAKE_INSTALL_RPATH "@CMAKE_INSTALL_PREFIX@/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
message(STATUS "TRIQS : Adding C++11 compilation flags -std=c++11 ")
add_definitions( -std=c++0x)
# Check compiler
if (NOT CMAKE_CXX_COMPILER STREQUAL "@CMAKE_CXX_COMPILER@" )
message(FATAL_ERROR "For your own safety, you should use the same compiler as the one used to compile TRIQS !")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ ")
message(STATUS "TRIQS : Adding C++11 compilation flags for Os X: -stdlib=libc++ ")
else ()
message( WARNING "${line_of_star}You are on Os X but your are not using clang. This is NOT recommended...${line_of_star}")
endif ()
endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# This function add the target to build a python module
#
# NickName =
# ModuleName = the python name of the module
# ModuleDest = path in the pytriqs tree [ FOR INSTALLATION ONLY] IMPROVE MAKE THIS OPTIONAL (for test)
macro (triqs_cython_module NickName ModuleName)
message(STATUS "TRIQS : Preparing cython module ${NickName} with the interpreter ${TRIQS_PYTHON_INTERPRETER} ")
get_filename_component(CYTHON_EXECUTABLE_PATH ${TRIQS_PYTHON_INTERPRETER} PATH)
set(CYTHON_EXECUTABLE ${CYTHON_EXECUTABLE_PATH}/cython CACHE STRING "Path to the cython executable")
set(cython_src ${CMAKE_CURRENT_SOURCE_DIR}/${ModuleName}.pyx )
FILE(GLOB all_pyx_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.pyx *.pxd )
set(cython_wrap ${CMAKE_CURRENT_BINARY_DIR}/wrap_${NickName}_by_cython.cpp)
add_custom_command (OUTPUT ${cython_wrap} DEPENDS ${all_pyx_src} COMMAND ${CYTHON_EXECUTABLE} ${cython_src} -I ${CMAKE_CURRENT_SOURCE_DIR}/ -I@CMAKE_INSTALL_PREFIX@/include/pytriqs/ -I@CMAKE_INSTALL_PREFIX@/include/ -X embedsignature=True --cplus -o ${cython_wrap} )
add_custom_target(cython_${NickName} ALL DEPENDS ${cython_wrap})
add_library(${ModuleName} MODULE ${cython_wrap} )
set_target_properties(${ModuleName} PROPERTIES PREFIX "") #eliminate the lib in front of the module name
target_link_libraries(${ModuleName} ${TRIQS_LINK_LIBS} triqs)
if (${ARGN} MATCHES "")
install (TARGETS ${ModuleName} DESTINATION ${TRIQS_PYTHON_LIB_DEST}/${ARGN} )
endif (${ARGN} MATCHES "")
set_property (GLOBAL APPEND PROPERTY DEPENDANCE_TO_ADD triqs_${NickName} )
endmacro (triqs_cython_module)
# Also duplicate from the FindTriqsMacro.... ? Include ?
macro (triqs_add_all_subdirectories_with_cmakelist)
SET( print_decal_sub_dir "${print_decal_sub_dir} ")
FILE(GLOB ALLSUBS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */CMakeLists.txt)
foreach ( f ${ALLSUBS})
get_filename_component(d ${f} PATH)
#MESSAGE(STATUS "${print_decal_sub_dir}## Including subdirectory : ${d}")
add_subdirectory(${d})
endforeach ( f ${ALLSUBS})
endmacro (triqs_add_all_subdirectories_with_cmakelist)