@@ -68,11 +68,13 @@ option(ENABLE_CNPY "Enable cnpy usage" OFF)
6868cmake_dependent_option (ENABLE_ELPA "Enable ELPA for LCAO" ON "ENABLE_LCAO;ENABLE_MPI" OFF )
6969cmake_dependent_option (ENABLE_LIBRI "Enable LibRI for hybrid functional"
7070 OFF "ENABLE_LCAO;ENABLE_MPI" OFF )
71- cmake_dependent_option (ENABLE_EXX_DEV "Enable LibRI developing features" OFF "ENABLE_LIBRI" OFF )
7271cmake_dependent_option (ENABLE_PEXSI "Enable PEXSI for LCAO" OFF "ENABLE_LCAO;ENABLE_MPI" OFF )
7372cmake_dependent_option (ENABLE_MLALGO "Enable the machine learning algorithms"
7473 OFF "ENABLE_LCAO;ENABLE_MPI" OFF )
7574
75+ # EXX_DEV works with libRI PR#10 which is not merged into main branch; disabling it
76+ # cmake_dependent_option(ENABLE_EXX_DEV "Enable LibRI developing features" OFF "ENABLE_LIBRI" OFF)
77+
7678# Two-center FFT is only used in LCAO
7779cmake_dependent_option (ENABLE_FFT_TWO_CENTER "Enable FFT-based two-center integral method"
7880 ON "ENABLE_LCAO" OFF )
@@ -136,27 +138,6 @@ if(NOT DEFINED NVHPC_ROOT_DIR AND DEFINED ENV{NVHPC_ROOT})
136138 CACHE PATH "Path to NVIDIA HPC SDK root directory." )
137139endif ()
138140
139- # Feature definitions are collected while options and dependencies are resolved
140- # below. They are applied to targets in source/CMakeLists.txt.
141- set_property (GLOBAL PROPERTY ABACUS_FEATURE_DEFINITIONS "" )
142-
143- function (abacus_normalize_definitions out_var )
144- set (_defs)
145- foreach (_def IN LISTS ARGN)
146- if (_def MATCHES "^-D(.+)" )
147- list (APPEND _defs "${CMAKE_MATCH_1} " )
148- else ()
149- list (APPEND _defs "${_def} " )
150- endif ()
151- endforeach ()
152- set (${out_var} ${_defs} PARENT_SCOPE )
153- endfunction ()
154-
155- function (abacus_add_feature_definitions )
156- abacus_normalize_definitions (_defs ${ARGN} )
157- set_property (GLOBAL APPEND PROPERTY ABACUS_FEATURE_DEFINITIONS ${_defs} )
158- endfunction ()
159-
160141# enable json support
161142if (ENABLE_RAPIDJSON)
162143 find_package (RapidJSON CONFIG REQUIRED )
@@ -167,7 +148,6 @@ if(ENABLE_RAPIDJSON)
167148 "Check if your RapidJSON installation provides a complete exported CMake configuration."
168149 )
169150 endif ()
170- abacus_add_feature_definitions (__RAPIDJSON )
171151endif ()
172152
173153# get commit info
@@ -193,7 +173,6 @@ if(COMMIT_INFO)
193173 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR }
194174 RESULT_VARIABLE GIT_COMMIT_DATE_RESULT )
195175 if (GIT_COMMIT_HASH_RESULT EQUAL 0 AND GIT_COMMIT_DATE_RESULT EQUAL 0)
196- abacus_add_feature_definitions (COMMIT_INFO )
197176 file (WRITE "${CMAKE_CURRENT_BINARY_DIR } /commit.h"
198177 "#define COMMIT \" ${GIT_COMMIT_HASH} (${GIT_COMMIT_DATE} )\"\n " )
199178 set (ABACUS_COMMIT_INFO_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR } " )
@@ -272,14 +251,6 @@ if (USE_DSP)
272251 set (ABACUS_BIN_NAME abacus_dsp)
273252endif ()
274253
275- if (USE_CUDA_ON_DCU)
276- abacus_add_feature_definitions (__CUDA_ON_DCU )
277- endif ()
278-
279- if (USE_CUDA_MPI)
280- abacus_add_feature_definitions (__CUDA_MPI )
281- endif ()
282-
283254list (APPEND CMAKE_MODULE_PATH
284255 "${CMAKE_CURRENT_SOURCE_DIR } /cmake"
285256 "${PROJECT_SOURCE_DIR } /cmake/modules" )
@@ -346,58 +317,25 @@ if(ENABLE_ASAN)
346317 set (CMAKE_BUILD_TYPE "RelWithDebInfo" )
347318endif ()
348319
349- if (NOT CMAKE_BUILD_TYPE AND NOT MSVC )
350- add_compile_options (-O3 -g )
351- endif ()
352-
353320if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
354- # stick to strict floating point model on Intel Compiler
355- add_compile_options (-fp-model=strict )
356- set (ENABLE_ABACUS_LIBM OFF ) # Force turn off ENABLE_ABACUS_LIBM on Intel Compiler
357- set (CMAKE_CXX_FLAGS
358- "${CMAKE_CXX_FLAGS } -Wno-write-strings "
359- )
360- endif ()
361-
362- if (ENABLE_ABACUS_LIBM)
363- abacus_add_feature_definitions (__ABACUS_LIBM )
364- endif ()
365-
366- if (ENABLE_NATIVE_OPTIMIZATION)
367- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -march=native -mtune=native" )
368- endif ()
369-
370- # Windows (native build, e.g. MinGW-w64 or MSVC) portability defines:
371- # _USE_MATH_DEFINES - expose M_PI and friends from <cmath>
372- # NOMINMAX - stop <windows.h> defining min()/max() macros
373- # _CRT_SECURE_NO_WARNINGS - silence CRT "use _s function" deprecations
374- if (WIN32 )
375- abacus_add_feature_definitions (_USE_MATH_DEFINES NOMINMAX _CRT_SECURE_NO_WARNINGS )
321+ # Force turn off ENABLE_ABACUS_LIBM on Intel Compiler
322+ message (WARNING "ENABLE_ABACUS_LIBM is not available with Intel compilers; switching it off" )
323+ set (ENABLE_ABACUS_LIBM OFF )
376324endif ()
377325
378326if (ENABLE_LCAO)
379- abacus_add_feature_definitions (__LCAO )
380327 if (ENABLE_ELPA)
381328 find_package (ELPA REQUIRED )
382- abacus_add_feature_definitions (__ELPA )
383- endif ()
384- if (ENABLE_FFT_TWO_CENTER)
385- abacus_add_feature_definitions (USE_NEW_TWO_CENTER )
386329 endif ()
387330 if (ENABLE_PEXSI)
388331 find_package (PEXSI REQUIRED CONFIG )
389332 if (PEXSI_VERSION VERSION_LESS "2.0.0" )
390333 message (FATAL_ERROR "PEXSI >= 2.0.0 is required" )
391334 endif ()
392- abacus_add_feature_definitions (__PEXSI )
393335 set (CMAKE_CXX_STANDARD 14)
394336 endif ()
395337endif ()
396338
397- if (DEBUG_INFO)
398- abacus_add_feature_definitions (__DEBUG )
399- endif ()
400-
401339if (ENABLE_MPI)
402340 if (NOT CMAKE_CROSSCOMPILING )
403341 # FindMPI runs a probe executable to determine the MPI library version,
@@ -406,18 +344,9 @@ if(ENABLE_MPI)
406344 set (MPI_DETERMINE_LIBRARY_VERSION TRUE )
407345 endif ()
408346 find_package (MPI COMPONENTS CXX REQUIRED )
409- abacus_add_feature_definitions (__MPI )
410- endif ()
411-
412-
413- if (USE_DSP)
414- abacus_add_feature_definitions (__DSP )
415347endif ()
416348
417-
418-
419- if (USE_SW)
420- abacus_add_feature_definitions (__SW )
349+ if (USE_SW)
421350 set (SW ON )
422351endif ()
423352
@@ -440,10 +369,8 @@ if(USE_KML)
440369 endif ()
441370
442371 find_package (KML REQUIRED COMPONENTS ${_kml_components} )
443- abacus_add_feature_definitions (__KML )
444372elseif (MKLROOT OR MKL_ROOT)
445373 find_package (MKL REQUIRED )
446- abacus_add_feature_definitions (__MKL )
447374elseif (NOT USE_SW)
448375 find_package (Lapack REQUIRED )
449376 # ScaLAPACK is a distributed-memory library and is only needed for the
@@ -538,16 +465,7 @@ if(USE_CUDA)
538465 endif ()
539466 enable_language (CUDA )
540467 if (USE_CUDA)
541- abacus_add_feature_definitions (__CUDA )
542- abacus_add_feature_definitions (__UT_USE_CUDA )
543- if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
544- set (CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G" CACHE STRING "CUDA flags for debug build" FORCE )
545- endif ()
546- if (ENABLE_OPENMP AND OpenMP_CXX_FOUND)
547- set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS} " CACHE STRING "CUDA flags" FORCE )
548- endif ()
549468 if (ENABLE_NCCL_PARALLEL_DEVICE)
550- abacus_add_feature_definitions (__NCCL_PARALLEL_DEVICE )
551469 include (cmake/modules/SetupNccl.cmake )
552470 abacus_setup_nccl ()
553471 endif ()
@@ -616,9 +534,6 @@ if(USE_ROCM)
616534 )
617535 endif ()
618536
619- abacus_add_feature_definitions (__ROCM )
620- abacus_add_feature_definitions (__UT_USE_ROCM )
621- abacus_add_feature_definitions (__HIP_PLATFORM_HCC__ )
622537endif ()
623538
624539if (ENABLE_ASAN)
@@ -632,10 +547,6 @@ if(ENABLE_ASAN)
632547 add_link_options (-fsanitize=address )
633548endif ()
634549
635- if (ENABLE_FLOAT_FFTW)
636- abacus_add_feature_definitions (__ENABLE_FLOAT_FFTW )
637- endif ()
638-
639550if (ENABLE_MLALGO)
640551 find_path (libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR} )
641552 if (NOT libnpy_SOURCE_DIR )
@@ -648,8 +559,6 @@ if(ENABLE_MLALGO)
648559 FetchContent_MakeAvailable (libnpy)
649560 else ()
650561 endif ()
651-
652- abacus_add_feature_definitions (__MLALGO )
653562endif ()
654563
655564# Torch uses outdated components to detect CUDA arch, causing failure on
@@ -683,7 +592,6 @@ if (ENABLE_CNPY)
683592
684593 # find ZLIB and link
685594 find_package (ZLIB REQUIRED )
686- abacus_add_feature_definitions (__USECNPY )
687595endif ()
688596
689597function (git_submodule_update )
@@ -714,47 +622,29 @@ if(ENABLE_LIBRI)
714622 find_package (LibRI REQUIRED )
715623 find_package (LibComm REQUIRED )
716624 find_package (cereal REQUIRED CONFIG )
717- abacus_add_feature_definitions (__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0
718- TEST_EXX_RADIAL=1 )
719- if (ENABLE_EXX_DEV)
720- abacus_add_feature_definitions (__EXX_DEV )
721- endif ()
722625endif ()
723626
724627if (ENABLE_LIBXC)
725628 find_package (Libxc CONFIG REQUIRED )
726629 if (Libxc_VERSION VERSION_LESS "5.1.7" )
727630 message (FATAL_ERROR "Libxc >= 5.1.7 is required" )
728631 endif ()
729- abacus_add_feature_definitions (USE_LIBXC )
730632endif ()
731633
732634if (DEFINED DeePMD_DIR)
733- abacus_add_feature_definitions (__DPMD HIGH_PREC )
734- add_compile_options (-Wl,--no-as-needed )
735635 find_package (DeePMD REQUIRED )
736- if (DeePMDC_FOUND)
737- abacus_add_feature_definitions (__DPMDC )
738- endif ()
739636endif ()
740637
741638if (DEFINED NEP_DIR)
742639 find_package (NEP REQUIRED )
743-
744- if (NEP_FOUND)
745- abacus_add_feature_definitions (__NEP )
746- endif ()
747640endif ()
748641
749642if (DEFINED TensorFlow_DIR)
750643 find_package (TensorFlow REQUIRED )
751644endif ()
752645
753- abacus_add_feature_definitions (__FFTW3 __SELINV METIS )
754-
755646if (MATH_INFO)
756647 message (STATUS "Will gather math lib info." )
757- abacus_add_feature_definitions (GATHER_INFO )
758648 # modifications on blas_connector and lapack_connector
759649endif ()
760650
0 commit comments