Skip to content

CMake find module in pre-built distribution #4396

Closed

Description

@nickanthony-dgl

I can see here that there is a template for a well made find module for OpenBLAS. However, the find module provided with the pre-built releases is extremely basic and doesn't work without modification.

Where does the nicer find module get used? Is there a reason not to include it with the download?

Activity

  1. martin-frbg commented on Dec 27, 2023

    @martin-frbg
    Collaborator

    The .cmake.in gets serves as a template during the install step to create the .cmake module. Which release did you look at ? I think there used to be a problem where the Makefile and CMake builds did not create the same "nice" quality module.

  2. nickanthony-dgl commented on Dec 27, 2023

    @nickanthony-dgl
    Author

    I am using the 0.3.25-x64 release for Windows. The contents of OpenBLASConfig.cmake are:

    SET(OpenBLAS_VERSION "0.3.25")
    SET(OpenBLAS_INCLUDE_DIRS win64/include)
    SET(OpenBLAS_LIBRARIES win64/bin/libopenblas.dll)

    which doesn't work without some changes.

  3. martin-frbg commented on Dec 27, 2023

    @martin-frbg
    Collaborator

    Sorry, I really do not know how to improve this - the precompiled binaries are provided as a convenience for anybody who cannot build their own, and I have no idea where they would end up on a user's system. The paths you saw simply correspond to the (relative) install locations on my build host - which currently happens to be a Linux system with a mingw(gcc)-based cross-compiler

  4. nickanthony-dgl commented on Dec 27, 2023

    @nickanthony-dgl
    Author

    Here is what I am using which I think would be an improvement.

    SET(OpenBLAS_VERSION "0.3.25")
    file(REAL_PATH "../../.." _OpenBLAS_ROOT_DIR BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} )
    SET(OpenBLAS_INCLUDE_DIRS ${_OpenBLAS_ROOT_DIR}/include)
    SET(OpenBLAS_LIBRARIES ${_OpenBLAS_ROOT_DIR}/bin/libopenblas.dll)
    add_library(OpenBLAS::OpenBLAS SHARED IMPORTED)
    target_include_directories(OpenBLAS::OpenBLAS INTERFACE ${OpenBLAS_INCLUDE_DIRS})
    set_property(TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_LOCATION ${OpenBLAS_LIBRARIES})
    set_property(TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB ${_OpenBLAS_ROOT_DIR}/lib/libopenblas.lib)

    The user just needs to set an OpenBLAS_DIR cache variable that points to the location of the find module. The find module will provide the same OpenBLAS::OpenBLAS target that you gen when building from source or using VCPKG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions