Building Polyscope as a shared library on Windows
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 2.2k
- Fork
- 242
- Merge trung bình
- 11 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
On Windows, I managed to build polyscope as a shared library with a couple of changes:
- Export all symbols for polyscope
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -374,4 +374,7 @@
set_target_properties(polyscope PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
add_definitions(-DNOMINMAX)
+set_target_properties(polyscope PROPERTIES
+ WINDOWS_EXPORT_ALL_SYMBOLS ON
+)
# Include settings
- Force
imguias static. Again, it would search for a .lib file but no symbols are exported.
--- a/deps/imgui/CMakeLists.txt
+++ b/deps/imgui/CMakeLists.txt
@@ -63,5 +63,5 @@
add_library(
- imgui
+ imgui STATIC
${SRCS}
)
Alternative: Export all symbols like 1.
- Force
stbas static. Otherwise, it would search for a non-existent .lib file because no symbols are exported.
--- a/deps/stb/CMakeLists.txt
+++ b/deps/stb/CMakeLists.txt
@@ -1,5 +1,5 @@
# Create a library for the viewer code
add_library(
- stb
+ stb STATIC
stb_impl.cpp
)
I tried exporting all symbols but it did not work. I would get missing symbols:
[build] screenshot.cpp.obj : error LNK2001: unresolved external symbol "int stbi_write_png_compression_level" (?stbi_write_png_compression_level@@3HA)
- Tell glm to not build a library. It is header-only anyway:
set(GLM_BUILD_LIBRARY OFF CACHE BOOL "Use GLM as header-only" FORCE)
It is not optimal to export all symbols on Windows, but it works. Dropping this here for others to use.
Open to make a PR but I would rather figure out the approved method first 😄
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với target shared-library trong src/CMakeLists.txt, sau đó kiểm tra deps/imgui/CMakeLists.txt và deps/stb/CMakeLists.txt cùng với thiết lập build của GLM. Chạy bản build shared-library trên Windows và xác định cấu hình dependency/export được phê duyệt; hoàn tất khi nó liên kết mà không có symbol chưa được phân giải.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cmake, cpp
- Lĩnh vực
- build-system, operating-systems
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100