CMakeLists.txt 2.9 KB
Newer Older
gsell's avatar
gsell committed
1 2
message ("configure: make IpplInfo.h")
execute_process (
gsell's avatar
gsell committed
3 4
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    COMMAND date
kraus's avatar
kraus committed
5
    OUTPUT_VARIABLE DATE_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
gsell's avatar
gsell committed
6
    )
gsell's avatar
gsell committed
7
execute_process (
gsell's avatar
gsell committed
8 9
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    COMMAND uname -a
kraus's avatar
kraus committed
10
    OUTPUT_VARIABLE UNAME_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
gsell's avatar
gsell committed
11
    )
gsell's avatar
gsell committed
12
execute_process (
kraus's avatar
kraus committed
13
    COMMAND whoami
kraus's avatar
kraus committed
14
    OUTPUT_VARIABLE WHOAMI_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
kraus's avatar
kraus committed
15
    )
gsell's avatar
gsell committed
16

gsell's avatar
gsell committed
17 18 19 20 21 22
set (IPPL_COMPILE_ARCH \"$ENV{IPPL_ARCH}\")
set (IPPL_COMPILE_LINE \"${CMAKE_CXX_FLAGS}\")
set (IPPL_COMPILE_DATE \"${DATE_OUT}\")
set (IPPL_COMPILE_MACHINE \"${UNAME_OUT}\")
set (IPPL_COMPILE_OPTIONS \"${CMAKE_CXX_FLAGS}\")
set (IPPL_COMPILE_USER \"${WHOAMI_OUT}\")
23

gsell's avatar
gsell committed
24
configure_file (IpplVersions.h.in ${CMAKE_CURRENT_SOURCE_DIR}/IpplVersions.h)
25

gsell's avatar
gsell committed
26 27 28 29 30 31 32 33 34 35 36
set (IPPL_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
macro (add_ippl_sources)
    file (RELATIVE_PATH _relPath "${IPPL_SRC_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        if (_relPath)
            list (APPEND IPPL_SRCS "${_relPath}/${_src}")
        else ()
            list (APPEND IPPL_SRCS "${_src}")
        endif ()
    endforeach ()
    if (_relPath)
37
        # propagate SRCS to parent directory
gsell's avatar
gsell committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51
        set (IPPL_SRCS ${IPPL_SRCS} PARENT_SCOPE)
    endif ()
endmacro ()

macro (add_ippl_headers)
    file (RELATIVE_PATH _relPath "${IPPL_SRC_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_hdr ${ARGN})
        if (_relPath)
            list (APPEND IPPL_HDRS "${_relPath}/${_hdr}")
        else ()
            list (APPEND IPPL_HDRS "${_hdr}")
        endif ()
    endforeach ()
    if (_relPath)
52
        # propagate HDRS to parent directory
gsell's avatar
gsell committed
53 54 55
        set (IPPL_HDRS ${IPPL_HDRS} PARENT_SCOPE)
    endif ()
endmacro ()
56

gsell's avatar
gsell committed
57
set (IPPL_BASEDIR_HDRS
kraus's avatar
kraus committed
58 59 60
    Ippl.h
    IpplVersions.h
    )
gsell's avatar
gsell committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
add_ippl_headers (${IPPL_BASEDIR_HDRS})

add_subdirectory (AppTypes)
add_subdirectory (DataSource)
add_subdirectory (DomainMap)
add_subdirectory (FFT)
add_subdirectory (Field)
add_subdirectory (FieldLayout)
add_subdirectory (Index)
add_subdirectory (Meshes)
add_subdirectory (Message)
add_subdirectory (Particle)
add_subdirectory (PETE)
add_subdirectory (Region)
add_subdirectory (SubField)
add_subdirectory (SubParticle)
add_subdirectory (Utility)

if (ENABLE_AMR)
    add_subdirectory(AmrParticle)
endif ()

include_directories (
84
    BEFORE ${CMAKE_CURRENT_SOURCE_DIR}
kraus's avatar
kraus committed
85
    )
gsell's avatar
gsell committed
86

gsell's avatar
gsell committed
87
add_library ( ippl ${IPPL_SRCS} ${IPPL_SRCS_FORT} )
gsell's avatar
gsell committed
88

gsell's avatar
gsell committed
89 90 91 92 93
if (ENABLE_DKS)
    message ( "DKS include dirs: ${DKS_INCLUDE_DIR}")
    include_directories (${DKS_INCLUDE_DIR})
    link_directories (${DKS_LIBRARY_DIR})
    target_link_libraries (
gsell's avatar
gsell committed
94
        ${TARGET_LINK_LIBRARIES} 
locans_u's avatar
locans_u committed
95 96
	ippl
	dks
gsell's avatar
gsell committed
97
        ${DKS_CUDA_LIBS}
gsell's avatar
gsell committed
98
        )
locans_u's avatar
locans_u committed
99 100 101 102
else()
    target_link_libraries(
        ippl
    )
gsell's avatar
gsell committed
103 104 105 106
endif ()

install (TARGETS ippl DESTINATION lib)
install (FILES ${IPPL_BASEDIR_HDRS} DESTINATION include)
uldis_l's avatar
uldis_l committed
107

gsell's avatar
gsell committed
108
# vi: set et ts=4 sw=4 sts=4:
gsell's avatar
gsell committed
109

gsell's avatar
gsell committed
110 111 112 113 114
# Local Variables:
# mode:cmake
# cmake-tab-width: 4
# indent-tabs-mode:nil
# End: