Enable parallel tests.
[hoomd-blue.git] / CMake / hoomd / HOOMDCommonLibsSetup.cmake
blobb8a33574ceb3c87b41cc77c4a687951ff695085c
1 # Maintainer: joaander
3 ##################################
4 ## find the threads library
5 find_package(Threads)
7 include_directories(${PYTHON_INCLUDE_DIR})
9 # find ZLIB
10 if (ENABLE_ZLIB)
11 find_package(ZLIB REQUIRED)
13 include_directories(${ZLIB_INCLUDE_DIR})
14 endif (ENABLE_ZLIB)
16 if (ENABLE_OCELOT)
17 find_library(OCELOT_LIBRARY NAMES ocelot)
18 # override the CUDART library
19 set (CUDA_CUDART_LIBRARY ${OCELOT_LIBRARY} CACHE STRING "ENABLE_OCELOT forces replacement of CUDART with ocelot" FORCE)
21 if (OCELOT_LIBRARY)
22     mark_as_advanced(OCELOT_LIBRARY)
23 endif (OCELOT_LIBRARY)
25 endif (ENABLE_OCELOT)
28 ################################
29 ## Define common libraries used by every target in HOOMD
30 if (WIN32)
31     set(HOOMD_COMMON_LIBS ${PYTHON_LIBRARIES} ${WINSOCK_LIB})
32 else (WIN32)
33     set(BOOST_LIBS ${Boost_THREAD_LIBRARY}
34             ${Boost_FILESYSTEM_LIBRARY}
35             ${Boost_PROGRAM_OPTIONS_LIBRARY}
36             ${Boost_SIGNALS_LIBRARY}
37             ${Boost_IOSTREAMS_LIBRARY}
38             )
40     string(TOUPPER ${BOOST_PYTHON_COMPONENT} UPPER_BOOST_PYTHON_COMPONENT )
41     set(BOOST_LIBS ${BOOST_LIBS} ${Boost_${UPPER_BOOST_PYTHON_COMPONENT}_LIBRARY})
43     if (Boost_SYSTEM_LIBRARY)
44         set(BOOST_LIBS ${BOOST_LIBS} ${Boost_SYSTEM_LIBRARY})
45     endif (Boost_SYSTEM_LIBRARY)
48     # these libraries are needed for MPI
49     if(ENABLE_MPI)
50     set(BOOST_LIBS ${BOOST_LIBS} ${Boost_SERIALIZATION_LIBRARY})
51     endif(ENABLE_MPI)
53     ## An update to to CentOS5's python broke linking of the hoomd exe. According
54     ## to an ancient post online, adding -lutil fixed this in python 2.2
55     set(ADDITIONAL_LIBS "")
56     if (UNIX AND NOT APPLE)
57         find_library(UTIL_LIB util /usr/lib)
58         find_library(DL_LIB dl /usr/lib)
59         set(ADDITIONAL_LIBS ${UTIL_LIB} ${DL_LIB})
60         if (DL_LIB AND UTIL_LIB)
61         mark_as_advanced(UTIL_LIB DL_LIB)
62         endif (DL_LIB AND UTIL_LIB)
63     endif (UNIX AND NOT APPLE)
65     set(HOOMD_COMMON_LIBS
66             ${PYTHON_LIBRARIES}
67             ${BOOST_LIBS}
68             ${CMAKE_THREAD_LIBS_INIT}
69             ${ZLIB_LIBRARIES}
70             ${ADDITIONAL_LIBS}
71             )
72 endif (WIN32)
74 if (ENABLE_CUDA)
75     list(APPEND HOOMD_COMMON_LIBS ${CUDA_LIBRARIES} ${CUDA_cufft_LIBRARY})
77     if (ENABLE_NVTOOLS)
78         list(APPEND HOOMD_COMMON_LIBS ${CUDA_nvToolsExt_LIBRARY})
79     endif()
80 endif (ENABLE_CUDA)
82 if (ENABLE_MPI)
83     list(APPEND HOOMD_COMMON_LIBS ${MPI_CXX_LIBRARIES})
84 endif (ENABLE_MPI)