restructuring of cmake for shared + project-targets

This commit is contained in:
Nick R. Papior 2024-06-19 07:16:02 +00:00
parent 1a4c291d4d
commit 3f8be9c16a
64 changed files with 1151 additions and 835 deletions

View File

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
# CMAKE_MODULE_PATH is locally searched for *.cmake files
# before CMAKE_PREFIX_PATH.
# We will prefer to use CMAKE_MODULE_PATH
@ -45,7 +46,7 @@ else()
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
include(SiestaBlockLegacyOptions)
endif()
#
# Compiler flags
include(SiestaFlags)
@ -55,10 +56,24 @@ include(SiestaFlags)
# generally they don't need to be touched, but it can be useful
# when siesta is used as a submodule.
option(SIESTA_TESTS "Siesta: Build test-suite" ${PROJECT_IS_TOP_LEVEL})
option(SIESTA_SHARED_LIBS "Siesta: Build as a shared library" ${PROJECT_IS_TOP_LEVEL})
option(BUILD_SHARED_LIBS "Siesta: Build using shared libraries" FALSE)
option(SIESTA_SHARED_LIBS "Siesta: Build as a shared library" "${BUILD_SHARED_LIBS}")
if( SIESTA_SHARED_LIBS )
include(CheckPIESupported)
check_pie_supported()
message(STATUS "Enabling position independent code")
# Ensure BUILD_SHARED_LIBS is set
set(BUILD_SHARED_LIBS ON CACHE BOOL "Building shared libs" FORCE)
elseif( BUILD_SHARED_LIBS )
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Building shared libs" FORCE)
endif()
option(SIESTA_INSTALL "Siesta: Install project" ${PROJECT_IS_TOP_LEVEL})
# this should be advanced, as it is primarily useful for users of Siesta as a
# sub-project.
mark_as_advanced(BUILD_SHARED_LIBS)
mark_as_advanced(SIESTA_INSTALL SIESTA_TESTS SIESTA_SHARED_LIBS)
option(SIESTA_WITH_GRID_SP "Siesta: Use single-precision for grid magnitudes" FALSE)
@ -315,11 +330,13 @@ if(NOT LIBPSML_USES_PROCEDURE_POINTER )
# Work around bug in shared library linking
# This should only temporarily be a hack since future
# psml versions will always rely on procedure pointers
add_library(${PROJECT_NAME}-psml_wrappers
siesta_add_library(
${PROJECT_NAME}.psml_wrappers
NO_LINKER_FLAGS
STATIC
"${CMAKE_CURRENT_SOURCE_DIR}/Src/psml_wrappers.F90"
)
siesta_suffix_uninstall()
# One cannot use OBJECT libraries as their objects are not
@ -327,7 +344,7 @@ if(NOT LIBPSML_USES_PROCEDURE_POINTER )
# name-collisions for static libraries.
target_link_libraries(libpsml::libpsml
INTERFACE
${PROJECT_NAME}-psml_wrappers
${PROJECT_NAME}.psml_wrappers
)
endif()
@ -355,19 +372,21 @@ if (NOT TARGET libgridxc::libgridxc)
find_package(CustomLibGridxc REQUIRED)
endif()
if(NOT LIBGRIDXC_USES_PROCEDURE_POINTER)
siesta_suffix_install()
add_library(${PROJECT_NAME}-gridxc_wrappers
siesta_add_library(
${PROJECT_NAME}.gridxc_wrappers
NO_LINKER_FLAGS
STATIC
"${CMAKE_CURRENT_SOURCE_DIR}/Src/gridxc_wrappers.F90"
)
siesta_suffix_uninstall()
target_link_libraries(libgridxc::libgridxc
INTERFACE
${PROJECT_NAME}-gridxc_wrappers
${PROJECT_NAME}.gridxc_wrappers
)
endif()
@ -462,10 +481,6 @@ siesta_suffix_install()
if( SIESTA_WITH_MPI )
# optional mpi-siesta library
add_subdirectory("Src/MPI")
# This is the safest to have a simple unified approach
# I.e. namespaces for modules
# To be done for all
add_library(Siesta::MPI ALIAS mpi_siesta)
endif()
add_subdirectory("Src/libsys")
@ -480,9 +495,9 @@ if( SIESTA_WITH_NCDF )
endif()
if( SIESTA_WITH_PROFILE_NVTX )
add_library(nvtx-c INTERFACE IMPORTED)
target_link_libraries(nvtx-c INTERFACE ${CMAKE_DL_LIBS})
set_target_properties(nvtx-c
add_library(${PROJECT_NAME}.nvtx-c INTERFACE IMPORTED)
target_link_libraries(${PROJECT_NAME}.nvtx-c INTERFACE ${CMAKE_DL_LIBS})
set_target_properties(${PROJECT_NAME}.nvtx-c
PROPERTIES
INTERFACE_LINK_LIBRARIES
"${PROFILE_NVTX_LIBRARY}")
@ -534,8 +549,9 @@ siesta_print_start_section("Siesta build")
siesta_print_feature_info(
NAME ${PROJECT_NAME}
TARGETS
SIESTA::siesta_exe
SIESTA::libsiesta
${PROJECT_NAME}::siesta
${PROJECT_NAME}::libsiesta
${PROJECT_NAME}::libhsx
VARIABLES
SIESTA_WITH_UNIT_CONVENTION
SIESTA_WITH_MPI
@ -552,6 +568,7 @@ siesta_print_feature_info(
SIESTA_WITH_ELPA
SIESTA_WITH_FLOOK
SIESTA_INSTALL
BUILD_SHARED_LIBS
SIESTA_SHARED_LIBS
SIESTA_LINKER_FLAGS_PRE
SIESTA_LINKER_FLAGS_POST

View File

@ -32,6 +32,7 @@ set(SIESTA_LINKER_FLAGS_POST "" CACHE STRING
set(SIESTA_LINKER_FLAGS "" CACHE STRING
"User defined linker flags appended to the linker line (short for SIESTA_LINKER_FLAGS_POST)")
message(STATUS "Using ${CMAKE_Fortran_COMPILER_ID} compiler")
if(CMAKE_Fortran_COMPILER_ID MATCHES Intel|IntelLLVM)
set(_toolchain "intel")
@ -131,5 +132,16 @@ endif()
# For tagging in version-info.inc
#
string(TOUPPER ${CMAKE_BUILD_TYPE} _buildtype_upper)
set(Fortran_FLAGS_CURRENT ${CMAKE_Fortran_FLAGS}
${CMAKE_Fortran_FLAGS_${_buildtype_upper}})
set(Fortran_FLAGS_CURRENT
${CMAKE_Fortran_FLAGS}
${CMAKE_Fortran_FLAGS_${_buildtype_upper}}
)
# A final check for RPATH stuff
# When requesting the link path to be used as an RPATH
# it will automatically add the install-libdir to the rpath
if( CMAKE_INSTALL_RPATH_USE_LINK_PATH AND CMAKE_INSTALL_PREFIX )
message(STATUS "Prepending CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_LIBDIR to CMAKE_INSTALL_RPATH")
list(PREPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()

View File

@ -223,6 +223,15 @@ function(siesta_print_feature_info)
endif()
macro(_print_property_list)
foreach(prop IN LISTS ${ARGV})
get_target_property(out "${_target}" ${prop})
if(NOT "${out}" STREQUAL "out-NOTFOUND")
message(DEBUG "${prop}=${out}")
endif()
endforeach()
endmacro()
if(DEFINED _pi_TARGETS)
message(DEBUG "Defined targets:")
@ -243,23 +252,52 @@ function(siesta_print_feature_info)
list(APPEND CMAKE_MESSAGE_INDENT " * ")
# Get the type to check which variables are available
set(_props
NAME
TYPE
VERSION
)
_print_property_list(_props)
get_target_property(type ${_target} TYPE)
message(DEBUG "TYPE=${type}")
# global properties
set(_props
ALIAS_GLOBAL
ALIASED_TARGET
C_EXTENSIONS
C_STANDARD
COMPILE_DEFINITIONS
COMPILE_FLAGS
CXX_EXTENSIONS
CXX_MODULE_DIRS
CXX_STANDARD
Fortran_MODULE_DIRECTORY
IMPORTED
IMPORTED_GLOBAL
IMPORTED_LIBNAME
IMPORTED_LINK_INTERFACE_LIBRARIES
INCLUDE_DIRECTORIES
INTERFACE_COMPILE_DEFINITIONS
INTERFACE_LINK_DEPENDS
INTERFACE_LINK_DIRECTORIES
INTERFACE_LINK_LIBRARIES
INTERFACE_LINK_LIBRARIES_DIRECT
INTERFACE_LINK_OPTIONS
INTERFACE_POSITION_INDEPENDENT_CODE
INTERFACE_SOURCES
INTERPROCEDURAL_OPTIMIZATION
INSTALL_RPATH
INSTALL_RPATH_USE_LINK_PATH
LINK_INTERFACE_LIBRARIES
LINK_LIBRARIES
POSITION_INDEPENDENT_CODE
)
if("${type}" STREQUAL "INTERFACE_LIBRARY")
# interface library properties
get_target_property(_interface_libraries ${_target} INTERFACE_LINK_LIBRARIES)
list(APPEND _props
INTERFACE_COMPILE_DEFINITIONS
INTERFACE_LINK_DIRECTORIES
INTERFACE_LINK_LIBRARIES
)
else()
@ -268,31 +306,21 @@ function(siesta_print_feature_info)
get_target_property(_interface_libraries ${_target} LINK_INTERFACE_LIBRARIES)
list(APPEND _props
BINARY_DIR
C_STANDARD
COMPILE_DEFINITIONS
CXX_EXTENSIONS
CXX_MODULE_DIRS
CXX_STANDARD
Fortran_MODULE_DIRECTORY
EXCLUDE_FROM_ALL
IMPORTED_LIBNAME
IMPORTED_LINK_DEPENDENT_LIBRARIES
IMPORTED_LINK_INTERFACE_LIBRARIES
IMPORTED_LOCATION
INCLUDE_DIRECTORIES
IMPORTED_OBJECTS
LINK_DEPENDS
LINK_INTERFACE_LIBRARIES
LINK_LIBRARIES
LINK_OPTIONS
OUTPUT_NAME
VERSION
)
endif()
foreach(prop IN LISTS _props)
get_target_property(out "${_target}" ${prop})
if(NOT "${out}" STREQUAL "out-NOTFOUND")
message(DEBUG "${prop}=${out}")
endif()
endforeach()
list(SORT _props)
_print_property_list(_props)
# prepare next target (nested)
list(POP_BACK CMAKE_MESSAGE_INDENT)

View File

@ -129,8 +129,8 @@ function(siesta_suffix)
if(NOT ${defined})
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: none of ${options} are defined, please at least supply one.")
endif()
foreach(var IN LISTS _esop_VARIABLES)
set(cmake_var "CMAKE_${var}_SUFFIX")
@ -284,26 +284,161 @@ endfunction()
# the target creation.
#
# This functionality basically does:
# add_executable|library(name ... )
# target_link_libraries(name
# ${SIESTA_LINKER_FLAGS_PRE})
# <return action to owner>
# target_link_libraries(name
# ${SIESTA_LINKER_FLAGS_POST}
# ${SIESTA_LINKER_FLAGS})
#
# However, these wrappers are just to streamline
# this process.
# This will only work in 3.19 and later due to DEFER.
#
# A word of notice.
# The implementation for
# - siesta_add_executable
# - siesta_add_library
# are basically equivalent (except the native add_* call).
macro(siesta_add_linker_flags)
# Only 1 argument in this macro
cmake_parse_arguments(_siesta_alf
""
"TARGET" # single arguments
"" # multi-key arguments
${ARGN})
if( NOT DEFINED _siesta_alf_TARGET )
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: called siesta_add_linker_flags without TARGET argument")
endif()
# Retrieve the target name
message(DEBUG "${CMAKE_CURRENT_FUNCTION}: Adding pre/post linker flags for ${_siesta_alf_TARGET}")
list(LENGTH _siesta_alf_UNPARSED_ARGUMENTS _siesta_alf_nargs)
if(_siesta_alf_nargs GREATER 0)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: called siesta_add_linker_flags with too many arguments")
endif()
# Note that we default to add the PUBLIC note below.
# This forces the definition of the target to contain
# PUBLIC | PRIVATE | OBJECT | INTERFACE
target_link_libraries(
${_siesta_alf_TARGET}
PUBLIC
${SIESTA_LINKER_FLAGS_PRE}
)
# Create a deferred call when the current directory is left
# Deferred calls are delayed until the final parsing.
# This means we have to run an EVAL on the call
cmake_language(EVAL CODE
"cmake_language(DEFER CALL
target_link_libraries
${_siesta_alf_TARGET}
PUBLIC
${SIESTA_LINKER_FLAGS_POST}
${SIESTA_LINKER_FLAGS})"
)
endmacro()
# Wrapper for add_executable
# Allows for easy creation of additional targets (custom/namespace).
# It also allows to add the PRE/POST linker flags implicitly.
# There are a few arguments:
# NO_LINKER_FLAGS [option]: bypasses the addition of PRE/POST_LINKER_FLAGS
# If not set, will call siesta_add_linker_flags(<target>)
# CUSTOM_TARGET <value>: defines an additional custom-target that depends on TARGET
# NAMESPACE_TARGET <value>: defines an additional namespace target ${PROJECT_NAME}::<value> that aliases TARGET [defaults to s/${PROJECT_NAME}.\(.*\)/\1/]
# EXPORT_NAME <value>: specifies the EXPORT_NAME property for the target [defaults to s/${PROJECT_NAME}.\(.*\)/\1/]
# OUTPUT_NAME <value>: specifies the OUTPUT_NAME property for the target [defaults to s/${PROJECT_NAME}.\(.*\)/\1/]
function(siesta_add_executable)
cmake_parse_arguments(_sa
"NO_LINKER_FLAGS;NO_NAMESPACE_TARGET;NO_OUTPUT_NAME;NO_EXPORT_NAME" # options
"TARGET;CUSTOM_TARGET;NAMESPACE_TARGET;EXPORT_NAME;OUTPUT_NAME" # single arguments
"" # multi-key arguments
${ARGN})
if( NOT DEFINED _sa_TARGET )
list(POP_FRONT _sa_UNPARSED_ARGUMENTS _sa_TARGET)
endif()
# get short target name (context need not contain PROJECT_NAME)
string(REPLACE "${PROJECT_NAME}." "" _sa_TARGET_SHORT ${_sa_TARGET})
list(APPEND CMAKE_MESSAGE_CONTEXT "${_sa_TARGET_SHORT}")
message(DEBUG "${CMAKE_CURRENT_FUNCTION} adding target: ${_sa_TARGET}")
list(APPEND CMAKE_MESSAGE_INDENT " - ")
add_executable(${_sa_TARGET} ${_sa_UNPARSED_ARGUMENTS})
if( _sa_NO_LINKER_FLAGS )
message(DEBUG "will not add linker flags to ${_sa_TARGET}")
else()
siesta_add_linker_flags(TARGET ${_sa_TARGET})
endif()
if( (NOT NO_EXPORT_NAME) AND (NOT DEFINED _sa_EXPORT_NAME) )
set(_sa_EXPORT_NAME ${_sa_TARGET_SHORT})
endif()
if( DEFINED _sa_EXPORT_NAME )
message(DEBUG "EXPORT_NAME: ${_sa_EXPORT_NAME}")
set_target_properties(${_sa_TARGET}
PROPERTIES
EXPORT_NAME ${_sa_EXPORT_NAME}
)
endif()
if( (NOT NO_OUTPUT_NAME) AND (NOT DEFINED _sa_OUTPUT_NAME) )
set(_sa_OUTPUT_NAME ${_sa_TARGET_SHORT})
endif()
if( DEFINED _sa_OUTPUT_NAME )
message(DEBUG "OUTPUT_NAME: ${_sa_OUTPUT_NAME}")
set_target_properties(${_sa_TARGET}
PROPERTIES
OUTPUT_NAME ${_sa_OUTPUT_NAME}
)
endif()
if( DEFINED _sa_CUSTOM_TARGET )
message(DEBUG "CUSTOM_TARGET: ${_sa_CUSTOM_TARGET}")
add_custom_target(${_sa_CUSTOM_TARGET} DEPENDS ${_sa_TARGET})
endif()
if( (NOT NO_NAMESPACE_TARGET) AND (NOT DEFINED _sa_NAMESPACE_TARGET) )
set(_sa_NAMESPACE_TARGET ${_sa_TARGET_SHORT})
endif()
if( DEFINED _sa_NAMESPACE_TARGET )
message(DEBUG "NAMESPACE_TARGET: ${PROJECT_NAME}::${_sa_NAMESPACE_TARGET}")
add_executable(${PROJECT_NAME}::${_sa_NAMESPACE_TARGET} ALIAS ${_sa_TARGET})
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
endfunction()
# Wrapper for add_library
# Allows for easy creation of additional targets (custom/namespace).
# It also allows to add the PRE/POST linker flags implicitly.
# There are a few arguments:
# NO_LINKER_FLAGS [option]: bypasses the addition of PRE/POST_LINKER_FLAGS
# If not set, will call siesta_add_linker_flags(<target>)
# CUSTOM_TARGET <value>: defines an additional custom-target that depends on TARGET
# NAMESPACE_TARGET <value>: defines an additional namespace target ${PROJECT_NAME}::<value> that aliases TARGET
#
# There is an option to decide whether subsequent target_link_libraries
# There is a an implicit addition of PIC for libraries as TYPE=OBJECT|STATIC libraries.
# This is necessary because the OBJECT|STATIC libraries are generally internal libraries
# that will be linked in the end.
# While this is not necessary for creating executables (no PIC is required)
# it is important for libsiesta and other public libraries.
# The PIC will only be added in case BUILD_SHARED_LIBS is set to TRUE.
# Otherwise the above consideration will not be applicable.
#
# NOTE:
# There is NOT an option to decide whether subsequent target_link_libraries
# requires the PUBLIC interface.
# The cmake error messages looks like this:
# The cmake error messages would look like this:
#
# The keyword signature for target_link_libraries has already been used with
# the target "<target>". All uses of target_link_libraries with a
@ -316,85 +451,149 @@ endfunction()
#
# In this case we need to know on beforehand how to use it.
# By default we expect the 2nd invocation for all subsequent calls.
# If this is not the case the siesta_add_* should have the option:
#
# ALL_PLAIN
# A word of caution on using OBJECT libraries.
# Generally dependencies of target libraries are propagated to its dependencies.
# Hence:
#
# They both accept some keyword arguments for creating additional targets:
# CUSTOM_TARGET <name>
# creates a new custom-target that depends on the initial target.
# NAMESPACE_TARGET <name>
# adds the target SIESTA::<name>
# add_library(foo OBJECT ...)
# target_link_libraries(foo PUBLIC bar)
#
macro(siesta_add_internal)
# 1 option
# 1 argument FUNC = add_library|add_executable
# Only 1 argument in this macro
cmake_parse_arguments(_siesta_add
"ALL_PLAIN" # options
"SIESTA_ADD_FUNC;CUSTOM_TARGET;NAMESPACE_TARGET" # single arguments
# add_executable(fooexe ...)
# target_link_libraries(fooexe PRIVATE foo)
#
# would yield different results whether it was an OBJECT or *anything else*.
# The problem arises because *object* libraries are handled as static things
# and thus INTERFACE_LIBRARIES are not propagated.
# See here:
# https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT.html#direct-link-dependencies-as-usage-requirements
# This is indeed very weird.
# An OBJECT library's requirements would however transition to consumers,
# and thus definitions etc. would work. However, for the OBJECT libraries
# dependencies, one would have to do something like this:
#
# target_link_libraries(foo PUBLIC bar $<TARGET_OBJECTS:bar>)
#
# Once for the definitions etc., and once for the actual objects
# to propagate to consumers of `foo`.
# However, this becomes problematic when multiple libraries
# consumes `foo` and are then consumed in another executable:
#
# add_executable(foobar foo another_foo_depends_on_bar)
#
# This would result in object files multiple times on the linker
# line... Yielding too many names for resolution.
function(siesta_add_library)
cmake_parse_arguments(_sa
"NO_LINKER_FLAGS;NO_NAMESPACE_TARGET;NO_OUTPUT_NAME;NO_EXPORT_NAME" # options
"TARGET;CUSTOM_TARGET;NAMESPACE_TARGET;EXPORT_NAME;OUTPUT_NAME" # single arguments
"" # multi-key arguments
${ARGN})
# Retrieve the target name
list(GET _siesta_add_UNPARSED_ARGUMENTS 0 _siesta_add_target)
message(DEBUG "${CMAKE_CURRENT_FUNCTION}: Adding pre/post linker flags: ${_siesta_add_target}")
# Extract the unparsed arguments
message(TRACE "${CMAKE_CURRENT_FUNCTION}: ${_siesta_add_UNPARSED_ARGUMENTS}")
# Run the add_executable
cmake_language(CALL ${_siesta_add_SIESTA_ADD_FUNC} ${_siesta_add_UNPARSED_ARGUMENTS})
if( DEFINED _siesta_add_CUSTOM_TARGET )
add_custom_target(${_siesta_add_CUSTOM_TARGET} DEPENDS ${_siesta_add_target})
# This is a macro, we have to clean stuff
unset(_siesta_add_CUSTOM_TARGET)
endif()
if( DEFINED _siesta_add_NAMESPACE_TARGET )
cmake_language(CALL ${_siesta_add_SIESTA_ADD_FUNC} SIESTA::${_siesta_add_NAMESPACE_TARGET} ALIAS ${_siesta_add_target})
# This is a macro, we have to clean stuff
unset(_siesta_add_NAMESPACE_TARGET)
if( NOT DEFINED _sa_TARGET )
list(POP_FRONT _sa_UNPARSED_ARGUMENTS _sa_TARGET)
endif()
# Define the dependencies
if( _siesta_add_ALL_PLAIN )
set(_siesta_add_ADD_ARG "")
# get short target name (context need not contain PROJECT_NAME)
string(REPLACE "${PROJECT_NAME}." "" _sa_TARGET_SHORT ${_sa_TARGET})
list(APPEND CMAKE_MESSAGE_CONTEXT "${_sa_TARGET_SHORT}")
message(DEBUG "${CMAKE_CURRENT_FUNCTION} adding target: ${_sa_TARGET}")
list(APPEND CMAKE_MESSAGE_INDENT " - ")
add_library(${_sa_TARGET} ${_sa_UNPARSED_ARGUMENTS})
# Check whether we should add position independent code.
# This is necessary since OBJECT libraries will not add this
# implicitly...
get_target_property(target_type ${_sa_TARGET} TYPE)
if( SIESTA_SHARED_LIBS )
if( "${target_type}" STREQUAL "OBJECT_LIBRARY" OR
"${target_type}" STREQUAL "STATIC_LIBRARY")
set_target_properties(${_sa_TARGET} PROPERTIES
POSITION_INDEPENDENT_CODE ${SIESTA_SHARED_LIBS}
)
endif()
endif()
if( _sa_NO_LINKER_FLAGS )
message(DEBUG "will not add linker flags to ${_sa_TARGET}")
else()
set(_siesta_add_ADD_ARG "PUBLIC")
siesta_add_linker_flags(TARGET ${_sa_TARGET})
endif()
target_link_libraries(${_siesta_add_target}
${_siesta_add_ADD_ARG}
${SIESTA_LINKER_FLAGS_PRE}
)
if( (NOT NO_EXPORT_NAME) AND (NOT DEFINED _sa_EXPORT_NAME) )
set(_sa_EXPORT_NAME ${_sa_TARGET_SHORT})
endif()
if( DEFINED _sa_EXPORT_NAME )
message(DEBUG "EXPORT_NAME: ${_sa_EXPORT_NAME}")
set_target_properties(${_sa_TARGET}
PROPERTIES
EXPORT_NAME ${_sa_EXPORT_NAME}
)
endif()
if( (NOT NO_OUTPUT_NAME) AND (NOT DEFINED _sa_OUTPUT_NAME) )
set(_sa_OUTPUT_NAME ${_sa_TARGET_SHORT})
endif()
if( DEFINED _sa_OUTPUT_NAME )
message(DEBUG "OUTPUT_NAME: ${_sa_OUTPUT_NAME}")
set_target_properties(${_sa_TARGET}
PROPERTIES
OUTPUT_NAME ${_sa_OUTPUT_NAME}
)
endif()
# Create a deferred call when the current directory is left
# Deferred calls are delayed until the final parsing.
# This means we have to run an EVAL on the call
cmake_language(EVAL CODE
"cmake_language(DEFER CALL
target_link_libraries
${_siesta_add_target}
${_siesta_add_ADD_ARG}
${SIESTA_LINKER_FLAGS_POST}
${SIESTA_LINKER_FLAGS})"
)
if( DEFINED _sa_CUSTOM_TARGET )
message(DEBUG "CUSTOM_TARGET: ${_sa_CUSTOM_TARGET}")
add_custom_target(${_sa_CUSTOM_TARGET} DEPENDS ${_sa_TARGET})
endif()
endmacro()
if( (NOT NO_NAMESPACE_TARGET) AND (NOT DEFINED _sa_NAMESPACE_TARGET) )
set(_sa_NAMESPACE_TARGET ${_sa_TARGET_SHORT})
endif()
if( DEFINED _sa_NAMESPACE_TARGET )
message(DEBUG "NAMESPACE_TARGET: ${PROJECT_NAME}::${_sa_NAMESPACE_TARGET}")
add_library(${PROJECT_NAME}::${_sa_NAMESPACE_TARGET} ALIAS ${_sa_TARGET})
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
# Short-hand macros
macro(siesta_add_executable)
set(old_CMAKE_CURRENT_FUNCTION "${CMAKE_CURRENT_FUNCTION}")
set(CMAKE_CURRENT_FUNCTION "siesta_add_executable")
siesta_add_internal(SIESTA_ADD_FUNC add_executable ${ARGV})
set(CMAKE_CURRENT_FUNCTION "${old_CMAKE_CURRENT_FUNCTION}")
endmacro()
endfunction()
macro(siesta_add_library)
set(old_CMAKE_CURRENT_FUNCTION "${CMAKE_CURRENT_FUNCTION}")
set(CMAKE_CURRENT_FUNCTION "siesta_add_library")
siesta_add_internal(SIESTA_ADD_FUNC add_library ${ARGV})
set(CMAKE_CURRENT_FUNCTION "${old_CMAKE_CURRENT_FUNCTION}")
endmacro()
# Debugging function to extract and print properties of targets
function(siesta_debug_print_properties)
cmake_parse_arguments(_sd
"" # options
"TARGET" # single arguments
"PROPERTIES" # multi-key arguments
${ARGN})
# Get default suffix
if(NOT DEFINED _sd_TARGET)
list(LENGTH _sd_UNPARSED_ARGUMENTS nargs)
if(nargs GREATER 0)
list(POP_FRONT _sd_UNPARSED_ARGUMENTS _sd_TARGET)
endif()
endif()
list(APPEND CMAKE_MESSAGE_CONTEXT "SD")
message(DEBUG "Exploring properties for target: ${_sd_TARGET}")
list(APPEND CMAKE_MESSAGE_INDENT " ")
foreach(prop IN LISTS _sd_PROPERTIES)
get_target_property(prop_var
${_sd_TARGET}
${prop}
)
message(DEBUG "${prop} = ${prop_var}")
endforeach()
list(POP_BACK CMAKE_MESSAGE_INDENT)
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
endfunction()

View File

@ -145,7 +145,7 @@ endif()
configure_file(
setup.make.in
${CMAKE_CURRENT_BINARY_DIR}/setup.make
"${CMAKE_CURRENT_BINARY_DIR}/setup.make"
@ONLY
)

View File

@ -6,7 +6,19 @@ CC = @CMAKE_C_COMPILER@
FC = @CMAKE_Fortran_COMPILER@
CFLAGS = @CMAKE_C_FLAGS@
FFLAGS = @CMAKE_Fortran_FLAGS@
#
# This will only partially fix the problem.
# It still won't work when lua is not compiled with fPIC
# So basically an external LUA is required for this to work (*maybe*)
ifeq (,$(findstring @SIESTA_SHARED_LIBS@,no No NO off Off OFF false False FALSE 0))
PIC = 1
# SYSCFLAGS is found in aotus/external/lua-*/src/Makefile
# and can be used to add system flags to the compilation step.
# However, aotus is currently not pushing that to the compilation
# backend.
SYSCFLAGS = -fPIC
endif
.f90.o:
$(FC) -c $(FFLAGS) $(INC) $<
.F90.o:

View File

@ -473,6 +473,14 @@ you can set the `LUA_DIR` *environment* variable to the directory containing
`lib/liblua.*`. Then, flook will not compile its own version of lua and
will use the provided one.
Note: Currently FLOOK cannot be compiled in the submodule to be usable
as a shared library. Hence, if you need flook, then:
SIESTA_SHARED_LIBS=OFF
must be used (default).
#### Wannier90 "wrapper-library" interface
A wrapper interface between Siesta and wannier90 (version 3.1.0) so
@ -503,6 +511,23 @@ If you enable this feature you might consider adding the variable
`SIESTA_SUFFIX=_grid_sp` so that the Siesta executable and libraries
are properly tagged in this case.
### Shared libraries
It is possible to build Siesta in *shared* library mode.
Simply pass:
```
cmake ... -DSIESTA_SHARED_LIBS=ON
```
and everything will be compiled in shared mode.
This will not set the runtime paths (RPATH) of the executables/libraries.
If you want the installed targets to have the runtime path specified
simply add `-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON` as well.
Note: FLOOK does *not* work with shared library mode.
### Profiling
Support for profiling is overloaded in the "timer" interface. The currently enabled

View File

@ -1,22 +1,23 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_executable(psml2psf
siesta_add_executable(${PROJECT_NAME}.psml2psf
${top_src_dir}/m_getopts.f90
psml2psf.f90
)
target_link_libraries(
psml2psf
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libsys
${PROJECT_NAME}.psml2psf
PRIVATE
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libsys
libpsml::libpsml
)
if( SIESTA_INSTALL )
install(
TARGETS psml2psf
TARGETS ${PROJECT_NAME}.psml2psf
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,6 +1,6 @@
set(top_srcdir "${PROJECT_SOURCE_DIR}/Src")
add_library(psop_top_objs OBJECT
add_library(${PROJECT_NAME}.psop_top_lib OBJECT
"${top_srcdir}/m_getopts.f90"
"${top_srcdir}/m_uuid.f90"
"${top_srcdir}/periodic_table.f"
@ -21,34 +21,34 @@ if(NOT LIBGRIDXC_USES_PROCEDURE_POINTER)
list(APPEND psop_sources local_timer.f90)
endif()
add_executable(
psop
siesta_add_executable(
${PROJECT_NAME}.psop
${psop_sources}
)
# For semicore_info_froyen...
target_link_libraries(psop_top_objs
target_link_libraries(${PROJECT_NAME}.psop_top_lib
PRIVATE
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libsys
)
target_link_libraries(
psop
${PROJECT_NAME}.psop
PRIVATE
psop_top_objs
${PROJECT_NAME}.psop_top_lib
libgridxc::libgridxc
libpsml::libpsml
xmlf90::xmlf90
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libxc-trans
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libxc-trans
${PROJECT_NAME}.libsys
)
if( SIESTA_INSTALL )
install(
TARGETS psop
TARGETS ${PROJECT_NAME}.psop
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -540,17 +540,14 @@ if( SIESTA_WITH_PEXSI )
endif()
# Create libsiesta target.
siesta_add_library(SIESTA_libsiesta
siesta_add_library(${PROJECT_NAME}.libsiesta
${libsiesta_sources}
EXPORT_NAME libsiesta
OUTPUT_NAME siesta
CUSTOM_TARGET libsiesta
NAMESPACE_TARGET libsiesta)
set_target_properties(SIESTA_libsiesta
PROPERTIES
EXPORT_NAME siesta
OUTPUT_NAME siesta
)
target_compile_definitions(SIESTA_libsiesta
target_compile_definitions(${PROJECT_NAME}.libsiesta
PUBLIC
$<$<BOOL:${SIESTA_WITH_MPI}>:MPI>
$<$<BOOL:${SIESTA_WITH_GRID_SP}>:GRID_SP>
@ -585,24 +582,24 @@ target_compile_definitions(SIESTA_libsiesta
# 'include/gfortran/<version-number>' directory. Putting the MPI dependency first seems to fix
# the issue.
#
target_link_libraries(SIESTA_libsiesta
target_link_libraries(${PROJECT_NAME}.libsiesta
PUBLIC
$<$<BOOL:${SIESTA_WITH_MPI}>:mpi_siesta>
$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libncdf>
$<$<BOOL:${SIESTA_WITH_MPI}>:${PROJECT_NAME}.mpi>
$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libncdf>
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
# Internal projects
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libms
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libms
${PROJECT_NAME}.libunits
libfdf::libfdf
libpsml::libpsml
libgridxc::libgridxc
# Optional dependencies
$<$<BOOL:${SIESTA_WITH_FLOOK}>:flook::flook>
$<$<BOOL:${SIESTA_WITH_WANNIER90}>:wrapper-wannier90::wrapper-wannier90>
$<$<OR:$<BOOL:${SIESTA_WITH_NCDF}>,$<BOOL:${SIESTA_WITH_FLOOK}>>:${PROJECT_NAME}-libfdict>
$<$<OR:$<BOOL:${SIESTA_WITH_NCDF}>,$<BOOL:${SIESTA_WITH_FLOOK}>>:${PROJECT_NAME}.libfdict>
$<$<BOOL:${SIESTA_WITH_DFTD3}>:s-dftd3::s-dftd3>
$<$<BOOL:${SIESTA_WITH_ELPA}>:Elpa::elpa>
$<$<BOOL:${SIESTA_WITH_PEXSI}>:${PROJECT_NAME}::pexsi> # $<$<BOOL:${SIESTA_WITH_PEXSI}>:MPI::MPI_CXX>
@ -613,37 +610,31 @@ target_link_libraries(SIESTA_libsiesta
LAPACK::LAPACK
$<$<BOOL:${SIESTA_WITH_OPENMP}>:OpenMP::OpenMP_Fortran>
# To link properly the C++ runtime
$<$<BOOL:${ELSI_WITH_PEXSI}>:cxx_dummy_lib>
$<$<BOOL:${ELSI_WITH_PEXSI}>:${PROJECT_NAME}.cxx_dummy_lib>
# Profiling
$<$<BOOL:${SIESTA_WITH_PROFILE_NVTX}>:nvtx-c>
$<$<BOOL:${SIESTA_WITH_PROFILE_NVTX}>:${PROJECT_NAME}.nvtx-c>
)
#get_target_property(out SIESTA_libsiesta INTERFACE_LINK_LIBRARIES)
#message(FATAL_ERROR "siesta ${SIESTA_WITH_MPI} ${SIESTA_WITH_ELPA} ${out}")
## For stuff that depends on libsiesta, add its include directory
target_include_directories(SIESTA_libsiesta
target_include_directories(${PROJECT_NAME}.libsiesta
PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}"
)
# Now create the actual siesta executable
siesta_add_executable(SIESTA_siesta_exe
siesta_add_executable(${PROJECT_NAME}.siesta
siesta.F
NAMESPACE_TARGET siesta_exe)
set_target_properties(SIESTA_siesta_exe
PROPERTIES
EXPORT_NAME siesta
# Having an output-name also creates the *target* which can confuse
# Ninja. Hence we don't create CUSTOM_TARGET in the siesta_add_executable
# invocation.
OUTPUT_NAME siesta
)
NAMESPACE_TARGET siesta)
target_link_libraries(SIESTA_siesta_exe
target_link_libraries(${PROJECT_NAME}.siesta
PRIVATE
SIESTA_libsiesta
${PROJECT_NAME}.libsiesta
)
# Add diagonalization options
@ -726,7 +717,7 @@ siesta_get_multiline(LENGTH 128
# at bad positions.
get_target_property(
Fortran_PPFLAGS_CURRENT
SIESTA_libsiesta
${PROJECT_NAME}.libsiesta
COMPILE_DEFINITIONS
)
@ -755,11 +746,11 @@ configure_file(
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_libsiesta
TARGETS ${PROJECT_NAME}.libsiesta
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(
TARGETS SIESTA_siesta_exe
TARGETS ${PROJECT_NAME}.siesta
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()

View File

@ -1,30 +1,33 @@
add_library(mpi_siesta
# Sources
mpi_siesta.F90
mpi_interfaces.F90
mpi__include.f90
Interfaces_integer.f90
Interfaces.f90
)
siesta_add_library(${PROJECT_NAME}.mpi
NO_LINKER_FLAGS
OBJECT
# Sources
mpi_siesta.F90
mpi_interfaces.F90
mpi__include.f90
Interfaces_integer.f90
Interfaces.f90
)
# We need to find "Interfaces.f90", which is generated in the build
#("binary") directory, so we need to add this directory to the list
# The following line will work also, but it is better practice to have
# target-specific settings
###set(CMAKE_INCLUDE_CURRENT_DIR ON)
target_include_directories(mpi_siesta PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
target_include_directories(${PROJECT_NAME}.mpi PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_definitions(
mpi_siesta
${PROJECT_NAME}.mpi
PUBLIC
"$<$<BOOL:${SIESTA_WITH_GRID_SP}>:GRID_SP>"
"$<$<BOOL:${SIESTA_WITH_NO_MPI_INTERFACES}>:NO_MPI_INTERFACES>"
)
target_link_libraries(mpi_siesta PUBLIC MPI::MPI_Fortran)
# So that clients of mpi_siesta can find its modules:
target_include_directories(mpi_siesta INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(${PROJECT_NAME}.mpi PUBLIC MPI::MPI_Fortran)
# So that clients of ${PROJECT_NAME}.mpi can find its modules:
target_include_directories(${PROJECT_NAME}.mpi INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
# Handling of interface-generation script
@ -35,7 +38,7 @@ siesta_suffix(
# Create integer kinds and interfaces
add_executable(mpi_int_explorer
siesta_add_executable(${PROJECT_NAME}.mpi_int_explorer
# Do not default to build this one, it is only
# a temporary build dependency
EXCLUDE_FROM_ALL
@ -47,7 +50,7 @@ string(REPLACE ";" " " SIESTA_INTEGER_KINDS_STR "${SIESTA_INTEGER_KINDS}")
add_custom_command(
OUTPUT Interfaces_integer.f90
# Dependency targets
DEPENDS mpi_int_explorer
DEPENDS ${PROJECT_NAME}.mpi_int_explorer
COMMAND sh "${CMAKE_CURRENT_SOURCE_DIR}/generate_integer.sh" ${SIESTA_INTEGER_KINDS_STR}
VERBATIM
COMMENT "Creating MPI interfaces and modules for integer kinds"
@ -55,7 +58,7 @@ add_custom_command(
# Create real kinds and interfaces
add_executable(mpi_kind_explorer
siesta_add_executable(${PROJECT_NAME}.mpi_kind_explorer
EXCLUDE_FROM_ALL
kind_explorer.f90
)
@ -63,7 +66,7 @@ add_executable(mpi_kind_explorer
string(REPLACE ";" " " SIESTA_REAL_KINDS_STR "${SIESTA_REAL_KINDS}")
add_custom_command(
OUTPUT Interfaces.f90
DEPENDS mpi_kind_explorer
DEPENDS ${PROJECT_NAME}.mpi_kind_explorer
COMMAND sh "${CMAKE_CURRENT_SOURCE_DIR}/generate_real.sh" ${SIESTA_REAL_KINDS_STR}
VERBATIM
COMMENT "Creating MPI interfaces and modules for real, character and logical"

View File

@ -1,6 +1,7 @@
# Built-in MatrixSwitch
#
add_library(${PROJECT_NAME}-libms
siesta_add_library(${PROJECT_NAME}.libms
STATIC
MatrixSwitch.F90
MatrixSwitch_m_add.F90
@ -17,7 +18,7 @@ if (SIESTA_WITH_MPI)
# specific preprocessor variables for compilation of MS itself
target_compile_definitions(
${PROJECT_NAME}-libms
${PROJECT_NAME}.libms
PRIVATE
HAVE_MPI
HAVE_SCALAPACK
@ -26,7 +27,7 @@ if (SIESTA_WITH_MPI)
# Note that this library does NOT use mpi_siesta... We need the
# standard MPI dependency, for itself and any users
target_link_libraries(${PROJECT_NAME}-libms
target_link_libraries(${PROJECT_NAME}.libms
PUBLIC
SCALAPACK::SCALAPACK
)
@ -42,22 +43,22 @@ if (SIESTA_WITH_MPI)
## This enables correct compilation and also correct flags for
## MPI builds.
## Also, it ensures that the include directories are correctly setup
## target_compile_options(${PROJECT_NAME}-libms PUBLIC ${MPI_Fortran_COMPILE_FLAGS})
## target_include_directories(${PROJECT_NAME}-libms PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
## target_link_directories(${PROJECT_NAME}-libms PUBLIC ${MPI_Fortran_LIBRARY_DIRS})
## target_link_libraries(${PROJECT_NAME}-libms PUBLIC ${MPI_Fortran_LIBRARIES})
## target_compile_options(${PROJECT_NAME}.libms PUBLIC ${MPI_Fortran_COMPILE_FLAGS})
## target_include_directories(${PROJECT_NAME}.libms PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
## target_link_directories(${PROJECT_NAME}.libms PUBLIC ${MPI_Fortran_LIBRARY_DIRS})
## target_link_libraries(${PROJECT_NAME}.libms PUBLIC ${MPI_Fortran_LIBRARIES})
else()
# specific preprocessor variables for compilation of MS itself
target_compile_definitions(
${PROJECT_NAME}-libms
${PROJECT_NAME}.libms
PRIVATE
HAVE_LAPACK
)
# add LAPACK dependency
target_link_libraries(${PROJECT_NAME}-libms
target_link_libraries(${PROJECT_NAME}.libms
PUBLIC
LAPACK::LAPACK
)
@ -65,7 +66,7 @@ else()
endif(SIESTA_WITH_MPI)
# So that targets using MS can find its modules:
target_include_directories(${PROJECT_NAME}-libms
target_include_directories(${PROJECT_NAME}.libms
INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}"
)

View File

@ -1,17 +1,17 @@
# This internal library uses a "pre-processed" file from the fdict
# distribution, containing the needed variable types.
add_library(
${PROJECT_NAME}-libfdict
variable.F90
dictionary.f90
siesta_add_library(
${PROJECT_NAME}.libfdict
NO_LINKER_FLAGS
OBJECT
variable.F90
dictionary.f90
)
target_include_directories(
${PROJECT_NAME}-libfdict
${PROJECT_NAME}.libfdict
INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}"
)

View File

@ -1,43 +1,43 @@
#
# Use a pre-generated source file (see top of file)
#
add_library(
${PROJECT_NAME}-libncdf
netcdf_ncdf.F90
siesta_add_library(
${PROJECT_NAME}.libncdf
NO_LINKER_FLAGS
STATIC
netcdf_ncdf.F90
)
if(WITH_NCDF_PARALLEL)
target_compile_definitions(
"${PROJECT_NAME}-libncdf"
PRIVATE
NCDF_PARALLEL
${PROJECT_NAME}.libncdf
PRIVATE
NCDF_PARALLEL
)
# Note that libncdf uses the MPI module directly, through 'use mpi'
# This dependency has been put first to avoid problems with some
# MPI installations (e.g. when using oneapi-mpi with the GNU compiler in CINECA)
# Note that libncdf uses the MPI module directly, through 'use mpi'
# This dependency has been put first to avoid problems with some
# MPI installations (e.g. when using oneapi-mpi with the GNU compiler in CINECA)
target_link_libraries(
${PROJECT_NAME}.libncdf
PRIVATE
MPI::MPI_Fortran
)
target_link_libraries(
${PROJECT_NAME}-libncdf
PRIVATE
MPI::MPI_Fortran
)
endif()
target_link_libraries(
${PROJECT_NAME}-libncdf
${PROJECT_NAME}.libncdf
# 'PUBLIC' to bring in fdict
PRIVATE
${PROJECT_NAME}-libfdict
${PROJECT_NAME}.libfdict
NetCDF::NetCDF_Fortran
)
target_include_directories(
${PROJECT_NAME}-libncdf
${PROJECT_NAME}.libncdf
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -1,15 +1,14 @@
#
#
add_library(
${PROJECT_NAME}-libsys
sys.F90
external_entries.F90
siesta_add_library(
${PROJECT_NAME}.libsys
NO_LINKER_FLAGS
OBJECT
sys.F90
external_entries.F90
)
target_include_directories(
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libsys
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -1,16 +1,17 @@
add_library(
${PROJECT_NAME}-libunits
siesta_add_library(
${PROJECT_NAME}.libunits
NO_LINKER_FLAGS
STATIC
units.F90
units_legacy.f90
units_codata2018.f90
units_common.f90
units.F90
units_legacy.f90
units_codata2018.f90
units_common.f90
)
target_link_libraries(
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libunits
PUBLIC
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libsys
)
@ -25,7 +26,7 @@ message(STATUS "Value of SIESTA_WITH_UNIT_CONVENTION in Src/libunits: ${SIESTA_W
string(TOLOWER "${SIESTA_WITH_UNIT_CONVENTION}" siesta_unit_convention)
if("${siesta_unit_convention}" STREQUAL "original" OR
"${siesta_unit_convention}" STREQUAL "legacy")
target_compile_definitions(${PROJECT_NAME}-libunits
target_compile_definitions(${PROJECT_NAME}.libunits
PUBLIC
SIESTA__UNITS_ORIGINAL)
elseif("${siesta_unit_convention}" STREQUAL "codata2018")
@ -37,5 +38,6 @@ message(STATUS "Siesta using units: ${siesta_unit_convention}")
# Ensure module files are added to the inclusion
target_include_directories(
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libunits
INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")

View File

@ -1,12 +1,14 @@
add_library(${PROJECT_NAME}-libxc-trans
m_libxc_compat.f90
m_libxc_list.F90
m_libxc_sxc_translation.F90
m_siestaxc_list.F90
siesta_add_library(${PROJECT_NAME}.libxc-trans
NO_LINKER_FLAGS
OBJECT
m_libxc_compat.f90
m_libxc_list.F90
m_libxc_sxc_translation.F90
m_siestaxc_list.F90
)
target_include_directories(
${PROJECT_NAME}-libxc-trans
${PROJECT_NAME}.libxc-trans
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -1,5 +1,5 @@
add_executable(
test-ncps
siesta_add_executable(
${PROJECT_NAME}.test-ncps
die.f90
m_getopts.f90
@ -12,8 +12,8 @@ add_executable(
### RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
### )
target_link_libraries(test-ncps
${PROJECT_NAME}-libncps
target_link_libraries(${PROJECT_NAME}.test-ncps
${PROJECT_NAME}.libncps
libpsml::libpsml
xmlf90::xmlf90
)

View File

@ -1,34 +1,31 @@
add_library(
${PROJECT_NAME}-libncps
siesta_add_library(
${PROJECT_NAME}.libncps
NO_LINKER_FLAGS
STATIC
interpolation.f90
m_ncps.f90
m_ncps_froyen_ps_t.f90
m_ncps_froyen_reader.f
m_ncps_psml_plugins.f90
m_ncps_reader.f
m_ncps_translators.f90
m_ncps_utils.f90
m_ncps_writers.f90
env_utils_m.f90
search_ps_m.F90
interpolation.f90
m_ncps.f90
m_ncps_froyen_ps_t.f90
m_ncps_froyen_reader.f
m_ncps_psml_plugins.f90
m_ncps_reader.f
m_ncps_translators.f90
m_ncps_utils.f90
m_ncps_writers.f90
env_utils_m.f90
search_ps_m.F90
)
target_link_libraries(
${PROJECT_NAME}-libncps
${PROJECT_NAME}.libncps
PUBLIC
${PROJECT_NAME}-libxc-trans
libpsml::libpsml
)
target_link_libraries(
${PROJECT_NAME}-libncps
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libxc-trans
${PROJECT_NAME}.libsys
libpsml::libpsml
)
target_include_directories(
${PROJECT_NAME}-libncps
${PROJECT_NAME}.libncps
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -1,27 +1,25 @@
add_library(
${PROJECT_NAME}-libpsop
arw.f
m_kbgen.F
m_localgen.f
m_psop.f90
psop_params.f
schrodinger.F
siesta_add_library(
${PROJECT_NAME}.libpsop
NO_LINKER_FLAGS
STATIC
arw.f
m_kbgen.F
m_localgen.f
m_psop.f90
psop_params.f
schrodinger.F
)
target_include_directories(
${PROJECT_NAME}-libpsop
${PROJECT_NAME}.libpsop
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(
${PROJECT_NAME}-libpsop
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libpsop
PUBLIC
${PROJECT_NAME}.libsys
)

View File

@ -2,9 +2,13 @@
# to add the C++ runtime to the linking statement
# Useful for, e.g., PEXSI
#
add_library(cxx_dummy_lib dummy.cpp)
siesta_add_library(${PROJECT_NAME}.cxx_dummy_lib
NO_LINKER_FLAGS
OBJECT
dummy.cpp
)
target_include_directories(cxx_dummy_lib
target_include_directories(${PROJECT_NAME}.cxx_dummy_lib
INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}"
)

View File

@ -1,25 +1,26 @@
add_library(
${PROJECT_NAME}-libwxml
flib_wcml.f90
flib_wstml.f90
flib_wxml.f90
m_wcml_coma.f90
m_wxml_array_str.f90
m_wxml_buffer.f90
m_wxml_core.f90
m_wxml_dictionary.f90
m_wxml_elstack.f90
m_wxml_error.f90
m_wxml_escape.f90
m_wxml_overloads.f90
m_wxml_text.F90
siesta_add_library(
${PROJECT_NAME}.libwxml
NO_LINKER_FLAGS
OBJECT
flib_wcml.f90
flib_wstml.f90
flib_wxml.f90
m_wcml_coma.f90
m_wxml_array_str.f90
m_wxml_buffer.f90
m_wxml_core.f90
m_wxml_dictionary.f90
m_wxml_elstack.f90
m_wxml_error.f90
m_wxml_escape.f90
m_wxml_overloads.f90
m_wxml_text.F90
)
target_include_directories(
${PROJECT_NAME}-libwxml
${PROJECT_NAME}.libwxml
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -1,24 +1,25 @@
add_library(
${PROJECT_NAME}-libxmlparser
flib_sax.f90
m_buffer.f90
m_charset.f90
m_converters.f90
m_debug.f90
m_dictionary.f90
m_elstack.f90
m_entities.f90
m_fsm.f90
m_io.f90
m_reader.f90
m_xml_error.f90
m_xml_parser.f90
siesta_add_library(
${PROJECT_NAME}.libxmlparser
NO_LINKER_FLAGS
OBJECT
flib_sax.f90
m_buffer.f90
m_charset.f90
m_converters.f90
m_debug.f90
m_dictionary.f90
m_elstack.f90
m_entities.f90
m_fsm.f90
m_io.f90
m_reader.f90
m_xml_error.f90
m_xml_parser.f90
)
target_include_directories(
${PROJECT_NAME}-libxmlparser
${PROJECT_NAME}.libxmlparser
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -6,4 +6,4 @@ siesta_subtest(sl.psml)
siesta_subtest(soft.psml)
siesta_subtest(soft-full.psml)
siesta_subtest(reparam)
siesta_subtest(reparam-rgoff)
siesta_subtest(reparam-rgoff)

View File

@ -4,5 +4,5 @@ siesta_subtest(ts_n_terminal_elec_x LABELS simple)
siesta_subtest(ts_n_terminal_elec_z LABELS simple)
siesta_subtest(ts_n_terminal_3 EXTRA_FILES ts_n_terminal_elec_x.TSHS ts_n_terminal_elec_z.TSHS)
siesta_subtest(ts_n_terminal_3 NAME_ALTER ts_n_terminal_3_tbt
EXEC SIESTA_tbtrans_exe
EXEC ${PROJECT_NAME}.tbtrans
EXTRA_FILES ts_n_terminal_elec_x.TSHS ts_n_terminal_elec_z.TSHS ts_n_terminal_3.TSHS)

View File

@ -235,7 +235,7 @@ function(siesta_subtest)
# Dirty fix for transiesta test.
if(NOT DEFINED _stest_EXEC)
set(_stest_EXEC "SIESTA_siesta_exe")
set(_stest_EXEC "${PROJECT_NAME}.siesta")
endif()
get_target_property(_stest_EXEC_name ${_stest_EXEC} OUTPUT_NAME)
if( "${_stest_EXEC_name}" STREQUAL "" )

View File

@ -5,30 +5,30 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_library(bands_top_objs OBJECT
add_library(${PROJECT_NAME}.bands_top_objs OBJECT
${top_src_dir}/m_getopts.f90
)
add_executable(
gnubands
siesta_add_executable(${PROJECT_NAME}.gnubands
gnubands.f90
)
add_executable(
eigfat2plot
siesta_add_executable(${PROJECT_NAME}.eigfat2plot
eigfat2plot.f90
)
target_link_libraries(gnubands
bands_top_objs
)
target_link_libraries(eigfat2plot
bands_top_objs
)
target_link_libraries(${PROJECT_NAME}.gnubands
PRIVATE
${PROJECT_NAME}.bands_top_objs
)
target_link_libraries(${PROJECT_NAME}.eigfat2plot
PRIVATE
${PROJECT_NAME}.bands_top_objs
)
if( SIESTA_INSTALL )
install(
TARGETS gnubands eigfat2plot
TARGETS ${PROJECT_NAME}.gnubands ${PROJECT_NAME}.eigfat2plot
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -7,7 +7,7 @@
#
set(top_srcdir "${PROJECT_SOURCE_DIR}/Src")
add_library(coop_common_objs OBJECT
add_library(${PROJECT_NAME}.coop_common_objs OBJECT
${top_srcdir}/alloc.F90
${top_srcdir}/parallel.F
${top_srcdir}/m_io.f
@ -22,14 +22,12 @@ add_library(coop_common_objs OBJECT
read_curves.f90
local_timer.f90
)
target_link_libraries(coop_common_objs
PUBLIC ${PROJECT_NAME}-libunits)
target_link_libraries(
coop_common_objs
PRIVATE
${PROJECT_NAME}-libsys
)
target_link_libraries(${PROJECT_NAME}.coop_common_objs
PUBLIC
${PROJECT_NAME}.libunits
PRIVATE
${PROJECT_NAME}.libsys
)
set(sources_fat
fat.f90
@ -51,68 +49,68 @@ set(sources_dm_creator
dm_creator.F90
)
add_executable(
fat
siesta_add_executable(${PROJECT_NAME}.fat
${sources_fat}
)
target_link_libraries(fat
coop_common_objs
${PROJECT_NAME}-libsys
target_link_libraries(${PROJECT_NAME}.fat
PRIVATE
${PROJECT_NAME}.coop_common_objs
${PROJECT_NAME}.libsys
)
add_executable(
mprop
siesta_add_executable(${PROJECT_NAME}.mprop
${sources_mprop}
)
target_link_libraries(mprop
target_link_libraries(${PROJECT_NAME}.mprop
PRIVATE
coop_common_objs
${PROJECT_NAME}-libsys
${PROJECT_NAME}.coop_common_objs
${PROJECT_NAME}.libsys
)
add_executable(
spin_texture
siesta_add_executable(${PROJECT_NAME}.spin_texture
${sources_spin_texture}
)
target_link_libraries(spin_texture
target_link_libraries(${PROJECT_NAME}.spin_texture
PRIVATE
coop_common_objs
${PROJECT_NAME}-libsys
${PROJECT_NAME}.coop_common_objs
${PROJECT_NAME}.libsys
)
add_executable(
dm_creator
${sources_dm_creator}
)
add_executable(
read_spin_texture
siesta_add_executable(${PROJECT_NAME}.read_spin_texture
${sources_read_spin_texture}
)
target_link_libraries(dm_creator
siesta_add_executable(${PROJECT_NAME}.dm_creator
${sources_dm_creator}
)
target_link_libraries(${PROJECT_NAME}.dm_creator
PRIVATE
${PROJECT_NAME}-libsys
coop_common_objs
${PROJECT_NAME}.coop_common_objs
${PROJECT_NAME}.libsys
)
if(SIESTA_WITH_NETCDF)
target_link_libraries(dm_creator
target_link_libraries(${PROJECT_NAME}.dm_creator
PRIVATE
NetCDF::NetCDF_Fortran
)
target_compile_definitions(
dm_creator
target_compile_definitions(${PROJECT_NAME}.dm_creator
PRIVATE
CDF
)
endif()
if( SIESTA_INSTALL )
install(
TARGETS fat mprop spin_texture dm_creator
read_spin_texture
TARGETS
${PROJECT_NAME}.fat
${PROJECT_NAME}.mprop
${PROJECT_NAME}.spin_texture
${PROJECT_NAME}.dm_creator
${PROJECT_NAME}.read_spin_texture
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,18 +1,21 @@
add_executable( grid1d grid1d.f )
add_executable( grid2d grid2d.f )
siesta_add_executable(${PROJECT_NAME}.grid1d
grid1d.f )
siesta_add_executable(${PROJECT_NAME}.grid2d
grid2d.f )
target_link_libraries( grid1d
target_link_libraries(${PROJECT_NAME}.grid1d
PRIVATE
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libunits
)
target_link_libraries( grid2d
target_link_libraries(${PROJECT_NAME}.grid2d
PRIVATE
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libunits
)
if( SIESTA_INSTALL )
install(
TARGETS grid1d grid2d
TARGETS ${PROJECT_NAME}.grid1d ${PROJECT_NAME}.grid2d
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,58 +1,64 @@
add_library(aux_contrib_ap OBJECT
add_library(${PROJECT_NAME}.aux_contrib_ap OBJECT
makebox.f fillbox.f inver3.f hit.f
opnout.f test_ani.f test_md.f test_mdc.f wraxsf1.f wraxsf2.f
read_xv.f intpl04.f displa.f read_ev.f itochar.f w_arrow.f
w_movie.f
)
target_link_libraries(aux_contrib_ap
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits)
target_link_libraries(${PROJECT_NAME}.aux_contrib_ap
PRIVATE
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits)
#
add_executable(eig2bxsf
siesta_add_executable(${PROJECT_NAME}.eig2bxsf
eig2bxsf.f
$<TARGET_OBJECTS:aux_contrib_ap>
$<TARGET_OBJECTS:${PROJECT_NAME}.aux_contrib_ap>
)
target_link_libraries(eig2bxsf
target_link_libraries(${PROJECT_NAME}.eig2bxsf
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits)
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits)
add_executable(xv2xsf
siesta_add_executable(${PROJECT_NAME}.xv2xsf
xv2xsf.f
$<TARGET_OBJECTS:aux_contrib_ap>
$<TARGET_OBJECTS:${PROJECT_NAME}.aux_contrib_ap>
)
target_link_libraries(xv2xsf
target_link_libraries(${PROJECT_NAME}.xv2xsf
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits)
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits)
add_executable(md2axsf
siesta_add_executable(${PROJECT_NAME}.md2axsf
md2axsf.f
$<TARGET_OBJECTS:aux_contrib_ap>
$<TARGET_OBJECTS:${PROJECT_NAME}.aux_contrib_ap>
)
target_link_libraries(md2axsf
target_link_libraries(${PROJECT_NAME}.md2axsf
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits)
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits)
add_executable(rho2xsf
siesta_add_executable(${PROJECT_NAME}.rho2xsf
rho2xsf.f
$<TARGET_OBJECTS:aux_contrib_ap>
$<TARGET_OBJECTS:${PROJECT_NAME}.aux_contrib_ap>
)
add_executable(vib2xsf
siesta_add_executable(${PROJECT_NAME}.vib2xsf
vib2xsf.f
$<TARGET_OBJECTS:aux_contrib_ap>
$<TARGET_OBJECTS:${PROJECT_NAME}.aux_contrib_ap>
)
add_executable(fmpdos fmpdos.f)
siesta_add_executable(${PROJECT_NAME}.fmpdos fmpdos.f)
if( SIESTA_INSTALL )
install(TARGETS
eig2bxsf xv2xsf md2axsf rho2xsf vib2xsf fmpdos
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
install(
TARGETS
${PROJECT_NAME}.eig2bxsf
${PROJECT_NAME}.xv2xsf
${PROJECT_NAME}.md2axsf
${PROJECT_NAME}.rho2xsf
${PROJECT_NAME}.vib2xsf
${PROJECT_NAME}.fmpdos
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -79,30 +79,25 @@ list(
${top_srcdir}/class_Fstack_Pair_Data1D.F90
)
siesta_add_executable(SIESTA_denchar_exe
siesta_add_executable(${PROJECT_NAME}.denchar
${sources}
NAMESPACE_TARGET denchar_exe
NAMESPACE_TARGET denchar
)
set_target_properties(SIESTA_denchar_exe
PROPERTIES
EXPORT_NAME denchar
OUTPUT_NAME denchar
)
target_link_libraries(
SIESTA_denchar_exe
${PROJECT_NAME}.denchar
PRIVATE
libfdf::libfdf
libpsml::libpsml
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
)
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_denchar_exe
TARGETS ${PROJECT_NAME}.denchar
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,32 +1,37 @@
add_library(objs_getopts OBJECT
add_library(${PROJECT_NAME}.objs_getopts OBJECT
${PROJECT_SOURCE_DIR}/Src/m_getopts.f90 )
add_executable(dmfilter dmfilter.f90)
add_executable(dmbs2dm dmbs2dm.F90 )
target_link_libraries(dmbs2dm objs_getopts)
add_executable(dmUnblock dmUnblock.F90)
target_link_libraries(dmUnblock objs_getopts)
add_executable(dm_noncol_sign_flip4 dm_noncol_sign_flip4.f90)
siesta_add_executable(${PROJECT_NAME}.dmfilter dmfilter.f90)
siesta_add_executable(${PROJECT_NAME}.dmbs2dm dmbs2dm.F90 )
target_link_libraries(${PROJECT_NAME}.dmbs2dm PRIVATE ${PROJECT_NAME}.objs_getopts)
siesta_add_executable(${PROJECT_NAME}.dmUnblock dmUnblock.F90)
target_link_libraries(${PROJECT_NAME}.dmUnblock PRIVATE ${PROJECT_NAME}.objs_getopts)
siesta_add_executable(${PROJECT_NAME}.dm_noncol_sign_flip4 dm_noncol_sign_flip4.f90)
if( SIESTA_INSTALL )
install(
TARGETS dmfilter dmbs2dm dmUnblock dm_noncol_sign_flip4
TARGETS
${PROJECT_NAME}.dmfilter
${PROJECT_NAME}.dmbs2dm
${PROJECT_NAME}.dmUnblock
${PROJECT_NAME}.dm_noncol_sign_flip4
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
if(SIESTA_WITH_NETCDF)
add_executable(dm2cdf dm2cdf.F90)
add_executable(cdf2dm cdf2dm.F90)
siesta_add_executable(${PROJECT_NAME}.dm2cdf dm2cdf.F90)
siesta_add_executable(${PROJECT_NAME}.cdf2dm cdf2dm.F90)
if( SIESTA_INSTALL )
install(
TARGETS dm2cdf cdf2dm
TARGETS
${PROJECT_NAME}.dm2cdf
${PROJECT_NAME}.cdf2dm
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
endif(SIESTA_WITH_NETCDF)

View File

@ -1,14 +1,12 @@
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_executable(
Eig2DOS
siesta_add_executable(${PROJECT_NAME}.Eig2DOS
Eig2DOS.f90
${top_src_dir}/m_getopts.f90
)
if( SIESTA_INSTALL )
install(
TARGETS Eig2DOS
TARGETS ${PROJECT_NAME}.Eig2DOS
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -59,10 +59,41 @@ if(NOT LIBGRIDXC_USES_PROCEDURE_POINTER)
list(APPEND sources local_timer.f90)
endif()
add_library(aux-lib-basis OBJECT ${sources})
siesta_add_library(${PROJECT_NAME}.aux-lib-basis OBJECT ${sources})
add_executable(gen-basis gen-basis.F)
add_executable(ioncat ioncat.f
#
# lapack is needed for m_filter...
target_link_libraries(
${PROJECT_NAME}.aux-lib-basis
PRIVATE
libfdf::libfdf
libgridxc::libgridxc
libpsml::libpsml
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
LAPACK::LAPACK
)
siesta_add_executable(${PROJECT_NAME}.gen-basis gen-basis.F)
target_link_libraries(
${PROJECT_NAME}.gen-basis
PRIVATE
${PROJECT_NAME}.aux-lib-basis
libfdf::libfdf
libgridxc::libgridxc
libpsml::libpsml
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
LAPACK::LAPACK
)
siesta_add_executable(${PROJECT_NAME}.ioncat ioncat.f
${top_srcdir}/atmfuncs.f
${top_srcdir}/spher_harm.f
@ -70,16 +101,31 @@ add_executable(ioncat ioncat.f
${top_srcdir}/chkdim.f
)
target_link_libraries(
${PROJECT_NAME}.ioncat
PRIVATE
${PROJECT_NAME}.aux-lib-basis
libfdf::libfdf
libgridxc::libgridxc
libpsml::libpsml
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
LAPACK::LAPACK
)
if( SIESTA_INSTALL )
install(
TARGETS gen-basis ioncat
TARGETS ${PROJECT_NAME}.gen-basis ${PROJECT_NAME}.ioncat
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
#
# Copy also ionplot.sh (with executable bits?)
#
if( SIESTA_INSTALL )
#
# Copy also ionplot.sh (with executable bits?)
#
install(
FILES
"ionplot.sh"
@ -89,48 +135,3 @@ if( SIESTA_INSTALL )
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
#
# lapack is needed for m_filter...
target_link_libraries(
aux-lib-basis
PRIVATE
libfdf::libfdf
libgridxc::libgridxc
libpsml::libpsml
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
LAPACK::LAPACK
)
target_link_libraries(
gen-basis
PRIVATE
aux-lib-basis
libfdf::libfdf
libgridxc::libgridxc
libpsml::libpsml
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
LAPACK::LAPACK
)
target_link_libraries(
ioncat
PRIVATE
aux-lib-basis
libfdf::libfdf
libgridxc::libgridxc
libpsml::libpsml
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
LAPACK::LAPACK
)

View File

@ -8,11 +8,22 @@ set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
# To avoid "multiple rules" in Ninja
# Maybe turn into global-utility targets
add_library(aux_opts ${top_src_dir}/m_getopts.f90)
add_library(aux_gridfunc m_gridfunc.F90)
siesta_add_library(${PROJECT_NAME}.aux_opts
NO_LINKER_FLAGS
OBJECT
${top_src_dir}/m_getopts.f90
)
siesta_add_library(${PROJECT_NAME}.aux_gridfunc
NO_LINKER_FLAGS
OBJECT
m_gridfunc.F90
)
#-----------------------------------------
add_executable(g2c_ng
siesta_add_executable(${PROJECT_NAME}.g2c_ng
${top_src_dir}/reclat.f
m_struct.f90
local_die.f90
@ -20,39 +31,45 @@ add_executable(g2c_ng
)
# For future enabling of NetCDF in m_gridfunc
target_link_libraries(g2c_ng
PRIVATE $<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
PRIVATE aux_opts aux_gridfunc
PRIVATE ${PROJECT_NAME}-libunits
target_link_libraries(${PROJECT_NAME}.g2c_ng
PRIVATE
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
${PROJECT_NAME}.aux_opts
${PROJECT_NAME}.aux_gridfunc
${PROJECT_NAME}.libunits
)
target_compile_definitions(g2c_ng
target_compile_definitions(${PROJECT_NAME}.g2c_ng
PRIVATE $<$<BOOL:${SIESTA_WITH_NETCDF}>:CDF> )
#---------------------------------------------------------------------
add_executable(v_info v_info.f90)
siesta_add_executable(${PROJECT_NAME}.v_info v_info.f90)
# For future enabling of NetCDF in m_gridfunc
target_link_libraries(v_info
PRIVATE $<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
PRIVATE aux_gridfunc
PRIVATE ${PROJECT_NAME}-libunits
target_link_libraries(${PROJECT_NAME}.v_info
PRIVATE
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
${PROJECT_NAME}.aux_gridfunc
${PROJECT_NAME}.libunits
)
target_compile_definitions(v_info PRIVATE $<$<BOOL:${SIESTA_WITH_NETCDF}>:CDF> )
target_compile_definitions(${PROJECT_NAME}.v_info PRIVATE $<$<BOOL:${SIESTA_WITH_NETCDF}>:CDF> )
#---------------------------------------------------------------------
add_executable(grid2cube grid2cube.f)
add_executable(grid2val grid2val.F)
add_executable(grid_rotate grid_rotate.F90)
add_executable(grid_supercell grid_supercell.F90)
siesta_add_executable(${PROJECT_NAME}.grid2cube grid2cube.f)
siesta_add_executable(${PROJECT_NAME}.grid2val grid2val.F)
siesta_add_executable(${PROJECT_NAME}.grid_rotate grid_rotate.F90)
siesta_add_executable(${PROJECT_NAME}.grid_supercell grid_supercell.F90)
if( SIESTA_INSTALL )
install(
TARGETS
g2c_ng
v_info
grid2cube grid2val grid_rotate grid_supercell
${PROJECT_NAME}.g2c_ng
${PROJECT_NAME}.v_info
${PROJECT_NAME}.grid2cube
${PROJECT_NAME}.grid2val
${PROJECT_NAME}.grid_rotate
${PROJECT_NAME}.grid_supercell
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
endif()
#---------------------------------------------------------------------
@ -60,80 +77,101 @@ endif()
# Run executables with NetCDF dependencies
if (SIESTA_WITH_NETCDF)
add_executable(cdf2grid cdf2grid.F90)
siesta_add_executable(${PROJECT_NAME}.cdf2grid cdf2grid.F90)
target_link_libraries(cdf2grid PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(cdf2grid PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.cdf2grid PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(${PROJECT_NAME}.cdf2grid PRIVATE CDF )
#---------------------------------------------------------------------
add_executable(grid2cdf grid2cdf.F90)
siesta_add_executable(${PROJECT_NAME}.grid2cdf grid2cdf.F90)
target_link_libraries(grid2cdf PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(grid2cdf PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.grid2cdf PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(${PROJECT_NAME}.grid2cdf PRIVATE CDF )
#-----------------------------------------
add_executable(cdf2xsf cdf2xsf.F90)
siesta_add_executable(${PROJECT_NAME}.cdf2xsf cdf2xsf.F90)
target_link_libraries(cdf2xsf PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(cdf2xsf PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.cdf2xsf PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(${PROJECT_NAME}.cdf2xsf PRIVATE CDF )
#-----------------------------------------
# To avoid "multiple rules" in Ninja
# (could add OBJECT qualifier to avoid the lib appearing)
add_library(aux_m_grid m_grid.F90)
target_compile_definitions(aux_m_grid PRIVATE CDF )
target_link_libraries(aux_m_grid PUBLIC NetCDF::NetCDF_Fortran )
siesta_add_library(${PROJECT_NAME}.aux_m_grid m_grid.F90)
target_compile_definitions(${PROJECT_NAME}.aux_m_grid PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.aux_m_grid PUBLIC NetCDF::NetCDF_Fortran )
add_executable(cdf_diff cdf_diff.F90)
siesta_add_executable(${PROJECT_NAME}.cdf_diff cdf_diff.F90)
target_link_libraries(cdf_diff PRIVATE aux_m_grid NetCDF::NetCDF_Fortran )
target_compile_definitions(cdf_diff PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.cdf_diff
PRIVATE
${PROJECT_NAME}.aux_m_grid
NetCDF::NetCDF_Fortran
)
target_compile_definitions(${PROJECT_NAME}.cdf_diff PRIVATE CDF )
#-----------------------------------------
add_executable(cdf_get_cell cdf_get_cell.F90)
siesta_add_executable(${PROJECT_NAME}.cdf_get_cell cdf_get_cell.F90)
target_link_libraries(cdf_get_cell PRIVATE aux_m_grid NetCDF::NetCDF_Fortran )
target_compile_definitions(cdf_get_cell PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.cdf_get_cell
PRIVATE
${PROJECT_NAME}.aux_m_grid
NetCDF::NetCDF_Fortran
)
target_compile_definitions(${PROJECT_NAME}.cdf_get_cell PRIVATE CDF )
#-----------------------------------------
# To avoid "multiple rules" in Ninja
add_library(aux_fft ${top_src_dir}/m_fft_gpfa.F)
target_link_libraries(aux_fft PRIVATE ${PROJECT_NAME}-libsys)
siesta_add_library(${PROJECT_NAME}.aux_fft
NO_LINKER_FLAGS
OBJECT
${top_src_dir}/m_fft_gpfa.F
)
target_link_libraries(${PROJECT_NAME}.aux_fft PRIVATE ${PROJECT_NAME}.libsys)
add_executable(cdf_laplacian
siesta_add_executable(${PROJECT_NAME}.cdf_laplacian
${top_src_dir}/reclat.f
fft3d.f
local_die.f90
cdf_laplacian.F90
)
target_link_libraries(cdf_laplacian PRIVATE aux_fft aux_opts)
target_link_libraries(cdf_laplacian PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(cdf_laplacian PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.cdf_laplacian
PRIVATE
${PROJECT_NAME}.aux_fft
${PROJECT_NAME}.aux_opts
NetCDF::NetCDF_Fortran
)
target_compile_definitions(${PROJECT_NAME}.cdf_laplacian PRIVATE CDF )
#-----------------------------------------
add_executable(cdf_fft
siesta_add_executable(${PROJECT_NAME}.cdf_fft
${top_src_dir}/reclat.f
fft3d.f
local_die.f90
cdf_fft.F90
)
target_link_libraries(cdf_fft PRIVATE aux_fft)
target_link_libraries(cdf_fft PRIVATE NetCDF::NetCDF_Fortran )
target_compile_definitions(cdf_fft PRIVATE CDF )
target_link_libraries(${PROJECT_NAME}.cdf_fft
PRIVATE
${PROJECT_NAME}.aux_fft
NetCDF::NetCDF_Fortran
)
target_compile_definitions(${PROJECT_NAME}.cdf_fft PRIVATE CDF )
if( SIESTA_INSTALL )
install(TARGETS
cdf2grid grid2cdf
cdf2xsf
cdf_diff cdf_get_cell
cdf_laplacian
cdf_fft
${PROJECT_NAME}.cdf2grid
${PROJECT_NAME}.grid2cdf
${PROJECT_NAME}.cdf2xsf
${PROJECT_NAME}.cdf_diff
${PROJECT_NAME}.cdf_get_cell
${PROJECT_NAME}.cdf_laplacian
${PROJECT_NAME}.cdf_fft
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
endif()

View File

@ -1,7 +1,7 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_executable(fdf2grimme
siesta_add_executable(${PROJECT_NAME}.fdf2grimme
${top_src_dir}/parallel.F
${top_src_dir}/chemical.f
${top_src_dir}/atom_options.F90
@ -13,17 +13,17 @@ add_executable(fdf2grimme
local_timer.f90
)
target_link_libraries(fdf2grimme
target_link_libraries(${PROJECT_NAME}.fdf2grimme
PRIVATE
libfdf::libfdf
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
)
if( SIESTA_INSTALL )
install(
TARGETS fdf2grimme
TARGETS ${PROJECT_NAME}.fdf2grimme
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -2,18 +2,17 @@
# Go the extra mile and treat this as a library
# that users can link to in their own programs.
#
add_library(hsx hsx_m.f90)
siesta_add_library(${PROJECT_NAME}.libhsx
OUTPUT_NAME hsx
hsx_m.f90)
# Expose hsx library for external projects
add_library(${PROJECT_NAME}::libhsx ALIAS hsx)
set_target_properties(hsx
set_target_properties(${PROJECT_NAME}.libhsx
PROPERTIES
VERSION "${PROJECT_VERSION}"
Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include"
)
target_include_directories(
hsx
${PROJECT_NAME}.libhsx
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
@ -22,15 +21,15 @@ target_include_directories(
#
# Now the utilities
#
add_executable( hsx2hs hsx2hs.f90)
add_executable( hs2hsx hs2hsx.f90)
siesta_add_executable(${PROJECT_NAME}.hsx2hs hsx2hs.f90)
siesta_add_executable(${PROJECT_NAME}.hs2hsx hs2hsx.f90)
target_link_libraries(hsx2hs hsx)
target_link_libraries(hs2hsx hsx)
target_link_libraries(${PROJECT_NAME}.hsx2hs PRIVATE ${PROJECT_NAME}.libhsx)
target_link_libraries(${PROJECT_NAME}.hs2hsx PRIVATE ${PROJECT_NAME}.libhsx)
if( SIESTA_INSTALL )
install(
TARGETS hsx
TARGETS ${PROJECT_NAME}.libhsx
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
@ -40,7 +39,7 @@ if( SIESTA_INSTALL )
)
install(
TARGETS
hsx2hs hs2hsx
${PROJECT_NAME}.hsx2hs ${PROJECT_NAME}.hs2hsx
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,7 +1,7 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_executable(get_chem_labels
siesta_add_executable(${PROJECT_NAME}.get_chem_labels
${top_src_dir}/parallel.F
${top_src_dir}/chemical.f
${top_src_dir}/atom_options.F90
@ -17,17 +17,11 @@ add_executable(get_chem_labels
local_timer.f90
)
target_link_libraries(get_chem_labels
target_link_libraries(${PROJECT_NAME}.get_chem_labels
PRIVATE
libfdf::libfdf
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
)
if( SIESTA_INSTALL )
install(
TARGETS get_chem_labels
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
# This executable will not be installed.

View File

@ -1,21 +1,25 @@
# To avoid "multiple rules" in Ninja
# Maybe turn into global-utility targets
add_library(aux_joblist jobList.f90 posix_calls.f90)
siesta_add_library(${PROJECT_NAME}.aux_joblist
jobList.f90 posix_calls.f90)
add_executable(countJobs countJobs.f90 )
add_executable(runJobs runJobs.f90 )
add_executable(getResults getResults.f90 )
add_executable(horizontal horizontal.f90 )
siesta_add_executable(${PROJECT_NAME}.countJobs countJobs.f90 )
siesta_add_executable(${PROJECT_NAME}.runJobs runJobs.f90 )
siesta_add_executable(${PROJECT_NAME}.getResults getResults.f90 )
siesta_add_executable(${PROJECT_NAME}.horizontal horizontal.f90 )
target_link_libraries(countJobs aux_joblist)
target_link_libraries(runJobs aux_joblist)
target_link_libraries(getResults aux_joblist)
target_link_libraries(horizontal aux_joblist)
target_link_libraries(${PROJECT_NAME}.countJobs PRIVATE ${PROJECT_NAME}.aux_joblist)
target_link_libraries(${PROJECT_NAME}.runJobs PRIVATE ${PROJECT_NAME}.aux_joblist)
target_link_libraries(${PROJECT_NAME}.getResults PRIVATE ${PROJECT_NAME}.aux_joblist)
target_link_libraries(${PROJECT_NAME}.horizontal PRIVATE ${PROJECT_NAME}.aux_joblist)
if( SIESTA_INSTALL )
install(TARGETS
countJobs runJobs getResults horizontal
${PROJECT_NAME}.countJobs
${PROJECT_NAME}.runJobs
${PROJECT_NAME}.getResults
${PROJECT_NAME}.horizontal
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -20,55 +20,55 @@ function(setup_test_mpi prog)
endfunction()
add_executable(pi3
siesta_add_executable(${PROJECT_NAME}.pi3
pi3.F
)
target_link_libraries(pi3 PRIVATE mpi_siesta)
target_link_libraries(${PROJECT_NAME}.pi3 PRIVATE ${PROJECT_NAME}.mpi)
#
# To check "singleton" MPI runs (i.e., that we can run
# a parallel program without 'mpirun'). This is not
# possible in some systems (e.g. IBM's MPI)
#
add_test(NAME pi3_Runs_Singleton COMMAND pi3)
add_test(NAME pi3_Runs_Singleton COMMAND ${PROJECT_NAME}.pi3)
# Normal MPI run with ${SIESTA_TESTS_MPI_NUMPROCS}
setup_test_mpi(pi3)
setup_test_mpi(${PROJECT_NAME}.pi3)
#
add_executable(newcomm
siesta_add_executable(${PROJECT_NAME}.newcomm
newcomm.F
)
target_link_libraries(newcomm PRIVATE mpi_siesta)
setup_test_mpi(newcomm)
target_link_libraries(${PROJECT_NAME}.newcomm PRIVATE ${PROJECT_NAME}.mpi)
setup_test_mpi(${PROJECT_NAME}.newcomm)
#
add_executable(blacs_prb blacs_prb.f90 )
target_link_libraries(blacs_prb
siesta_add_executable(${PROJECT_NAME}.blacs_prb blacs_prb.f90 )
target_link_libraries(${PROJECT_NAME}.blacs_prb
PRIVATE
SCALAPACK::SCALAPACK
MPI::MPI_Fortran
LAPACK::LAPACK
)
setup_test_mpi(blacs_prb)
setup_test_mpi(${PROJECT_NAME}.blacs_prb)
#
add_executable(pblas_prb pblas_prb.f90 )
target_link_libraries(pblas_prb
PRIVATE
SCALAPACK::SCALAPACK
MPI::MPI_Fortran
LAPACK::LAPACK
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/pblas.dat" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
siesta_add_executable(${PROJECT_NAME}.pblas_prb pblas_prb.f90 )
target_link_libraries(${PROJECT_NAME}.pblas_prb
PRIVATE
SCALAPACK::SCALAPACK
MPI::MPI_Fortran
LAPACK::LAPACK
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/pblas.dat" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
#
# Run the test automatically only if we have enough ranks available.
#
if("${SIESTA_TESTS_MPI_NUMPROCS}" GREATER_EQUAL 4)
setup_test_mpi(pblas_prb)
setup_test_mpi(${PROJECT_NAME}.pblas_prb)
endif()

View File

@ -25,17 +25,19 @@ list(
)
add_executable(macroave "${sources}")
add_executable(permute permute.F)
siesta_add_executable(${PROJECT_NAME}.macroave ${sources})
siesta_add_executable(${PROJECT_NAME}.permute permute.F)
target_link_libraries(macroave
target_link_libraries(${PROJECT_NAME}.macroave
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits)
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits)
if( SIESTA_INSTALL )
install(
TARGETS macroave
TARGETS
${PROJECT_NAME}.macroave
${PROJECT_NAME}.permute
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,10 +1,10 @@
if (SIESTA_WITH_NETCDF)
add_executable( lwf2cdf lwf2cdf.F90 )
siesta_add_executable(${PROJECT_NAME}.lwf2cdf lwf2cdf.F90 )
if( SIESTA_INSTALL )
install(
TARGETS lwf2cdf
TARGETS ${PROJECT_NAME}.lwf2cdf
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,14 +1,14 @@
add_executable( optical optical_cond.f )
add_executable( optical_input optical_input.f )
siesta_add_executable( ${PROJECT_NAME}.optical optical_cond.f )
siesta_add_executable( ${PROJECT_NAME}.optical_input optical_input.f )
target_link_libraries(optical
PRIVATE ${PROJECT_NAME}-libunits ${PROJECT_NAME}-libsys)
target_link_libraries(optical_input
PRIVATE ${PROJECT_NAME}-libunits ${PROJECT_NAME}-libsys)
target_link_libraries(${PROJECT_NAME}.optical
PRIVATE ${PROJECT_NAME}.libunits ${PROJECT_NAME}.libsys)
target_link_libraries(${PROJECT_NAME}.optical_input
PRIVATE ${PROJECT_NAME}.libunits ${PROJECT_NAME}.libsys)
if( SIESTA_INSTALL )
install(
TARGETS optical optical_input
TARGETS ${PROJECT_NAME}.optical ${PROJECT_NAME}.optical_input
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,4 +1,5 @@
add_library(aux_optim
siesta_add_library(${PROJECT_NAME}.aux_optim
OBJECT
io.f
parse.f
minimizer.f90
@ -8,25 +9,25 @@ add_library(aux_optim
sys.f
)
add_executable( simplex
siesta_add_executable(${PROJECT_NAME}.simplex
amoeba.f
simplex.f90
)
add_executable( swarm
siesta_add_executable(${PROJECT_NAME}.swarm
swarm.f90
)
target_link_libraries(aux_optim PUBLIC
target_link_libraries(${PROJECT_NAME}.aux_optim PUBLIC
$<$<BOOL:${SIESTA_WITH_OPENMP}>:OpenMP::OpenMP_Fortran>
)
target_link_libraries(swarm PRIVATE aux_optim)
target_link_libraries(simplex PRIVATE aux_optim)
target_link_libraries(${PROJECT_NAME}.swarm PRIVATE ${PROJECT_NAME}.aux_optim)
target_link_libraries(${PROJECT_NAME}.simplex PRIVATE ${PROJECT_NAME}.aux_optim)
if( SIESTA_INSTALL )
install(
TARGETS simplex swarm
TARGETS ${PROJECT_NAME}.simplex ${PROJECT_NAME}.swarm
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -2,11 +2,11 @@ if( NOT SIESTA_WITH_PEXSI )
return()
endif()
add_executable(intdos2eig intdos2eig.f90)
siesta_add_executable(${PROJECT_NAME}.intdos2eig intdos2eig.f90)
if( SIESTA_INSTALL )
install(
TARGETS intdos2eig
TARGETS ${PROJECT_NAME}.intdos2eig
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,8 +1,8 @@
add_executable( orbmol_proj orbmol_proj.f90)
siesta_add_executable(${PROJECT_NAME}.orbmol_proj orbmol_proj.f90)
if( SIESTA_INSTALL )
install(
TARGETS orbmol_proj
TARGETS ${PROJECT_NAME}.orbmol_proj
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -89,25 +89,24 @@ list(
)
siesta_add_executable(
ol-stm
siesta_add_executable(${PROJECT_NAME}.ol-stm
${sources}
)
target_link_libraries(
ol-stm
${PROJECT_NAME}.ol-stm
PRIVATE
libfdf::libfdf
libpsml::libpsml
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
FFTW::Double
)
if( SIESTA_INSTALL )
install(
TARGETS ol-stm
TARGETS ${PROJECT_NAME}.ol-stm
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -4,23 +4,23 @@ set(grid_srcdir "${PROJECT_SOURCE_DIR}/Util/Grid")
# To avoid "multiple rules" in Ninja
# Maybe turn into global-utility targets
add_library(stm_gridfunc ${grid_srcdir}/m_gridfunc.F90)
siesta_add_library(${PROJECT_NAME}.stm_gridfunc ${grid_srcdir}/m_gridfunc.F90)
add_executable( plstm
siesta_add_executable( ${PROJECT_NAME}.plstm
plstm.f90
${top_srcdir}/m_getopts.f90
)
add_executable( plsts
siesta_add_executable( ${PROJECT_NAME}.plsts
plsts.f
)
target_link_libraries(plstm PRIVATE stm_gridfunc)
target_link_libraries(plsts PRIVATE stm_gridfunc)
target_link_libraries(${PROJECT_NAME}.plstm PRIVATE ${PROJECT_NAME}.stm_gridfunc)
target_link_libraries(${PROJECT_NAME}.plsts PRIVATE ${PROJECT_NAME}.stm_gridfunc)
if( SIESTA_INSTALL )
install(
TARGETS plstm plsts
TARGETS ${PROJECT_NAME}.plstm ${PROJECT_NAME}.plsts
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -3,7 +3,7 @@ set(top_srcdir "${PROJECT_SOURCE_DIR}/Src")
# Driver for mixed (coarse/fine) MD using pipes
#
add_executable(fmixmd-driver
siesta_add_executable(${PROJECT_NAME}.fmixmd-driver
driver.f90
fmixmd.f90
@ -15,7 +15,7 @@ add_executable(fmixmd-driver
if( SIESTA_INSTALL )
install(
TARGETS fmixmd-driver
TARGETS ${PROJECT_NAME}.fmixmd-driver
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -8,9 +8,8 @@ set(top_srcdir "${PROJECT_SOURCE_DIR}/Src")
# ProtoNEB: Uses the MPI dispatch
#
siesta_add_executable(SIESTA_protoNEB_exe
CUSTOM_TARGET protoNEB
NAMESPACE_TARGET protoNEB_exe
siesta_add_executable(${PROJECT_NAME}.protoNEB
NAMESPACE_TARGET protoNEB
${top_srcdir}/reinit_m.F90
${top_srcdir}/siesta_cmlsubs.F90
@ -24,14 +23,14 @@ siesta_add_executable(SIESTA_protoNEB_exe
)
target_link_libraries(
SIESTA_protoNEB_exe
${PROJECT_NAME}.protoNEB
PRIVATE
SIESTA_libsiesta
${PROJECT_NAME}.libsiesta
)
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_protoNEB_exe
TARGETS ${PROJECT_NAME}.protoNEB
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -10,45 +10,51 @@ set(top_srcdir "${PROJECT_SOURCE_DIR}/Src")
# to satisfy Ninja. This is also good practice in general
#
# -- Sockets
siesta_add_library(sockets-siesta-dispatch
siesta_add_library(${PROJECT_NAME}.sockets-dispatch
NO_LINKER_FLAGS
OBJECT
${top_srcdir}/fsiesta_sockets.F90
${top_srcdir}/fsockets.f90
${top_srcdir}/sockets.c
${top_srcdir}/posix_calls.f90
)
set_target_properties(sockets-siesta-dispatch
set_target_properties(${PROJECT_NAME}.sockets-dispatch
PROPERTIES
Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/sockets-include")
target_include_directories(sockets-siesta-dispatch
target_include_directories(${PROJECT_NAME}.sockets-dispatch
INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}/sockets-include")
# -- Pipes
siesta_add_library(pipes-siesta-dispatch
siesta_add_library(${PROJECT_NAME}.pipes-dispatch
NO_LINKER_FLAGS
OBJECT
${top_srcdir}/fsiesta_pipes.F90
${top_srcdir}/pxf.F90
${top_srcdir}/posix_calls.f90
)
set_target_properties(pipes-siesta-dispatch
set_target_properties(${PROJECT_NAME}.pipes-dispatch
PROPERTIES
Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pipes-include")
target_include_directories(pipes-siesta-dispatch
target_include_directories(${PROJECT_NAME}.pipes-dispatch
INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}/pipes-include")
if (SIESTA_WITH_MPI)
# -- MPI dispatch -- uses 'libsiesta'
siesta_add_library(mpi-siesta-dispatch
${top_srcdir}/fsiesta_mpi.F90
siesta_add_library(${PROJECT_NAME}.mpi-dispatch
NO_LINKER_FLAGS
OBJECT
${top_srcdir}/fsiesta_mpi.F90
)
target_link_libraries(mpi-siesta-dispatch PUBLIC SIESTA_libsiesta)
target_link_libraries(${PROJECT_NAME}.mpi-dispatch PUBLIC ${PROJECT_NAME}.libsiesta)
set_target_properties(mpi-siesta-dispatch
set_target_properties(${PROJECT_NAME}.mpi-dispatch
PROPERTIES
Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mpi-include")
target_include_directories(mpi-siesta-dispatch
target_include_directories(${PROJECT_NAME}.mpi-dispatch
INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}/mpi-include")
@ -56,58 +62,55 @@ target_include_directories(mpi-siesta-dispatch
#
# Phonons: Uses the MPI dispatch
#
siesta_add_executable(phonons
siesta_add_executable(${PROJECT_NAME}.phonons
phonons.f90)
target_link_libraries(phonons PRIVATE mpi-siesta-dispatch)
target_link_libraries(${PROJECT_NAME}.phonons PRIVATE ${PROJECT_NAME}.mpi-dispatch)
# Simple MPI-aware driver
siesta_add_executable(mpi_driver
simple_mpi_parallel.f90
siesta_add_executable(${PROJECT_NAME}.mpi_driver
simple_mpi_parallel.f90
)
target_link_libraries(mpi_driver PRIVATE mpi-siesta-dispatch)
target_link_libraries(${PROJECT_NAME}.mpi_driver PRIVATE ${PROJECT_NAME}.mpi-dispatch)
# Sockets interface to parallel-version of Siesta
siesta_add_executable(sockets_parallel simple_parallel.f90)
target_link_libraries(sockets_parallel PRIVATE sockets-siesta-dispatch)
siesta_add_executable(${PROJECT_NAME}.sockets_parallel
simple_parallel.f90)
target_link_libraries(${PROJECT_NAME}.sockets_parallel PRIVATE ${PROJECT_NAME}.sockets-dispatch)
# Pipes interface to parallel-version of Siesta
siesta_add_executable(pipes_parallel
simple_parallel.f90
siesta_add_executable(${PROJECT_NAME}.pipes_parallel
simple_parallel.f90
)
target_link_libraries(pipes_parallel PRIVATE pipes-siesta-dispatch)
target_link_libraries(${PROJECT_NAME}.pipes_parallel PRIVATE ${PROJECT_NAME}.pipes-dispatch)
if( SIESTA_INSTALL )
install(
TARGETS
phonons pipes_parallel
sockets_parallel mpi_driver
${PROJECT_NAME}.phonons ${PROJECT_NAME}.pipes_parallel
${PROJECT_NAME}.sockets_parallel ${PROJECT_NAME}.mpi_driver
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
endif(SIESTA_WITH_MPI)
siesta_add_executable(sockets_serial simple_serial.f90)
target_link_libraries(sockets_serial PRIVATE sockets-siesta-dispatch)
siesta_add_executable(${PROJECT_NAME}.sockets_serial
simple_serial.f90)
target_link_libraries(${PROJECT_NAME}.sockets_serial PRIVATE ${PROJECT_NAME}.sockets-dispatch)
siesta_add_executable(pipes_serial simple_serial.f90)
target_link_libraries(pipes_serial PRIVATE pipes-siesta-dispatch)
siesta_add_executable(${PROJECT_NAME}.pipes_serial
simple_serial.f90)
target_link_libraries(${PROJECT_NAME}.pipes_serial PRIVATE ${PROJECT_NAME}.pipes-dispatch)
if( SIESTA_INSTALL )
install(
TARGETS
pipes_serial
sockets_serial
${PROJECT_NAME}.pipes_serial
${PROJECT_NAME}.sockets_serial
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,20 +1,20 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_library(sockets_objs OBJECT
siesta_add_library(${PROJECT_NAME}.sockets_objs OBJECT
${top_src_dir}/fsockets.f90
${top_src_dir}/sockets.c
)
add_executable( f2fmaster f2fmaster.f90 )
add_executable( f2fslave f2fslave.f90 )
siesta_add_executable( ${PROJECT_NAME}.f2fmaster f2fmaster.f90 )
siesta_add_executable( ${PROJECT_NAME}.f2fslave f2fslave.f90 )
target_link_libraries(f2fmaster sockets_objs )
target_link_libraries(f2fslave sockets_objs )
target_link_libraries(${PROJECT_NAME}.f2fmaster PRIVATE ${PROJECT_NAME}.sockets_objs )
target_link_libraries(${PROJECT_NAME}.f2fslave PRIVATE ${PROJECT_NAME}.sockets_objs )
if( SIESTA_INSTALL )
install(
TARGETS f2fmaster f2fslave
TARGETS ${PROJECT_NAME}.f2fmaster ${PROJECT_NAME}.f2fslave
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,8 +1,8 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
siesta_add_executable(SIESTA_pvtsp_exe
NAMESPACE_TARGET pvtsp_exe
siesta_add_executable(${PROJECT_NAME}.pvtsp
NAMESPACE_TARGET pvtsp
${top_src_dir}/precision.F
${top_src_dir}/parallel.F
@ -36,21 +36,16 @@ siesta_add_executable(SIESTA_pvtsp_exe
pvtsp.F90
local_timer.f90
)
set_target_properties(SIESTA_pvtsp_exe
PROPERTIES
EXPORT_NAME pvtsp
OUTPUT_NAME pvtsp
)
target_link_libraries(SIESTA_pvtsp_exe
target_link_libraries(${PROJECT_NAME}.pvtsp
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libsys
)
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_pvtsp_exe
TARGETS ${PROJECT_NAME}.pvtsp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -165,28 +165,22 @@ list(
)
siesta_add_executable(SIESTA_phtrans_exe
siesta_add_executable(${PROJECT_NAME}.phtrans
NAMESPACE_TARGET phtrans
${sources}
NAMESPACE_TARGET phtrans_exe
)
set_target_properties(SIESTA_phtrans_exe
PROPERTIES
EXPORT_NAME phtrans
OUTPUT_NAME phtrans
)
target_link_libraries(
SIESTA_phtrans_exe
${PROJECT_NAME}.phtrans
PRIVATE
$<$<BOOL:${SIESTA_WITH_OPENMP}>:OpenMP::OpenMP_Fortran>
libfdf::libfdf
$<$<BOOL:${SIESTA_WITH_MPI}>:mpi_siesta>
$<$<BOOL:${SIESTA_WITH_MPI}>:${PROJECT_NAME}.mpi>
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libncdf>
${PROJECT_NAME}-libfdict
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libncdf>
${PROJECT_NAME}.libfdict
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
$<$<BOOL:${SIESTA_WITH_ELPA}>:Elpa::elpa>
$<$<BOOL:${SIESTA_WITH_MPI}>:SCALAPACK::SCALAPACK>
LAPACK::LAPACK
@ -194,13 +188,13 @@ target_link_libraries(
# Ensure the version specification can find the auto-generated file
target_include_directories(
SIESTA_phtrans_exe
${PROJECT_NAME}.phtrans
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_compile_definitions(
SIESTA_phtrans_exe
${PROJECT_NAME}.phtrans
PRIVATE
TBTRANS # Notify about TBTRANS
TBT_PHONON # Notify about phonon mode
@ -227,7 +221,7 @@ siesta_get_multiline(LENGTH 128
# at bad positions.
get_target_property(
Fortran_PPFLAGS_CURRENT
SIESTA_phtrans_exe
${PROJECT_NAME}.phtrans
COMPILE_DEFINITIONS
)
@ -248,7 +242,7 @@ configure_file(
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_phtrans_exe
TARGETS ${PROJECT_NAME}.phtrans
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -161,26 +161,21 @@ list(
)
siesta_add_executable(SIESTA_tbtrans_exe
siesta_add_executable(${PROJECT_NAME}.tbtrans
${sources}
NAMESPACE_TARGET tbtrans_exe
NAMESPACE_TARGET tbtrans
)
set_target_properties(SIESTA_tbtrans_exe
PROPERTIES
EXPORT_NAME tbtrans
OUTPUT_NAME tbtrans
)
target_link_libraries(
SIESTA_tbtrans_exe
${PROJECT_NAME}.tbtrans
PRIVATE
$<$<BOOL:${SIESTA_WITH_OPENMP}>:OpenMP::OpenMP_Fortran>
libfdf::libfdf
$<$<BOOL:${SIESTA_WITH_MPI}>:mpi_siesta>
$<$<BOOL:${SIESTA_WITH_MPI}>:${PROJECT_NAME}.mpi>
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libncdf>
${PROJECT_NAME}-libfdict # Even if not using NCDF
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libncdf>
${PROJECT_NAME}.libfdict # Even if not using NCDF
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
$<$<BOOL:${SIESTA_WITH_ELPA}>:Elpa::elpa>
$<$<BOOL:${SIESTA_WITH_MPI}>:SCALAPACK::SCALAPACK>
LAPACK::LAPACK
@ -188,13 +183,13 @@ target_link_libraries(
# Ensure the version specification can find the auto-generated file
target_include_directories(
SIESTA_tbtrans_exe
${PROJECT_NAME}.tbtrans
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_compile_definitions(
SIESTA_tbtrans_exe
${PROJECT_NAME}.tbtrans
PRIVATE
TBTRANS # Notify about TBTRANS
$<$<BOOL:${SIESTA_WITH_MPI}>:MPI>
@ -220,7 +215,7 @@ siesta_get_multiline(LENGTH 128
# at bad positions.
get_target_property(
Fortran_PPFLAGS_CURRENT
SIESTA_tbtrans_exe
${PROJECT_NAME}.tbtrans
COMPILE_DEFINITIONS
)
@ -242,7 +237,7 @@ configure_file(
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_tbtrans_exe
TARGETS ${PROJECT_NAME}.tbtrans
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -11,17 +11,17 @@ list(APPEND sources
${top_srcdir}/m_io.f
)
add_executable(ts2ts ${sources})
target_link_libraries(ts2ts
siesta_add_executable(${PROJECT_NAME}.ts2ts ${sources})
target_link_libraries(${PROJECT_NAME}.ts2ts
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
libfdf::libfdf
)
if( SIESTA_INSTALL )
install(
TARGETS ts2ts
TARGETS ${PROJECT_NAME}.ts2ts
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -149,35 +149,30 @@ list(
)
siesta_add_executable(SIESTA_tscontour_exe
siesta_add_executable(${PROJECT_NAME}.tscontour
${sources}
NAMESPACE_TARGET tscontour_exe
)
set_target_properties(SIESTA_tscontour_exe
PROPERTIES
EXPORT_NAME tscontour
OUTPUT_NAME tscontour
NAMESPACE_TARGET tscontour
)
target_link_libraries(
SIESTA_tscontour_exe
${PROJECT_NAME}.tscontour
PRIVATE
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
libfdf::libfdf
libpsml::libpsml
libgridxc::libgridxc
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libncdf>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libfdict>"
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libncdf>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libfdict>"
LAPACK::LAPACK
)
target_compile_definitions(
SIESTA_tscontour_exe
${PROJECT_NAME}.tscontour
PRIVATE
"$<$<BOOL:${SIESTA_WITH_NETCDF}>:CDF>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:NCDF>"
@ -187,7 +182,7 @@ target_compile_definitions(
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_tscontour_exe
TARGETS ${PROJECT_NAME}.tscontour
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -35,24 +35,23 @@ list(
${top_srcdir}/nag.f
)
add_executable(
tshs2tshs
siesta_add_executable(${PROJECT_NAME}.tshs2tshs
${sources}
)
target_link_libraries(
tshs2tshs
${PROJECT_NAME}.tshs2tshs
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libncdf>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}-libfdict>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libncdf>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:${PROJECT_NAME}.libfdict>"
)
target_compile_definitions(
tshs2tshs
${PROJECT_NAME}.tshs2tshs
PRIVATE
"$<$<BOOL:${SIESTA_WITH_NETCDF}>:CDF>"
"$<$<BOOL:${SIESTA_WITH_NCDF}>:NCDF>"
@ -62,7 +61,7 @@ target_compile_definitions(
if( SIESTA_INSTALL )
install(
TARGETS tshs2tshs
TARGETS ${PROJECT_NAME}.tshs2tshs
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -98,26 +98,21 @@ list(
${top_srcdir}/m_vee_integrals.F90
)
siesta_add_executable(SIESTA_unfold_exe
siesta_add_executable(${PROJECT_NAME}.unfold
${sources}
NAMESPACE_TARGET unfold_exe
NAMESPACE_TARGET unfold
)
set_target_properties(SIESTA_unfold_exe
PROPERTIES
EXPORT_NAME unfold
OUTPUT_NAME unfold
)
# Putting the MPI dependency first seems to fix some issues (see Src/CMakeLists).
target_link_libraries(
SIESTA_unfold_exe
${PROJECT_NAME}.unfold
PRIVATE
$<$<BOOL:${SIESTA_WITH_MPI}>:mpi_siesta>
$<$<BOOL:${SIESTA_WITH_MPI}>:${PROJECT_NAME}.mpi>
$<$<BOOL:${SIESTA_WITH_NETCDF}>:NetCDF::NetCDF_Fortran>
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libpsop
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libpsop
${PROJECT_NAME}.libunits
libfdf::libfdf
libpsml::libpsml
libgridxc::libgridxc
@ -128,7 +123,7 @@ target_link_libraries(
)
target_compile_definitions(
SIESTA_unfold_exe
${PROJECT_NAME}.unfold
PRIVATE
$<$<BOOL:${SIESTA_WITH_MPI}>:MPI>
$<$<BOOL:${HAS_MRRR}>:SIESTA__MRRR>
@ -140,7 +135,7 @@ target_compile_definitions(
if( SIESTA_INSTALL )
install(
TARGETS SIESTA_unfold_exe
TARGETS ${PROJECT_NAME}.unfold
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()

View File

@ -5,33 +5,37 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_library(vca_objs OBJECT
siesta_add_library(${PROJECT_NAME}.vca_objs OBJECT
${top_src_dir}/interpolation.f90
${top_src_dir}/m_io.f
${top_src_dir}/io.f
${top_src_dir}/periodic_table.f
${top_src_dir}/precision.F
)
target_link_libraries(vca_objs
PRIVATE
${PROJECT_NAME}-libsys)
target_link_libraries(${PROJECT_NAME}.vca_objs
PRIVATE
${PROJECT_NAME}.libsys)
add_executable( mixps mixps.f )
add_executable( fractional fractional.f)
siesta_add_executable( ${PROJECT_NAME}.mixps mixps.f )
siesta_add_executable( ${PROJECT_NAME}.fractional fractional.f)
target_link_libraries(mixps PRIVATE
vca_objs
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libsys)
target_link_libraries(fractional PRIVATE
vca_objs
${PROJECT_NAME}-libncps
${PROJECT_NAME}-libsys)
target_link_libraries(${PROJECT_NAME}.mixps
PRIVATE
${PROJECT_NAME}.vca_objs
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libsys
)
target_link_libraries(${PROJECT_NAME}.fractional
PRIVATE
${PROJECT_NAME}.vca_objs
${PROJECT_NAME}.libncps
${PROJECT_NAME}.libsys
)
if( SIESTA_INSTALL )
install(
TARGETS mixps fractional
TARGETS ${PROJECT_NAME}.mixps ${PROJECT_NAME}.fractional
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -9,7 +9,7 @@
#
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
add_library(vibra_top_objs OBJECT
siesta_add_library(${PROJECT_NAME}.vibra_top_objs OBJECT
${top_src_dir}/io.f
${top_src_dir}/m_io.f
${top_src_dir}/precision.F
@ -17,19 +17,17 @@ add_library(vibra_top_objs OBJECT
)
target_link_libraries(
vibra_top_objs
${PROJECT_NAME}.vibra_top_objs
PRIVATE
${PROJECT_NAME}-libsys
${PROJECT_NAME}.libsys
)
add_executable(
fcbuild
siesta_add_executable(${PROJECT_NAME}.fcbuild
fcbuild.f
recoor.f
)
add_executable(
vibra
siesta_add_executable(${PROJECT_NAME}.vibra
hermdp.F
klines.f
outbands.f
@ -37,23 +35,25 @@ add_executable(
vibra.F
)
target_link_libraries(fcbuild
vibra_top_objs
target_link_libraries(${PROJECT_NAME}.fcbuild
PRIVATE
${PROJECT_NAME}.vibra_top_objs
libfdf::libfdf
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
)
target_link_libraries(vibra
vibra_top_objs
target_link_libraries(${PROJECT_NAME}.vibra
PRIVATE
${PROJECT_NAME}.vibra_top_objs
libfdf::libfdf
${PROJECT_NAME}-libsys
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libsys
${PROJECT_NAME}.libunits
LAPACK::LAPACK
)
if( SIESTA_INSTALL )
install(
TARGETS fcbuild vibra
TARGETS ${PROJECT_NAME}.fcbuild ${PROJECT_NAME}.vibra
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -2,36 +2,37 @@
set(top_src_dir "${PROJECT_SOURCE_DIR}/Src")
#-----------------------------------------
add_executable(readwfx
siesta_add_executable(${PROJECT_NAME}.readwfx
${top_src_dir}/m_getopts.f90
readwfx.f90
)
add_executable(readwf readwf.f)
add_executable(wfs2wfsx wfs2wfsx.f)
add_executable(wfsx2wfs wfsx2wfs.f)
siesta_add_executable(${PROJECT_NAME}.readwf readwf.f)
siesta_add_executable(${PROJECT_NAME}.wfs2wfsx wfs2wfsx.f)
siesta_add_executable(${PROJECT_NAME}.wfsx2wfs wfsx2wfs.f)
if( SIESTA_INSTALL )
install(
TARGETS
readwf readwfx
wfs2wfsx wfsx2wfs
${PROJECT_NAME}.readwf ${PROJECT_NAME}.readwfx
${PROJECT_NAME}.wfs2wfsx ${PROJECT_NAME}.wfsx2wfs
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
endif()
if (SIESTA_WITH_NETCDF)
add_executable(wfsnc2wfsx wfsnc2wfsx.F90)
siesta_add_executable(${PROJECT_NAME}.wfsnc2wfsx wfsnc2wfsx.F90)
target_link_libraries(wfsnc2wfsx PRIVATE
target_link_libraries(${PROJECT_NAME}.wfsnc2wfsx
PRIVATE
NetCDF::NetCDF_Fortran
${PROJECT_NAME}-libunits
${PROJECT_NAME}.libunits
)
target_compile_definitions(wfsnc2wfsx PRIVATE CDF )
target_compile_definitions(${PROJECT_NAME}.wfsnc2wfsx PRIVATE CDF )
if( SIESTA_INSTALL )
install(
TARGETS wfsnc2wfsx
TARGETS ${PROJECT_NAME}.wfsnc2wfsx
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,11 +1,11 @@
add_executable( pdosxml
siesta_add_executable(${PROJECT_NAME}.pdosxml
m_orbital_chooser.f90 m_pdos.f90 pdosxml.f90)
target_link_libraries(pdosxml xmlf90::xmlf90)
target_link_libraries(${PROJECT_NAME}.pdosxml PRIVATE xmlf90::xmlf90)
if( SIESTA_INSTALL )
install(
TARGETS pdosxml
TARGETS ${PROJECT_NAME}.pdosxml
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

View File

@ -1,11 +1,11 @@
#
add_executable(sies2arc
siesta_add_executable(${PROJECT_NAME}.sies2arc
sies2arc.f linepro.f wtof.f cell.f uncell.f
)
if( SIESTA_INSTALL )
install(
TARGETS sies2arc
TARGETS ${PROJECT_NAME}.sies2arc
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()