CMakeLists.txt 2.32 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5 6 7 8 9
#  general cmake flags:
#    -DCMAKE_INSTALL_PREFIX=/usr/local     -- the prefix for installing
#    -DCMAKE_BUILD_TYPE=type               -- type can be Debug, Release, ...
#    -DCMAKE_PREFIX_PATH=/dir              -- external packages
#
#     note that CMAKE_PREFIX_PATH can be a list of directories:
#      -DCMAKE_PREFIX_PATH='/dir1;/dir2;/dir3'
#

10
cmake_minimum_required (VERSION 3.12)
Matthieu Dorier's avatar
Matthieu Dorier committed
11
project (hepnos C CXX)
Matthieu Dorier's avatar
Matthieu Dorier committed
12

13
add_definitions (-g)
14
set (CMAKE_CXX_STANDARD 14)
15

Matthieu Dorier's avatar
Matthieu Dorier committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
# add our cmake module directory to the path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# link shared lib with full rpath
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# setup cache variables for ccmake
if (NOT CMAKE_BUILD_TYPE)
    set (CMAKE_BUILD_TYPE Release
         CACHE STRING "Choose the type of build." FORCE)
    set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 
                  "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif ()
set (CMAKE_PREFIX_PATH "" CACHE STRING "External dependencies path")
set (BUILD_SHARED_LIBS "OFF" CACHE BOOL "Build a shared library")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

Matthieu Dorier's avatar
Matthieu Dorier committed
36 37
find_package(MPI REQUIRED)

Matthieu Dorier's avatar
Matthieu Dorier committed
38 39 40
# packages we depend on
include (xpkg-import)
find_package (mercury CONFIG REQUIRED)
41
find_package (thallium CONFIG REQUIRED)
42
find_package (Boost REQUIRED COMPONENTS serialization)
Matthieu Dorier's avatar
Matthieu Dorier committed
43 44
include_directories(${Boost_INCLUDE_DIRS})
xpkg_import_module (margo REQUIRED margo)
45 46 47
xpkg_import_module (sdskv-client REQUIRED sdskv-client)
xpkg_import_module (sdskv-server REQUIRED sdskv-server)
xpkg_import_module (ch-placement REQUIRED ch-placement)
Matthieu Dorier's avatar
Matthieu Dorier committed
48
xpkg_import_module (uuid REQUIRED uuid)
49
find_package (yaml-cpp REQUIRED)
Matthieu Dorier's avatar
Matthieu Dorier committed
50

51 52 53 54 55 56 57 58 59
find_package (CppUnit)
if (CPPUNIT_FOUND)
    message(STATUS "CppUnit found, unit tests will be compiled")
    include_directories(${CPPUNIT_INCLUDE_DIR})
    enable_testing()
else (CPPUNIT_FOUND)
    message(STATUS "CppUnit not found, unit tests will not be compiled")
endif (CPPUNIT_FOUND)

Matthieu Dorier's avatar
Matthieu Dorier committed
60
add_subdirectory (src)
Matthieu Dorier's avatar
Matthieu Dorier committed
61
add_subdirectory (bin)
Matthieu Dorier's avatar
Matthieu Dorier committed
62 63 64 65
if(ENABLE_EXAMPLES)
    message(STATUS "Examples will be built")
    add_subdirectory (examples)
endif(ENABLE_EXAMPLES)
66 67 68 69 70

if(CPPUNIT_FOUND AND ENABLE_TESTS)
    message(STATUS "Unit tests are enabled, will be built")
    add_subdirectory (test)
endif(CPPUNIT_FOUND AND ENABLE_TESTS)