From 4a93581f1a80bf59809f6bb6d285bedcd3ffb944 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 20 Oct 2023 16:44:26 -0700 Subject: [PATCH] [build] cmake: use default library type for libglassnt, libglass, wpigui, and imgui (#5797) On Windows, imgui and wpigui need to be static. On Mac, they must be dynamic. --- glass/CMakeLists.txt | 4 ++-- imgui/CMakeLists.txt | 10 +++++++--- wpigui/CMakeLists.txt | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/glass/CMakeLists.txt b/glass/CMakeLists.txt index 5bf89fb7b7..b949fc00fe 100644 --- a/glass/CMakeLists.txt +++ b/glass/CMakeLists.txt @@ -9,7 +9,7 @@ include(LinkMacOSGUI) # file(GLOB_RECURSE libglass_src src/lib/native/cpp/*.cpp) -add_library(libglass STATIC ${libglass_src}) +add_library(libglass ${libglass_src}) set_target_properties(libglass PROPERTIES DEBUG_POSTFIX "d" OUTPUT_NAME "glass") set_property(TARGET libglass PROPERTY POSITION_INDEPENDENT_CODE ON) @@ -30,7 +30,7 @@ install(DIRECTORY src/lib/native/include/ DESTINATION "${include_dest}/glass") # file(GLOB_RECURSE libglassnt_src src/libnt/native/cpp/*.cpp) -add_library(libglassnt STATIC ${libglassnt_src}) +add_library(libglassnt ${libglassnt_src}) set_target_properties(libglassnt PROPERTIES DEBUG_POSTFIX "d" OUTPUT_NAME "glassnt") set_property(TARGET libglassnt PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/imgui/CMakeLists.txt b/imgui/CMakeLists.txt index 36fcb0e806..6ba8455bc7 100644 --- a/imgui/CMakeLists.txt +++ b/imgui/CMakeLists.txt @@ -69,15 +69,19 @@ endif() file(GLOB imgui_sources ${imgui_SOURCE_DIR}/*.cpp ${imgui_SOURCE_DIR}/misc/cpp/*.cpp) file(GLOB implot_sources ${implot_SOURCE_DIR}/*.cpp) file(GLOB fonts_sources ${fonts_SOURCE_DIR}/src/*.cpp) -add_library(imgui STATIC +set(imgui_all_sources ${imgui_sources} ${implot_sources} ${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp ${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp ${gl3w_BINARY_DIR}/src/gl3w.c ${fonts_sources} - src/stb_image.cpp -) + src/stb_image.cpp) +if (MSVC) + add_library(imgui STATIC ${imgui_all_sources}) +else() + add_library(imgui ${imgui_all_sources}) +endif() target_compile_definitions(imgui PUBLIC IMGUI_IMPL_OPENGL_LOADER_GL3W) if (MSVC) target_sources(imgui PRIVATE ${imgui_SOURCE_DIR}/backends/imgui_impl_dx11.cpp) diff --git a/wpigui/CMakeLists.txt b/wpigui/CMakeLists.txt index edcc7fe402..68acbea643 100644 --- a/wpigui/CMakeLists.txt +++ b/wpigui/CMakeLists.txt @@ -8,7 +8,11 @@ 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) -add_library(wpigui STATIC ${wpigui_src}) +if (MSVC) + add_library(wpigui STATIC ${wpigui_src}) +else() + add_library(wpigui ${wpigui_src}) +endif() set_target_properties(wpigui PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET wpigui PROPERTY POSITION_INDEPENDENT_CODE ON)