Browse Source

UI: Update CMake target source lists with alphabetic sorting

Also updates CMake formatting with manual format choices.
PatTheMav 2 years ago
parent
commit
dc41069619

+ 1 - 3
UI/CMakeLists.txt

@@ -79,8 +79,6 @@ target_sources(
           platform.hpp
           qt-display.cpp
           qt-display.hpp
-          qt-wrappers.cpp
-          qt-wrappers.hpp
           ui-config.h
           ui-validation.cpp
           ui-validation.hpp)
@@ -91,7 +89,7 @@ elseif(OS_MACOS)
   include(cmake/os-macos.cmake)
 elseif(OS_LINUX)
   include(cmake/os-linux.cmake)
-elseif(OS_FREEBSD)
+elseif(OS_FREEBSD OR OS_OPENBSD)
   include(cmake/os-freebsd.cmake)
 endif()
 

+ 4 - 2
UI/cmake/feature-browserpanels.cmake

@@ -3,6 +3,8 @@ if(TARGET OBS::browser-panels)
 
   target_link_libraries(obs-studio PRIVATE OBS::browser-panels)
 
-  target_sources(obs-studio PRIVATE window-dock-browser.cpp window-dock-browser.hpp window-extra-browsers.cpp
-                                    window-extra-browsers.hpp)
+  target_sources(
+    obs-studio
+    PRIVATE # cmake-format: sortable
+            window-dock-browser.cpp window-dock-browser.hpp window-extra-browsers.cpp window-extra-browsers.hpp)
 endif()

+ 5 - 2
UI/cmake/feature-importers.cmake

@@ -1,2 +1,5 @@
-target_sources(obs-studio PRIVATE importers/classic.cpp importers/importers.cpp importers/importers.hpp
-                                  importers/sl.cpp importers/studio.cpp importers/xsplit.cpp)
+target_sources(
+  obs-studio
+  PRIVATE # cmake-format: sortable
+          importers/classic.cpp importers/importers.cpp importers/importers.hpp importers/sl.cpp importers/studio.cpp
+          importers/xsplit.cpp)

+ 2 - 0
UI/cmake/feature-whatsnew.cmake

@@ -1,3 +1,5 @@
+include_guard(DIRECTORY)
+
 option(ENABLE_WHATSNEW "Enable WhatsNew dialog" ON)
 
 if(ENABLE_WHATSNEW AND TARGET OBS::browser-panels)

+ 2 - 1
UI/cmake/feature-youtube.cmake

