File: CMakeLists.txt

package info (click to toggle)
tiledarray 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,568 kB
  • sloc: cpp: 53,449; javascript: 1,599; sh: 393; ansic: 226; python: 223; xml: 195; makefile: 36
file content (157 lines) | stat: -rw-r--r-- 5,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#
#  This file is a part of TiledArray.
#  Copyright (C) 2013  Virginia Tech
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#  Justus Calvin
#  Department of Chemistry, Virginia Tech
#
#  CMakeLists.txt
#  Jul 19, 2013
#

CONFIGURE_FILE(
  ${CMAKE_CURRENT_SOURCE_DIR}/unit_test_config_h.in
  ${PROJECT_BINARY_DIR}/tests/unit_test_config.h
)

# Create the ta_test executable
set(executable ta_test)
# N.B.: The order of files here represents the order in which the tests are run.
# N.B. 2: if you want to trim this down you may need to resolve linker errors due to missing fixture deps manually
set(ta_test_src_files  ta_test.cpp
    range.cpp
    btas.cpp
    meta.cpp
    type_traits.cpp
    utility.cpp
    permutation.cpp
    symm_permutation_group.cpp
    symm_irrep.cpp
    symm_representation.cpp
    block_range.cpp
    perm_index.cpp
    transform_iterator.cpp
    bitset.cpp
    math_outer.cpp
    math_partial_reduce.cpp
    math_transpose.cpp
    math_blas.cpp
    tensor.cpp
    tensor_of_tensor.cpp
    tensor_tensor_view.cpp
    tensor_shift_wrapper.cpp
    tiled_range1.cpp
    tiled_range.cpp
    blocked_pmap.cpp
    hash_pmap.cpp
    cyclic_pmap.cpp
    replicated_pmap.cpp
    dense_shape.cpp
    sparse_shape.cpp
    distributed_storage.cpp
    tensor_impl.cpp
    array_impl.cpp
    variable_list.cpp
    dist_array.cpp
    conversions.cpp
    eigen.cpp
    dist_op_dist_cache.cpp
    dist_op_group.cpp
    dist_op_communicator.cpp
    tile_op_noop.cpp
    tile_op_scal.cpp
    dist_eval_array_eval.cpp
    dist_eval_unary_eval.cpp
    tile_op_add.cpp
    tile_op_scal_add.cpp
    tile_op_subt.cpp
    tile_op_scal_subt.cpp
    dist_eval_binary_eval.cpp
    tile_op_mult.cpp
    tile_op_scal_mult.cpp
    tile_op_contract_reduce.cpp
    reduce_task.cpp
    proc_grid.cpp
    dist_eval_contraction_eval.cpp
    expressions.cpp
    expressions_sparse.cpp
    expressions_complex.cpp
    expressions_btas.cpp
    expressions_mixed.cpp
    foreach.cpp
    solvers.cpp
    initializer_list.cpp
    diagonal_array.cpp
    retile.cpp
)

if(CUDA_FOUND)
    list(APPEND ta_test_src_files cutt.cpp expressions_cuda_um.cpp tensor_um.cpp)
endif()

if (TARGET TiledArray_SCALAPACK)
  list(APPEND ta_test_src_files scalapack.cpp)
endif(TARGET TiledArray_SCALAPACK)

# if tiledarray library was compiled without exceptions, use TA header-only (see below)
if (NOT TA_DEFAULT_ERROR EQUAL 1 AND NOT CUDA_FOUND)
  add_ta_executable(${executable} "${ta_test_src_files}" "MADworld;${TILEDARRAY_PRIVATE_LINK_LIBRARIES}")
  target_compile_definitions(${executable} PRIVATE TILEDARRAY_HEADER_ONLY=1)
  if (LAPACK_INCLUDE_DIRS)
    target_include_directories(${executable} PRIVATE ${LAPACK_INCLUDE_DIRS})
  endif(LAPACK_INCLUDE_DIRS)
  if (LAPACK_COMPILE_OPTIONS)
    target_compile_options(${executable} PRIVATE ${LAPACK_COMPILE_OPTIONS})
  endif(LAPACK_COMPILE_OPTIONS)
  if (LAPACK_COMPILE_DEFINITIONS)
    target_compile_definitions(${executable} PRIVATE ${LAPACK_COMPILE_DEFINITIONS})
  endif(LAPACK_COMPILE_DEFINITIONS)
else()
  add_ta_executable(${executable} "${ta_test_src_files}" "tiledarray")
endif()
# Add include directories and compiler flags for ta_test
target_include_directories(${executable} PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ${PROJECT_BINARY_DIR}/tests
    ${Boost_INCLUDE_DIRS}
    )
# unit tests
# 1. should disable error messages
# 2. must emit exceptions in asserts since some tests check for exceptions
target_compile_definitions(${executable} PRIVATE TILEDARRAY_NO_USER_ERROR_MESSAGES=1
    TA_EXCEPTION_ERROR=1 MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE=0)
# optional dependencies
if (TARGET range-v3::range-v3)
  target_link_libraries(${executable} PRIVATE range-v3::range-v3)
  target_compile_definitions(${executable} PRIVATE TILEDARRAY_HAS_RANGEV3=1)
endif (TARGET range-v3::range-v3)

# Add targets
add_test(build_${executable} "${CMAKE_COMMAND}" --build ${PROJECT_BINARY_DIR} --target ${executable})

# Add a test(s)
if(ENABLE_MPI)
  foreach(p RANGE 1 2)
    add_test(NAME ${executable}-np-${p}
      COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${p} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${executable}> --log_level=test_suite --show-progress ${MPIEXEC_POSTFLAGS})
    set_tests_properties(${executable}-np-${p} PROPERTIES DEPENDS build_${executable})
  endforeach(p)
else()
  add_test(NAME ${executable}
      COMMAND ${executable})
  set_tests_properties(${executable} PROPERTIES DEPENDS build_${executable})
endif()