Skip to content

Commit

Permalink
Merge pull request #17 from loriab/boost61fix
Browse files Browse the repository at this point in the history
mods for Mac distribution
  • Loading branch information
jturney authored Jun 27, 2016
2 parents 9e65eef + a2e7e08 commit 17a3b1e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ option(ENABLE_PYTHON "Enable Python interface" ON)
option(CYCLOPS "Location of the Cyclops build directory" "")
option(ELEMENTAL "Location of the Elemental build directory" "")
option(ENABLE_PSI4 "Enables PSI4 interface." OFF)
option(ENABLE_STATIC "Build only static library, Python library is not built." OFF)
option(STATIC_ONLY "Build only static library, Python library is not built." OFF)

include(CMakeDependentOption)
cmake_dependent_option(
Expand All @@ -61,6 +61,9 @@ cmake_dependent_option(
cmake_dependent_option(
PSI4_INCLUDE_DIRS "PSI4 include directories" ""
"ENABLE_PSI4" ON)
if(STATIC_ONLY)
set(ENABLE_PYTHON OFF)
endif()

# include cmake modules as needed
include(ConfigVersion)
Expand Down
2 changes: 1 addition & 1 deletion cmake/ConfigBoost.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Oldest version of Boost tested against
set(BOOSTVER 1.53.0)

if (ENABLE_STATIC)
if (ENABLE_STATIC_LINKING)
set(Boost_USE_STATIC_LIBS TRUE)
endif()

Expand Down
3 changes: 2 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

if(ENABLE_PYTHON)
install(DIRECTORY ambit DESTINATION lib FILES_MATCHING PATTERN "*.py")
install(DIRECTORY ambit DESTINATION ${PYTHON_SITE_PACKAGES} FILES_MATCHING PATTERN "*.py")
install(FILES np_test.py test_blocks.py test_operators.py DESTINATION ${PYTHON_SITE_PACKAGES}/ambit/tests)
endif()
39 changes: 29 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,45 @@ endif ()

list(SORT TENSOR_SOURCES)

# build libray
if (ENABLE_STATIC)
add_library(ambit STATIC ${TENSOR_SOURCES} ${TENSOR_HEADERS})
install(TARGETS ambit ARCHIVE DESTINATION lib)
else ()
add_library(ambit SHARED ${TENSOR_SOURCES} ${TENSOR_HEADERS})
install(TARGETS ambit LIBRARY DESTINATION lib)
endif ()
# build library
if (NOT STATIC_ONLY)
add_library(ambit-shared SHARED ${TENSOR_SOURCES} ${TENSOR_HEADERS})
set_target_properties (ambit-shared PROPERTIES CLEAN_DIRECT_OUTPUT 1 OUTPUT_NAME "ambit")
install(TARGETS ambit-shared LIBRARY DESTINATION lib)
endif (NOT STATIC_ONLY)

add_library(ambit-static STATIC ${TENSOR_SOURCES} ${TENSOR_HEADERS})
set_target_properties (ambit-static PROPERTIES CLEAN_DIRECT_OUTPUT 1 OUTPUT_NAME "ambit")
install(TARGETS ambit-static ARCHIVE DESTINATION lib)

if (ENABLE_CYCLOPS)
target_link_libraries(ambit ${CYCLOPS}/lib/libctf.a ${ELEMENTAL}/libEl.a ${ELEMENTAL}/external/pmrrr/libpmrrr.a ${MPI_LIBRARIES})
if (NOT STATIC_ONLY)
target_link_libraries(ambit-shared ${CYCLOPS}/lib/libctf.a ${ELEMENTAL}/libEl.a ${ELEMENTAL}/external/pmrrr/libpmrrr.a ${MPI_LIBRARIES})
endif()
target_link_libraries(ambit-static ${CYCLOPS}/lib/libctf.a ${ELEMENTAL}/libEl.a ${ELEMENTAL}/external/pmrrr/libpmrrr.a ${MPI_LIBRARIES})
endif ()

target_link_libraries(ambit
if (NOT STATIC_ONLY)
target_link_libraries(ambit-shared
${LAPACK_LIBRARIES}
${BLAS_LIBRARIES}
${Boost_LIBRARIES}
${HDF5_LIBRARIES}
)
endif()
target_link_libraries(ambit-static
${LAPACK_LIBRARIES}
${BLAS_LIBRARIES}
${Boost_LIBRARIES}
${HDF5_LIBRARIES}
)

if (NOT STATIC_ONLY)
add_library(ambit ALIAS ambit-shared)
else()
add_library(ambit ALIAS ambit-static)
endif()

if (ENABLE_PYTHON)
add_subdirectory(python)
endif ()
Expand Down
4 changes: 2 additions & 2 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if (NOT ENABLE_STATIC)
if (NOT STATIC_ONLY)

set(PYTHON_HEADERS
)
Expand All @@ -23,6 +23,6 @@ target_link_libraries(pyambit ambit ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${Boos
set_target_properties(pyambit PROPERTIES PREFIX "")
set_target_properties(pyambit PROPERTIES SUFFIX ${PYTHON_MODULE_EXTENSION})

install(TARGETS pyambit DESTINATION lib/ambit)
install(TARGETS pyambit DESTINATION ${PYTHON_SITE_PACKAGES}/ambit)

endif()

0 comments on commit 17a3b1e

Please sign in to comment.