规范模块目录和第三方依赖结构

This commit is contained in:
zhangshun
2026-06-01 16:57:39 +08:00
parent e8e485b115
commit c2ce29d874
1758 changed files with 187 additions and 102 deletions

View File

@@ -0,0 +1,51 @@
if (ACML_LIBRARIES)
set(ACML_FIND_QUIETLY TRUE)
endif (ACML_LIBRARIES)
find_library(ACML_LIBRARIES
NAMES
acml_mp acml_mv
PATHS
$ENV{ACMLDIR}/lib
$ENV{ACML_DIR}/lib
${LIB_INSTALL_DIR}
)
find_file(ACML_LIBRARIES
NAMES
libacml_mp.so
PATHS
/usr/lib
/usr/lib64
$ENV{ACMLDIR}/lib
${LIB_INSTALL_DIR}
)
if(NOT ACML_LIBRARIES)
message(STATUS "Multi-threaded library not found, looking for single-threaded")
find_library(ACML_LIBRARIES
NAMES
acml acml_mv
PATHS
$ENV{ACMLDIR}/lib
$ENV{ACML_DIR}/lib
${LIB_INSTALL_DIR}
)
find_file(ACML_LIBRARIES
libacml.so libacml_mv.so
PATHS
/usr/lib
/usr/lib64
$ENV{ACMLDIR}/lib
${LIB_INSTALL_DIR}
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ACML DEFAULT_MSG ACML_LIBRARIES)
mark_as_advanced(ACML_LIBRARIES)

View File

