Building Polyscope as a shared library on Windows
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 2.2k
- Forks
- 242
- Ø Merge
- 11 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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 😄
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Shared-Library-Target in src/CMakeLists.txt und sehen Sie sich anschließend deps/imgui/CMakeLists.txt und deps/stb/CMakeLists.txt zusammen mit der GLM-Build-Einstellung an. Führen Sie den Windows-Shared-Library-Build aus und ermitteln Sie die freigegebene Dependency-/Export-Konfiguration; abgeschlossen ist die Aufgabe, wenn das Linking ohne nicht aufgelöste Symbole funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cmake, cpp
- Bereich
- build-system, operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100