Skip to content

Commit

Permalink
[build] Always statically build Glass libraries (wpilibsuite#6867)
Browse files Browse the repository at this point in the history
Also don’t rename libglass on Windows to avoid PDB name collision.
  • Loading branch information
Gold856 committed Jul 22, 2024
1 parent 4c7fe73 commit e3a5299
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 11 additions & 4 deletions glass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ include(LinkMacOSGUI)
#
file(GLOB_RECURSE libglass_src src/lib/native/cpp/*.cpp)

add_library(libglass ${libglass_src})
set_target_properties(libglass PROPERTIES DEBUG_POSTFIX "d" OUTPUT_NAME "glass")
add_library(libglass STATIC ${libglass_src})
set_target_properties(libglass PROPERTIES DEBUG_POSTFIX "d")
# Library name can't be glass on Windows or else it will overwrite the Glass app PDB file
if(NOT MSVC)
set_target_properties(libglass PROPERTIES OUTPUT_NAME "glass")
endif()
set_property(TARGET libglass PROPERTY POSITION_INDEPENDENT_CODE ON)

set_property(TARGET libglass PROPERTY FOLDER "libraries")
Expand All @@ -34,8 +38,11 @@ install(DIRECTORY src/lib/native/include/ DESTINATION "${include_dest}/glass")
#
file(GLOB_RECURSE libglassnt_src src/libnt/native/cpp/*.cpp)

add_library(libglassnt ${libglassnt_src})
set_target_properties(libglassnt PROPERTIES DEBUG_POSTFIX "d" OUTPUT_NAME "glassnt")
add_library(libglassnt STATIC ${libglassnt_src})
set_target_properties(libglassnt PROPERTIES DEBUG_POSTFIX "d")
if(NOT MSVC)
set_target_properties(libglassnt PROPERTIES OUTPUT_NAME "glassnt")
endif()
set_property(TARGET libglassnt PROPERTY POSITION_INDEPENDENT_CODE ON)

set_property(TARGET libglassnt PROPERTY FOLDER "libraries")
Expand Down
6 changes: 1 addition & 5 deletions wpigui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ file(GLOB wpigui_windows_src src/main/native/directx11/*.cpp)
file(GLOB wpigui_mac_src src/main/native/metal/*.mm)
file(GLOB wpigui_unix_src src/main/native/opengl3/*.cpp)

if(MSVC)
add_library(wpigui STATIC ${wpigui_src})
else()
add_library(wpigui ${wpigui_src})
endif()
add_library(wpigui STATIC ${wpigui_src})
set_target_properties(wpigui PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET wpigui PROPERTY POSITION_INDEPENDENT_CODE ON)

Expand Down

0 comments on commit e3a5299

Please sign in to comment.