@@ -0,0 +1,31 @@
if (ATLAS_LIBRARIES)
set(ATLAS_FIND_QUIETLY TRUE)
endif (ATLAS_LIBRARIES)
find_file(ATLAS_LIB libatlas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
find_library(ATLAS_LIB satlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
find_file(ATLAS_LAPACK NAMES liblapack_atlas.so.3 liblapack.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
find_library(ATLAS_LAPACK NAMES lapack_atlas lapack PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
find_file(ATLAS_F77BLAS libf77blas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
find_library(ATLAS_F77BLAS f77blas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
if(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS)
set(ATLAS_LIBRARIES ${ATLAS_LAPACK} ${ATLAS_LIB})
# search the default lapack lib link to it
find_file(ATLAS_REFERENCE_LAPACK liblapack.so.3 PATHS /usr/lib /usr/lib64)
find_library(ATLAS_REFERENCE_LAPACK NAMES lapack)
# if(ATLAS_REFERENCE_LAPACK)
# set(ATLAS_LIBRARIES ${ATLAS_LIBRARIES} ${ATLAS_REFERENCE_LAPACK})
# endif()
endif(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES)
mark_as_advanced(ATLAS_LIBRARIES)

View File

@@ -0,0 +1,31 @@
# - Try to find eigen2 headers
# Once done this will define
#
# BLAZE_FOUND - system has blaze lib
# BLAZE_INCLUDE_DIR - the blaze include directory
#
# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
# Adapted from FindEigen.cmake:
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (BLAZE_INCLUDE_DIR)
# in cache already
set(BLAZE_FOUND TRUE)
else (BLAZE_INCLUDE_DIR)
find_path(BLAZE_INCLUDE_DIR NAMES blaze/Blaze.h
PATHS
${INCLUDE_INSTALL_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BLAZE DEFAULT_MSG BLAZE_INCLUDE_DIR)
mark_as_advanced(BLAZE_INCLUDE_DIR)
endif(BLAZE_INCLUDE_DIR)

View File

@@ -0,0 +1,40 @@
# - Try to find blitz lib
# Once done this will define
#
# BLITZ_FOUND - system has blitz lib
# BLITZ_INCLUDES - the blitz include directory
# BLITZ_LIBRARIES - The libraries needed to use blitz
# Copyright (c) 2006, Montel Laurent, <montel@kde.org>
# Copyright (c) 2007, Allen Winter, <winter@kde.org>
# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# include(FindLibraryWithDebug)
if (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
set(Blitz_FIND_QUIETLY TRUE)
endif (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
find_path(BLITZ_INCLUDES
NAMES
blitz/array.h
PATH_SUFFIXES blitz*
PATHS
$ENV{BLITZDIR}/include
${INCLUDE_INSTALL_DIR}
)
find_library(BLITZ_LIBRARIES
blitz
PATHS
$ENV{BLITZDIR}/lib
${LIB_INSTALL_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Blitz DEFAULT_MSG
BLITZ_INCLUDES BLITZ_LIBRARIES)
mark_as_advanced(BLITZ_INCLUDES BLITZ_LIBRARIES)

View File

@@ -0,0 +1,35 @@
# include(FindLibraryWithDebug)
if (CBLAS_INCLUDES AND CBLAS_LIBRARIES)
set(CBLAS_FIND_QUIETLY TRUE)
endif (CBLAS_INCLUDES AND CBLAS_LIBRARIES)
find_path(CBLAS_INCLUDES
NAMES
cblas.h
PATHS
$ENV{CBLASDIR}/include
${INCLUDE_INSTALL_DIR}
)
find_library(CBLAS_LIBRARIES
cblas
PATHS
$ENV{CBLASDIR}/lib
${LIB_INSTALL_DIR}
)
find_file(CBLAS_LIBRARIES
libcblas.so.3
PATHS
/usr/lib
/usr/lib64
$ENV{CBLASDIR}/lib
${LIB_INSTALL_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CBLAS DEFAULT_MSG
CBLAS_INCLUDES CBLAS_LIBRARIES)
mark_as_advanced(CBLAS_INCLUDES CBLAS_LIBRARIES)

View File

@@ -0,0 +1,17 @@
if (GMM_INCLUDE_DIR)
# in cache already
set(GMM_FOUND TRUE)
else (GMM_INCLUDE_DIR)
find_path(GMM_INCLUDE_DIR NAMES gmm/gmm.h
PATHS
${INCLUDE_INSTALL_DIR}
${GMM_INCLUDE_PATH}
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMM DEFAULT_MSG GMM_INCLUDE_DIR )
mark_as_advanced(GMM_INCLUDE_DIR)
endif(GMM_INCLUDE_DIR)

View File

@@ -0,0 +1,65 @@
if (MKL_LIBRARIES)
set(MKL_FIND_QUIETLY TRUE)
endif (MKL_LIBRARIES)
if(CMAKE_MINOR_VERSION GREATER 4)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
find_library(MKL_LIBRARIES
mkl_core
PATHS
$ENV{MKLLIB}
/opt/intel/mkl/*/lib/em64t
/opt/intel/Compiler/*/*/mkl/lib/em64t
${LIB_INSTALL_DIR}
)
find_library(MKL_GUIDE
guide
PATHS
$ENV{MKLLIB}
/opt/intel/mkl/*/lib/em64t
/opt/intel/Compiler/*/*/mkl/lib/em64t
/opt/intel/Compiler/*/*/lib/intel64
${LIB_INSTALL_DIR}
)
if(MKL_LIBRARIES AND MKL_GUIDE)
set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread)
endif()
else(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
find_library(MKL_LIBRARIES
mkl_core
PATHS
$ENV{MKLLIB}
/opt/intel/mkl/*/lib/32
/opt/intel/Compiler/*/*/mkl/lib/32
${LIB_INSTALL_DIR}
)
find_library(MKL_GUIDE
guide
PATHS
$ENV{MKLLIB}
/opt/intel/mkl/*/lib/32
/opt/intel/Compiler/*/*/mkl/lib/32
/opt/intel/Compiler/*/*/lib/intel32
${LIB_INSTALL_DIR}
)
if(MKL_LIBRARIES AND MKL_GUIDE)
set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread)
endif()
endif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
endif(CMAKE_MINOR_VERSION GREATER 4)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES)
mark_as_advanced(MKL_LIBRARIES)

View File

@@ -0,0 +1,31 @@
# - Try to find eigen2 headers
# Once done this will define
#
# MTL4_FOUND - system has eigen2 lib
# MTL4_INCLUDE_DIR - the eigen2 include directory
#
# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
# Adapted from FindEigen.cmake:
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (MTL4_INCLUDE_DIR)
# in cache already
set(MTL4_FOUND TRUE)
else (MTL4_INCLUDE_DIR)
find_path(MTL4_INCLUDE_DIR NAMES boost/numeric/mtl/mtl.hpp
PATHS
${INCLUDE_INSTALL_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MTL4 DEFAULT_MSG MTL4_INCLUDE_DIR)
mark_as_advanced(MTL4_INCLUDE_DIR)
endif(MTL4_INCLUDE_DIR)

View File

@@ -0,0 +1,17 @@
if (OPENBLAS_LIBRARIES)
set(OPENBLAS_FIND_QUIETLY TRUE)
endif (OPENBLAS_LIBRARIES)
find_file(OPENBLAS_LIBRARIES NAMES libopenblas.so libopenblas.so.0 PATHS /usr/lib /usr/lib64 $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})
find_library(OPENBLAS_LIBRARIES openblas PATHS $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})
if(OPENBLAS_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
set(OPENBLAS_LIBRARIES ${OPENBLAS_LIBRARIES} "-lpthread -lgfortran")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OPENBLAS DEFAULT_MSG
OPENBLAS_LIBRARIES)
mark_as_advanced(OPENBLAS_LIBRARIES)

View File

@@ -0,0 +1,60 @@
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
#
# This macro is intended to be used in FindXXX.cmake modules files.
# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
# it also sets the <UPPERCASED_NAME>_FOUND variable.
# The package is found if all variables listed are TRUE.
# Example:
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
#
# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
# independent whether QUIET was used or not.
#
# If it is found, the location is reported using the VAR1 argument, so
# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
# If the second argument is DEFAULT_MSG, the message in the failure case will
# be "Could NOT find LibXml2", if you don't like this message you can specify
# your own custom failure message there.
MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
IF (${_NAME}_FIND_REQUIRED)
SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}")
ELSE (${_NAME}_FIND_REQUIRED)
SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}")
ENDIF (${_NAME}_FIND_REQUIRED)
ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
SET(_FAIL_MESSAGE "${_FAIL_MSG}")
ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
STRING(TOUPPER ${_NAME} _NAME_UPPER)
SET(${_NAME_UPPER}_FOUND TRUE)
IF(NOT ${_VAR1})
SET(${_NAME_UPPER}_FOUND FALSE)
ENDIF(NOT ${_VAR1})
FOREACH(_CURRENT_VAR ${ARGN})
IF(NOT ${_CURRENT_VAR})
SET(${_NAME_UPPER}_FOUND FALSE)
ENDIF(NOT ${_CURRENT_VAR})
ENDFOREACH(_CURRENT_VAR)
IF (${_NAME_UPPER}_FOUND)
IF (NOT ${_NAME}_FIND_QUIETLY)
MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
ELSE (${_NAME_UPPER}_FOUND)
IF (${_NAME}_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
ELSE (${_NAME}_FIND_REQUIRED)
IF (NOT ${_NAME}_FIND_QUIETLY)
MESSAGE(STATUS "${_FAIL_MESSAGE}")
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
ENDIF (${_NAME}_FIND_REQUIRED)
ENDIF (${_NAME_UPPER}_FOUND)
ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)

View File

@@ -0,0 +1,32 @@
# - Try to find tvmet headers
# Once done this will define
#
# TVMET_FOUND - system has tvmet lib
# TVMET_INCLUDE_DIR - the tvmet include directory
#
# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
# Adapted from FindEigen.cmake:
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (TVMET_INCLUDE_DIR)
# in cache already
set(TVMET_FOUND TRUE)
else (TVMET_INCLUDE_DIR)
find_path(TVMET_INCLUDE_DIR NAMES tvmet/tvmet.h
PATHS
${TVMETDIR}/
${INCLUDE_INSTALL_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Tvmet DEFAULT_MSG TVMET_INCLUDE_DIR)
mark_as_advanced(TVMET_INCLUDE_DIR)
endif(TVMET_INCLUDE_DIR)

View File

@@ -0,0 +1,31 @@
# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
# this will have two effects
# 1 - CMake will not complain if the directory doesn't exist
# This makes sense if you want to distribute just one of the subdirs
# in a source package, e.g. just one of the subdirs in kdeextragear.
# 2 - If the directory exists, it will offer an option to skip the
# subdirectory.
# This is useful if you want to compile only a subset of all
# directories.
# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
IF(EXISTS ${_fullPath})
IF(${ARGC} EQUAL 2)
OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1})
ELSE(${ARGC} EQUAL 2)
OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE)
ENDIF(${ARGC} EQUAL 2)
IF(BUILD_${_dir})
ADD_SUBDIRECTORY(${_dir})
ENDIF(BUILD_${_dir})
ENDIF(EXISTS ${_fullPath})
ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)