Skip to content

Commit

Permalink
AMD: Avoid stubs in favor of object libraries.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mmuetzel committed Oct 17, 2024
1 parent 39c23ae commit d381f4d
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 168 deletions.
29 changes: 23 additions & 6 deletions AMD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_OBJECTS:amd_i> $<TARGET_OBJECTS:amd_l> )
set_target_properties ( AMD PROPERTIES
VERSION ${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}
C_STANDARD 11
Expand All @@ -107,7 +119,8 @@ endif ( )
#-------------------------------------------------------------------------------

if ( BUILD_STATIC_LIBS )
add_library ( AMD_static STATIC ${AMD_SOURCES} )
add_library ( AMD_static STATIC
$<TARGET_OBJECTS:amd_i> $<TARGET_OBJECTS:amd_l> )
set_target_properties ( AMD_static PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED ON
Expand Down Expand Up @@ -135,6 +148,10 @@ endif ( )
#-------------------------------------------------------------------------------

# SuiteSparseConfig:
target_include_directories ( amd_i PRIVATE
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>" )
target_include_directories ( amd_l PRIVATE
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>" )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( AMD PRIVATE SuiteSparse::SuiteSparseConfig )
target_include_directories ( AMD PUBLIC
Expand Down
13 changes: 0 additions & 13 deletions AMD/Source/amd_l1.c

This file was deleted.

13 changes: 0 additions & 13 deletions AMD/Source/amd_l2.c

This file was deleted.

14 changes: 0 additions & 14 deletions AMD/Source/amd_l_aat.c

This file was deleted.

14 changes: 0 additions & 14 deletions AMD/Source/amd_l_control.c

This file was deleted.

14 changes: 0 additions & 14 deletions AMD/Source/amd_l_defaults.c

This file was deleted.

14 changes: 0 additions & 14 deletions AMD/Source/amd_l_dump.c

This file was deleted.

14 changes: 0 additions & 14 deletions AMD/Source/amd_l_info.c

This file was deleted.

14 changes: 0 additions & 14 deletions AMD/Source/amd_l_order.c

This file was deleted.

13 changes: 0 additions & 13 deletions AMD/Source/amd_l_post_tree.c

This file was deleted.

13 changes: 0 additions & 13 deletions AMD/Source/amd_l_postorder.c

This file was deleted.

13 changes: 0 additions & 13 deletions AMD/Source/amd_l_preprocess.c

This file was deleted.

13 changes: 0 additions & 13 deletions AMD/Source/amd_l_valid.c

This file was deleted.

0 comments on commit d381f4d

Please sign in to comment.