Skip to content

add msvc support and other bugs #38

Open
@Dath-Ohne-R

Description

@Dath-Ohne-R

This project is most useful, but lacks generality. It seems its optimized for g++ only. I would like to have microsoft visual studio c++ compiler (msvc) support for it as well. Furthermore, I found some different things that might be a bug.
My build-system: CMake 3.31.0, c++ 20, MSVC 19.41.34123.0.
All references are from commit 4d025b5 of master.

MSVC-Support:
I recommend to change common.h line 9 as follows, as visibility is not supported by msvc
#ifdef _MSC_VER
#define DECL_STRUCT_ATTR
#else
#define DECL_STRUCT_ATTR attribute((visibility("hidden")))
#endif

CMakeLists.txt line 44 gave an error as it said that the word "optimized" is used - seems to be in ${Python3_LIBRARIES}. I tried to exchanged it with this:
target_link_libraries(matplotlibcpp17::matplotlibcpp17 INTERFACE ${Python3_LIBRARIES} pybind11::embed)
But then python3XX.lib is not found during linking. I could not find a solution.

Snippet of my CMakeLists.txt for comparison:
set(pybind11_DIR "path/to/pybind11")
add_subdirectory(ExtLibs/matplotlibcpp17)
target_link_libraries(projectname PRIVATE matplotlibcpp17::matplotlibcpp17)

I would highly appreciate if the author(s) of this repo would check their code for compatibility with msvc and check the issues I had.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions