DrTimothyAldenDavis / SuiteSparse

The official SuiteSparse library: a suite of sparse matrix algorithms authored or co-authored by Tim Davis, Texas A&M University.
https://people.engr.tamu.edu/davis/suitesparse.html
Other
1.17k stars 261 forks source link

Mongoose: Prefer shared linking #695

Closed mmuetzel closed 9 months ago

mmuetzel commented 9 months ago

Most projects in SuiteSparse prefer shared linking over static linking. One (maybe the only?) exception is Mongoose.

Change the build rules of Mongoose to also prefer shared linking over static linking (like the other subprojects).

Also, fix an issue with shared linking with MSVC. The approach here is different to the change proposed in #686 and more in line with how this is handled in LAGraph. The change is slightly complicated by the fact that many symbols are declared multiple times for some reason (once in Mongoose.hpp and then again in separate headers).

mmuetzel commented 9 months ago

@whuaegeanse: Does this change also fix the link issue for you?

whuaegeanse commented 9 months ago

@whuaegeanse: Does this change also fix the link issue for you?

Yes. But MSVC reports other errors when building mongoose_unit_test_io

F:\Libs\suitesparse\SuiteSparse\Mongoose\Tests\Mongoose_Test.hpp(26,10): error C1083: 无法打开包括文件: “SuiteSparse_config.h”: No such file or director
y [F:\Libs\suitesparse\SuiteSparse-my-dev2-x64\Mongoose\build\mongoose_unit_test_io.vcxproj]

BUILD_TESTING is defualt on. mongoose_unit_test_io links Mongoose_static by default.

    # Unit Tests
    add_executable ( mongoose_unit_test_io
        Tests/Mongoose_UnitTest_IO_exe.cpp )
    target_link_libraries ( mongoose_unit_test_io Mongoose_static )
    set_target_properties ( mongoose_unit_test_io PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )
    add_test ( NAME Mongoose_Unit_Test_IO
        COMMAND ${TESTING_OUTPUT_PATH}/mongoose_unit_test_io
        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Tests )
mmuetzel commented 9 months ago

Thanks. I've missed that executable.

Does it build now?

whuaegeanse commented 9 months ago

Thanks. I've missed that executable.

Does it build now?

Yes.