@@ -1,7 +1,8 @@
 if(YOUTUBE_CLIENTID
    AND YOUTUBE_SECRET
    AND YOUTUBE_CLIENTID_HASH MATCHES "^(0|[a-fA-F0-9]+)$"
-   AND YOUTUBE_SECRET_HASH MATCHES "^(0|[a-fA-F0-9]+)$")
+   AND YOUTUBE_SECRET_HASH MATCHES "^(0|[a-fA-F0-9]+)$"
+   AND TARGET OBS::browser-panels)
   target_sources(
     obs-studio
     PRIVATE # cmake-format: sortable

+ 1 - 3
UI/cmake/os-macos.cmake

@@ -3,9 +3,7 @@ if(NOT XCODE)
 endif()
 
 target_sources(obs-studio PRIVATE platform-osx.mm forms/OBSPermissions.ui window-permissions.cpp window-permissions.hpp)
-target_compile_options(
-  obs-studio PRIVATE -Wno-error=float-conversion -Wno-error=implicit-int-conversion -Wno-error=shorten-64-to-32
-                     -Wno-quoted-include-in-framework-header -Wno-comma)
+target_compile_options(obs-studio PRIVATE -Wno-quoted-include-in-framework-header -Wno-comma)
 
 set_source_files_properties(platform-osx.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
 

+ 11 - 6
UI/cmake/os-windows.cmake

@@ -14,12 +14,14 @@ configure_file(cmake/windows/obs.rc.in obs.rc)
 
 target_sources(
   obs-studio
-  PRIVATE obs.rc
-          platform-windows.cpp
-          win-dll-blocklist.c
+  PRIVATE # cmake-format: sortable
           cmake/windows/obs.manifest
+          obs.rc
+          platform-windows.cpp
           update/crypto-helpers-mbedtls.cpp
           update/crypto-helpers.hpp
+          update/models/branches.hpp
+          update/models/whatsnew.hpp
           update/shared-update.cpp
           update/shared-update.hpp
           update/update-helpers.cpp
@@ -28,19 +30,21 @@ target_sources(
           update/update-window.hpp
           update/win-update.cpp
           update/win-update.hpp
-          update/models/branches.hpp
-          update/models/whatsnew.hpp
+          win-dll-blocklist.c
           win-update/updater/manifest.hpp)
 
 target_link_libraries(obs-studio PRIVATE crypt32 OBS::blake2 OBS::w32-pthreads MbedTLS::MbedTLS
                                          nlohmann_json::nlohmann_json Detours::Detours)
+
 target_compile_definitions(obs-studio PRIVATE PSAPI_VERSION=2)
-target_link_options(obs-studio PRIVATE /IGNORE:4098 /IGNORE:4099)
+
+target_link_options(obs-studio PRIVATE /IGNORE:4099)
 
 add_library(obs-update-helpers INTERFACE)
 add_library(OBS::update-helpers ALIAS obs-update-helpers)
 
 target_sources(obs-update-helpers INTERFACE win-update/win-update-helpers.cpp win-update/win-update-helpers.hpp)
+
 target_include_directories(obs-update-helpers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/win-update")
 
 # Set commit for untagged version comparisons in the Windows updater
@@ -49,6 +53,7 @@ if(OBS_VERSION MATCHES ".+g[a-f0-9]+.*")
 else()
   set(OBS_COMMIT "")
 endif()
+
 set_source_files_properties(update/win-update.cpp PROPERTIES COMPILE_DEFINITIONS OBS_COMMIT="${OBS_COMMIT}")
 
 add_subdirectory(win-update/updater)

+ 29 - 16
UI/cmake/ui-elements.cmake

@@ -1,3 +1,32 @@
+add_library(obs-ui-support INTERFACE)
+add_library(OBS::ui-support ALIAS obs-ui-support)
+
+target_sources(
+  obs-ui-support
+  INTERFACE # cmake-format: sortable
+            clickable-label.hpp
+            double-slider.cpp
+            double-slider.hpp
+            horizontal-scroll-area.cpp
+            horizontal-scroll-area.hpp
+            plain-text-edit.cpp
+            plain-text-edit.hpp
+            properties-view.cpp
+            properties-view.hpp
+            properties-view.moc.hpp
+            qt-wrappers.cpp
+            qt-wrappers.hpp
+            slider-ignorewheel.cpp
+            slider-ignorewheel.hpp
+            spinbox-ignorewheel.cpp
+            spinbox-ignorewheel.hpp
+            vertical-scroll-area.cpp
+            vertical-scroll-area.hpp)
+
+target_include_directories(obs-ui-support INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+target_link_libraries(obs-studio PRIVATE OBS::ui-support)
+
 target_sources(
   obs-studio
   PRIVATE # cmake-format: sortable
@@ -6,15 +35,10 @@ target_sources(
           audio-encoders.cpp
           audio-encoders.hpp
           balance-slider.hpp
-          clickable-label.hpp
           context-bar-controls.cpp
           context-bar-controls.hpp
-          double-slider.cpp
-          double-slider.hpp
           focus-list.cpp
           focus-list.hpp
-          horizontal-scroll-area.cpp
-          horizontal-scroll-area.hpp
           hotkey-edit.cpp
           hotkey-edit.hpp
           item-widget-helpers.cpp
@@ -30,11 +54,6 @@ target_sources(
           menu-button.cpp
           menu-button.hpp
           mute-checkbox.hpp
-          plain-text-edit.cpp
-          plain-text-edit.hpp
-          properties-view.cpp
-          properties-view.hpp
-          properties-view.moc.hpp
           record-button.cpp
           record-button.hpp
           remote-text.cpp
@@ -44,20 +63,14 @@ target_sources(
           screenshot-obj.hpp
           slider-absoluteset-style.cpp
           slider-absoluteset-style.hpp
-          slider-ignorewheel.cpp
-          slider-ignorewheel.hpp
           source-label.cpp
           source-label.hpp
           source-tree.cpp
           source-tree.hpp
-          spinbox-ignorewheel.cpp
-          spinbox-ignorewheel.hpp
           undo-stack-obs.cpp
           undo-stack-obs.hpp
           url-push-button.cpp
           url-push-button.hpp
-          vertical-scroll-area.cpp
-          vertical-scroll-area.hpp
           visibility-item-widget.cpp
           visibility-item-widget.hpp
           volume-control.cpp

+ 3 - 1
UI/cmake/ui-qt.cmake

@@ -2,7 +2,9 @@
 find_package(Qt6 REQUIRED Widgets Network Svg Xml)
 # cmake-format: on
 
-if(NOT OS_WINDOWS AND NOT OS_MACOS)
+if(OS_LINUX
+   OR OS_FREEBSD
+   OR OS_OPENBSD)
   find_package(Qt6 REQUIRED Gui)
 endif()
 

+ 2 - 0
UI/obs-frontend-api/CMakeLists.txt

@@ -18,6 +18,8 @@ elseif(OS_MACOS)
   set_target_properties(obs-frontend-api PROPERTIES SOVERSION 1)
 endif()
 
+# cmake-format: off
 set_target_properties_obs(obs-frontend-api PROPERTIES FOLDER frontend PREFIX "" PUBLIC_HEADER obs-frontend-api.h)
+# cmake-format: on
 
 target_export(obs-frontend-api)

+ 3 - 2
UI/win-update/updater/CMakeLists.txt

@@ -22,13 +22,14 @@ target_sources(
           updater.manifest
           updater.rc)
 
-target_compile_options(updater PRIVATE $<IF:$<CONFIG:DEBUG>,/MTd,/MT> "/utf-8")
 target_compile_definitions(updater PRIVATE NOMINMAX "PSAPI_VERSION=2")
 
 target_include_directories(updater PRIVATE "${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_SOURCE_DIR}/UI/win-update")
 
 target_link_libraries(updater PRIVATE OBS::blake2 nlohmann_json::nlohmann_json zstd::libzstd_static comctl32 shell32
                                       winhttp)
-target_link_options(updater PRIVATE /IGNORE:4098)
+
+# zstd is hardcoded with /DEFAULTLIB:LIBCMT
+target_link_options(updater PRIVATE /NODEFAULTLIB:LIBCMT)
 
 set_target_properties(updater PROPERTIES FOLDER frontend OUTPUT_NAME updater)