From d381f4dc23e2fb2cd9c87c86e689abe3fce5c53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Thu, 17 Oct 2024 17:18:41 +0200 Subject: [PATCH] AMD: Avoid stubs in favor of object libraries. Avoid the stub files that were used to build objects for the int64_t interface. Instead, use object libraries that build the same source files once with `DLONG` and once without it. This also avoids building all objects twice (for the shared and the static library), effectively reducing the build time approximately by a factor of two. --- AMD/CMakeLists.txt | 29 +++++++++++++++++++++++------ AMD/Source/amd_l1.c | 13 ------------- AMD/Source/amd_l2.c | 13 ------------- AMD/Source/amd_l_aat.c | 14 -------------- AMD/Source/amd_l_control.c | 14 -------------- AMD/Source/amd_l_defaults.c | 14 -------------- AMD/Source/amd_l_dump.c | 14 -------------- AMD/Source/amd_l_info.c | 14 -------------- AMD/Source/amd_l_order.c | 14 -------------- AMD/Source/amd_l_post_tree.c | 13 ------------- AMD/Source/amd_l_postorder.c | 13 ------------- AMD/Source/amd_l_preprocess.c | 13 ------------- AMD/Source/amd_l_valid.c | 13 ------------- 13 files changed, 23 insertions(+), 168 deletions(-) delete mode 100644 AMD/Source/amd_l1.c delete mode 100644 AMD/Source/amd_l2.c delete mode 100644 AMD/Source/amd_l_aat.c delete mode 100644 AMD/Source/amd_l_control.c delete mode 100644 AMD/Source/amd_l_defaults.c delete mode 100644 AMD/Source/amd_l_dump.c delete mode 100644 AMD/Source/amd_l_info.c delete mode 100644 AMD/Source/amd_l_order.c delete mode 100644 AMD/Source/amd_l_post_tree.c delete mode 100644 AMD/Source/amd_l_postorder.c delete mode 100644 AMD/Source/amd_l_preprocess.c delete mode 100644 AMD/Source/amd_l_valid.c diff --git a/AMD/CMakeLists.txt b/AMD/CMakeLists.txt index 571400868..2f9317a98 100644 --- a/AMD/CMakeLists.txt +++ b/AMD/CMakeLists.txt @@ -72,17 +72,29 @@ configure_file ( "Config/amd_version.tex.in" "${PROJECT_SOURCE_DIR}/Doc/amd_vers include_directories ( Source Include ) #------------------------------------------------------------------------------- -# dynamic amd library properties +# object libraries for int32_t and int64_t #------------------------------------------------------------------------------- +file ( GLOB AMD_C_SOURCES "Source/*.c" ) +# exclude amd_version.c because there is no int64_t variant of it +file ( GLOB AMD_VERSION_C_SOURCE "Source/amd_version.c" ) +list ( REMOVE_ITEM AMD_C_SOURCES ${AMD_VERSION_C_SOURCE} ) + if ( SUITESPARSE_HAS_FORTRAN ) - file ( GLOB AMD_SOURCES "Source/*.c" "Source/*.f" ) -else ( ) - file ( GLOB AMD_SOURCES "Source/*.c" ) + file ( GLOB AMD_F_SOURCES "Source/*.f" ) endif ( ) +add_library ( amd_i OBJECT ${AMD_C_SOURCES} ${AMD_VERSION_C_SOURCE} ${AMD_F_SOURCES} ) +add_library ( amd_l OBJECT ${AMD_C_SOURCES} ) +target_compile_definitions ( amd_l PRIVATE DLONG ) + +#------------------------------------------------------------------------------- +# dynamic amd library properties +#------------------------------------------------------------------------------- + if ( BUILD_SHARED_LIBS ) - add_library ( AMD SHARED ${AMD_SOURCES} ) + add_library ( AMD SHARED + $ $ ) set_target_properties ( AMD PROPERTIES VERSION ${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB} C_STANDARD 11 @@ -107,7 +119,8 @@ endif ( ) #------------------------------------------------------------------------------- if ( BUILD_STATIC_LIBS ) - add_library ( AMD_static STATIC ${AMD_SOURCES} ) + add_library ( AMD_static STATIC + $ $ ) set_target_properties ( AMD_static PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED ON @@ -135,6 +148,10 @@ endif ( ) #------------------------------------------------------------------------------- # SuiteSparseConfig: +target_include_directories ( amd_i PRIVATE + "$" ) +target_include_directories ( amd_l PRIVATE + "$" ) if ( BUILD_SHARED_LIBS ) target_link_libraries ( AMD PRIVATE SuiteSparse::SuiteSparseConfig ) target_include_directories ( AMD PUBLIC diff --git a/AMD/Source/amd_l1.c b/AMD/Source/amd_l1.c deleted file mode 100644 index feb9ef7db..000000000 --- a/AMD/Source/amd_l1.c +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l1: int64_t version of amd_1 -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - -#define DLONG -#include "amd_1.c" - diff --git a/AMD/Source/amd_l2.c b/AMD/Source/amd_l2.c deleted file mode 100644 index ebdbe2062..000000000 --- a/AMD/Source/amd_l2.c +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l2.c: int64_t version of amd_2 -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - -#define DLONG -#include "amd_2.c" - diff --git a/AMD/Source/amd_l_aat.c b/AMD/Source/amd_l_aat.c deleted file mode 100644 index d4d3e074c..000000000 --- a/AMD/Source/amd_l_aat.c +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_aat.c: int64_t version of amd_aat -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - - -#define DLONG -#include "amd_aat.c" - diff --git a/AMD/Source/amd_l_control.c b/AMD/Source/amd_l_control.c deleted file mode 100644 index b14835186..000000000 --- a/AMD/Source/amd_l_control.c +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_control.c: int64_t version of amd_control -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - - -#define DLONG -#include "amd_control.c" - diff --git a/AMD/Source/amd_l_defaults.c b/AMD/Source/amd_l_defaults.c deleted file mode 100644 index 4a7f472f0..000000000 --- a/AMD/Source/amd_l_defaults.c +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_defaults.c: int64_t version of amd_defaults -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - - -#define DLONG -#include "amd_defaults.c" - diff --git a/AMD/Source/amd_l_dump.c b/AMD/Source/amd_l_dump.c deleted file mode 100644 index e14a8a59f..000000000 --- a/AMD/Source/amd_l_dump.c +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_dump.c: int64_t version of amd_dump -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - - -#define DLONG -#include "amd_dump.c" - diff --git a/AMD/Source/amd_l_info.c b/AMD/Source/amd_l_info.c deleted file mode 100644 index 955d4360a..000000000 --- a/AMD/Source/amd_l_info.c +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_info.c: int64_t version of amd_info -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - - -#define DLONG -#include "amd_info.c" - diff --git a/AMD/Source/amd_l_order.c b/AMD/Source/amd_l_order.c deleted file mode 100644 index da8f826ab..000000000 --- a/AMD/Source/amd_l_order.c +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_order.c: int64_t version of amd_order -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - - -#define DLONG -#include "amd_order.c" - diff --git a/AMD/Source/amd_l_post_tree.c b/AMD/Source/amd_l_post_tree.c deleted file mode 100644 index 0169c3444..000000000 --- a/AMD/Source/amd_l_post_tree.c +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_post_tree.c: int64_t version of amd_post_tree -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - -#define DLONG -#include "amd_post_tree.c" - diff --git a/AMD/Source/amd_l_postorder.c b/AMD/Source/amd_l_postorder.c deleted file mode 100644 index 2053c606d..000000000 --- a/AMD/Source/amd_l_postorder.c +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_postorder.c: int64_t version of amd_postorder -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - -#define DLONG -#include "amd_postorder.c" - diff --git a/AMD/Source/amd_l_preprocess.c b/AMD/Source/amd_l_preprocess.c deleted file mode 100644 index 96df6ab49..000000000 --- a/AMD/Source/amd_l_preprocess.c +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_preprocess.c: int64_t version of amd_preprocess -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - -#define DLONG -#include "amd_preprocess.c" - diff --git a/AMD/Source/amd_l_valid.c b/AMD/Source/amd_l_valid.c deleted file mode 100644 index 345168cbe..000000000 --- a/AMD/Source/amd_l_valid.c +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------------------------ -// AMD/Source/amd_l_valid.c: int64_t version of amd_valid -//------------------------------------------------------------------------------ - -// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and -// Iain S. Duff. All Rights Reserved. -// SPDX-License-Identifier: BSD-3-clause - -//------------------------------------------------------------------------------ - -#define DLONG -#include "amd_valid.c" -