nmwsharp / nmwsharp/polyscope

Building Polyscope as a shared library on Windows

オープン
#330 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C++
スター
2.2k
フォーク
242
平均マージ
11分
マージ済み PR(30日)
1

説明

On Windows, I managed to build polyscope as a shared library with a couple of changes:

  1. 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
  1. Force imgui as 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.

  1. Force stb as 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)
  1. 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 😄

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

src/CMakeLists.txt の shared-library ターゲットから始め、deps/imgui/CMakeLists.txt と deps/stb/CMakeLists.txt を GLM のビルド設定と併せて確認します。Windows の shared-library ビルドを実行し、承認済みの依存関係/エクスポート設定を特定します。未解決シンボルなしでリンクできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cmake, cpp
領域
build-system, operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。