Skip to content

Commit bb8a90f

Browse files
authored
CMake: Move __DFTD4 to global feature definitions (#7793)
* CMake: Move __DFTD4 to global feature definitions * Add dftd4 status to CMake build summary and `abacus -i`
1 parent e3c29e9 commit bb8a90f

6 files changed

Lines changed: 22 additions & 10 deletions

File tree

cmake/CollectBuildInfoVars.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ else()
187187
set(ABACUS_LIBXC_VERSION "no")
188188
endif()
189189

190+
if(ENABLE_DFTD4)
191+
set(ABACUS_DFTD4_VERSION "yes (v${dftd4_VERSION})")
192+
else()
193+
set(ABACUS_DFTD4_VERSION "no")
194+
endif()
195+
190196
# Accelerators
191197
if(USE_CUDA AND CUDAToolkit_VERSION)
192198
set(ABACUS_CUDA_VERSION "yes (v${CUDAToolkit_VERSION})")
@@ -451,6 +457,7 @@ message(" LibRI = ${ABACUS_LIBRI_VERSION}")
451457
if(ENABLE_EXX_DEV)
452458
message(" (EXX developing features enabled)")
453459
endif()
460+
message(" DFT-D4 = ${ABACUS_DFTD4_VERSION}")
454461
message(" RAPIDJSON = ${ABACUS_RAPIDJSON_VERSION}")
455462
message(" PEXSI = ${ABACUS_PEXSI_VERSION}")
456463
message(" CNPY = ${ABACUS_CNPY_VERSION}")

source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ set(_abacus_feature_definitions
6767
$<$<BOOL:${ENABLE_LIBRI}>:TEST_EXX_RADIAL=1>
6868
$<$<BOOL:${ENABLE_EXX_DEV}>:__EXX_DEV>
6969
$<$<BOOL:${ENABLE_LIBXC}>:__LIBXC>
70+
$<$<BOOL:${ENABLE_DFTD4}>:__DFTD4>
7071
$<$<BOOL:${MATH_INFO}>:GATHER_INFO>)
7172

7273
if(ABACUS_COMMIT_INFO_INCLUDE_DIR)

source/source_hamilt/module_vdw/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ add_library(vdw OBJECT ${vdw_sources})
1717

1818
if(ENABLE_DFTD4)
1919
target_link_libraries(vdw PUBLIC dftd4::dftd4)
20-
target_compile_definitions(vdw PUBLIC __DFTD4)
2120
endif()
2221

2322
if(ENABLE_COVERAGE)

source/source_hamilt/module_vdw/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ AddTest(
1212
)
1313

1414
if(ENABLE_DFTD4)
15-
target_compile_definitions(MODULE_HAMILT_vdwTest PRIVATE __DFTD4)
1615
target_link_libraries(MODULE_HAMILT_vdwTest PRIVATE dftd4::dftd4)
1716
endif()

source/source_io/build_info.h.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@
5050
#define ABACUS_NEP_VERSION "@ABACUS_NEP_VERSION@"
5151
#define ABACUS_TENSORFLOW_VERSION "@ABACUS_TENSORFLOW_VERSION@"
5252

53-
// --- Testing & Other Libraries ---
54-
#define ABACUS_GTEST_VERSION "@ABACUS_GTEST_VERSION@"
55-
#define ABACUS_GOOGLEBENCH_VERSION "@ABACUS_GOOGLEBENCH_VERSION@"
53+
// --- Other Libraries ---
54+
#define ABACUS_DFTD4_VERSION "@ABACUS_DFTD4_VERSION@"
5655
#define ABACUS_RAPIDJSON_VERSION "@ABACUS_RAPIDJSON_VERSION@"
5756
#define ABACUS_PEXSI_VERSION "@ABACUS_PEXSI_VERSION@"
5857
#define ABACUS_CNPY_VERSION "@ABACUS_CNPY_VERSION@"
5958

59+
// --- Testing ---
60+
#define ABACUS_GTEST_VERSION "@ABACUS_GTEST_VERSION@"
61+
#define ABACUS_GOOGLEBENCH_VERSION "@ABACUS_GOOGLEBENCH_VERSION@"
62+
6063
#endif // SOURCE_IO_BUILD_INFO_H

source/source_io/parse_args.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,18 @@ void print_build_info()
162162
print_info("NEP Support", ABACUS_NEP_VERSION);
163163
print_info("TensorFlow Support", ABACUS_TENSORFLOW_VERSION);
164164

165-
// --- 11. Testing & Other Libraries ---
166-
print_section("Testing & Other Libraries");
167-
print_info("GTest Support", ABACUS_GTEST_VERSION);
168-
print_info("Google Benchmark", ABACUS_GOOGLEBENCH_VERSION);
165+
// --- 11. Other Libraries ---
166+
print_section("Other Libraries");
167+
print_info("DFT-D4 Support", ABACUS_DFTD4_VERSION);
169168
print_info("RapidJSON Support", ABACUS_RAPIDJSON_VERSION);
170169
print_info("PEXSI Support", ABACUS_PEXSI_VERSION);
171170
print_info("cnpy Support", ABACUS_CNPY_VERSION);
172171

173-
std::cout << "----------------------------------------------------" << std::endl;
172+
// --- 12. Testing ---
173+
print_section("Testing");
174+
print_info("GTest Support", ABACUS_GTEST_VERSION);
175+
print_info("Google Benchmark", ABACUS_GOOGLEBENCH_VERSION);
176+
174177
std::cout << std::endl;
175178
}
176179

0 commit comments

Comments
 (0)