Sfoglia il codice sorgente

CMake: Build Windows modules with file descriptors

Matt Gajownik 6 anni fa
parent
commit
51be039cf8

+ 5 - 0
CMakeLists.txt

@@ -57,6 +57,11 @@ if(WIN32)
 	list(GET UI_VERSION_SEMANTIC 0 UI_VERSION_MAJOR)
 	list(GET UI_VERSION_SEMANTIC 1 UI_VERSION_MINOR)
 	list(GET UI_VERSION_SEMANTIC 2 UI_VERSION_PATCH)
+	set(OBS_COMPANY_NAME "OBS")
+	set(OBS_PRODUCT_NAME "OBS Studio")
+	set(OBS_COMMENTS "Free and open source software for video recording and live streaming")
+	set(OBS_LEGAL_COPYRIGHT "(C) Hugh Bailey")
+	set(MODULE_DESCRIPTION "OBS Studio")
 	configure_file(UI/obs.rc.in ${PROJECT_BINARY_DIR}/obs.rc)
 endif()
 

+ 7 - 0
UI/frontend-plugins/decklink-output-ui/CMakeLists.txt

@@ -39,6 +39,13 @@ set(decklink-ouput-ui_UI
 	forms/output.ui
 	)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS DeckLink Output UI")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in decklink-ouput-ui.rc)
+	list(APPEND decklink-ouput-ui_SOURCES
+		decklink-ouput-ui.rc)
+endif()
+
 if(APPLE)
 	set(decklink-ouput-ui_PLATFORM_LIBS
 		${COCOA})

+ 4 - 1
UI/frontend-plugins/frontend-tools/CMakeLists.txt

@@ -71,8 +71,11 @@ if(SCRIPTING_ENABLED)
 endif()
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Frontend Tools")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in frontend-tools.rc)
 	set(frontend-tools_PLATFORM_SOURCES
-		auto-scene-switcher-win.cpp)
+		auto-scene-switcher-win.cpp
+		frontend-tools.rc)
 
 	if(BUILD_CAPTIONS)
 		set(frontend-tools_PLATFORM_SOURCES

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

@@ -7,6 +7,12 @@ add_definitions(-DLIBOBS_EXPORTS)
 set(obs-frontend-api_SOURCES
 	obs-frontend-api.cpp)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Frontend API")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in ./obs-frontend-api.rc)
+	list(APPEND obs-frontend-api_SOURCES
+		obs-frontend-api.rc)
+endif()
 set(obs-frontend-api_HEADERS
 	obs-frontend-internal.hpp
 	obs-frontend-api.h)

+ 24 - 0
cmake/winrc/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${UI_VERSION_MAJOR},${UI_VERSION_MINOR},${UI_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "${MODULE_DESCRIPTION}"
+      VALUE "FileVersion", "${UI_VERSION}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${UI_VERSION}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "${PROJECT_NAME}"
+      VALUE "OriginalFilename", "${PROJECT_NAME}"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 4 - 1
deps/glad/CMakeLists.txt

@@ -11,9 +11,12 @@ set(glad_SOURCES
 	include/glad/glad.h)
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "Glad OpenGL Loading Library")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obsglad.rc)
 	set(glad_PLATFORM_SOURCES
 		src/glad_wgl.c
-		include/glad/glad_wgl.h)
+		include/glad/glad_wgl.h
+		obsglad.rc)
 elseif(NOT APPLE)
 	set(glad_PLATFORM_SOURCES
 		src/glad_glx.c

+ 7 - 0
deps/obs-scripting/CMakeLists.txt

@@ -148,6 +148,13 @@ set(obs-scripting_HEADERS
 	cstrcache.h
 	)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Studio scripting module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-scripting.rc)
+	list(APPEND obs-scripting_SOURCES
+		obs-scripting.rc)
+endif()
+
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/swig)
 
 if(PYTHONLIBS_FOUND)

+ 4 - 1
deps/w32-pthreads/CMakeLists.txt

@@ -4,8 +4,11 @@ if(NOT WIN32)
 	return()
 endif()
 
+set(MODULE_DESCRIPTION "POSIX Threads for Windows")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in w32-pthreads.rc)
 set(w32-pthreads_SOURCES
-	pthread.c)
+	pthread.c
+	w32-pthreads.rc)
 
 set(w32-pthreads_HEADERS
 	implement.h

+ 5 - 1
libobs-d3d11/CMakeLists.txt

@@ -4,6 +4,9 @@ include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
 
 add_definitions(-DLIBOBS_EXPORTS)
 
+set(MODULE_DESCRIPTION "OBS Library D3D11 wrapper")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in libobs-d3d11.rc)
+
 if(NOT DEFINED GPU_PRIORITY_VAL OR "${GPU_PRIORITY_VAL}" STREQUAL "" OR
    "${GPU_PRIORITY_VAL}" STREQUAL "0")
 	set(USE_GPU_PRIORITY FALSE)
@@ -29,7 +32,8 @@ set(libobs-d3d11_SOURCES
 	d3d11-vertexbuffer.cpp
 	d3d11-duplicator.cpp
 	d3d11-rebuild.cpp
-	d3d11-zstencilbuffer.cpp)
+	d3d11-zstencilbuffer.cpp
+	libobs-d3d11.rc)
 
 set(libobs-d3d11_HEADERS
 	${CMAKE_CURRENT_BINARY_DIR}/d3d11-config.h

+ 4 - 1
libobs-opengl/CMakeLists.txt

@@ -7,8 +7,11 @@ include_directories(${OPENGL_INCLUDE_DIR})
 add_definitions(-DLIBOBS_EXPORTS)
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Library OpenGL wrapper")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in libobs-opengl.rc)
 	set(libobs-opengl_PLATFORM_SOURCES
-		gl-windows.c)
+		gl-windows.c
+		libobs-opengl.rc)
 elseif(APPLE)
 	set(libobs-opengl_PLATFORM_SOURCES
 		gl-cocoa.m)

+ 11 - 1
libobs/CMakeLists.txt

@@ -81,12 +81,22 @@ add_definitions(-DLIBOBS_EXPORTS)
 include_directories(${OBS_JANSSON_INCLUDE_DIRS})
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Library")
+	file(STRINGS obs-config.h _version_parse REGEX "^.*(MAJOR|MINOR|PATCH)_VER[ \t]+[0-9]+[ \t]*$")
+
+	string(REGEX REPLACE ".*MAJOR_VER[ \t]+([0-9]+).*" "\\1" UI_VERSION_MAJOR "${_version_parse}")
+	string(REGEX REPLACE ".*MINOR_VER[ \t]+([0-9]+).*" "\\1" UI_VERSION_MINOR "${_version_parse}")
+	string(REGEX REPLACE ".*PATCH_VER[ \t]+([0-9]+).*" "\\1" UI_VERSION_PATCH "${_version_parse}")
+	set(UI_VERSION "${UI_VERSION_MAJOR}.${UI_VERSION_MINOR}.${UI_VERSION_PATCH}")
+
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in libobs.rc)
 	set(libobs_PLATFORM_SOURCES
 		obs-win-crash-handler.c
 		obs-windows.c
 		util/threading-windows.c
 		util/pipe-windows.c
-		util/platform-windows.c)
+		util/platform-windows.c
+		libobs.rc)
 	set(libobs_PLATFORM_HEADERS
 		util/threading-windows.h
 		util/windows/win-registry.h

+ 4 - 0
plugins/coreaudio-encoder/CMakeLists.txt

@@ -4,6 +4,10 @@ set(coreaudio-encoder_SOURCES
 	encoder.cpp)
 
 if (WIN32)
+	set(MODULE_DESCRIPTION "OBS Core Audio encoder")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in coreaudio-encoder.rc)
+	list(APPEND coreaudio-encoder_SOURCES
+		coreaudio-encoder.rc)
 	set(coreaudio-encoder_HEADERS windows-imports.h)
 	set(coreaudio-encoder_LIBS )
 

+ 3 - 1
plugins/decklink/win/CMakeLists.txt

@@ -31,6 +31,8 @@ set(win-decklink_HEADERS
 	../util.hpp
 	)
 
+set(MODULE_DESCRIPTION "OBS DeckLink Windows module")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in win-decklink.rc)
 set(win-decklink_SOURCES
 	../plugin-main.cpp
 	../decklink-devices.cpp
@@ -46,7 +48,7 @@ set(win-decklink_SOURCES
 	../audio-repack.c
 	platform.cpp
 	../util.cpp
-	)
+	win-decklink.rc)
 
 add_idl_files(win-decklink-sdk_GENERATED_FILES
 	${win-decklink-sdk_IDLS}

+ 7 - 0
plugins/image-source/CMakeLists.txt

@@ -10,6 +10,13 @@ set(image-source_SOURCES
 	color-source.c
 	obs-slideshow.c)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS image module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in image-source.rc)
+	list(APPEND image-source_SOURCES
+		image-source.rc)
+endif()
+
 add_library(image-source MODULE
 	${image-source_SOURCES})
 target_link_libraries(image-source

+ 4 - 1
plugins/obs-ffmpeg/CMakeLists.txt

@@ -45,9 +45,12 @@ if(ENABLE_FFMPEG_LOGGING)
 endif()
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "OBS FFmpeg module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-ffmpeg.rc)
 	list(APPEND obs-ffmpeg_SOURCES
 		jim-nvenc.c
-		jim-nvenc-helpers.c)
+		jim-nvenc-helpers.c
+		obs-ffmpeg.rc)
 	list(APPEND obs-ffmpeg_HEADERS
 		jim-nvenc.h)
 endif()

+ 7 - 0
plugins/obs-filters/CMakeLists.txt

@@ -54,6 +54,13 @@ set(obs-filters_SOURCES
 	expander-filter.c
 	luma-key-filter.c)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS A/V Filters")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-filters.rc)
+	list(APPEND obs-filters_SOURCES
+		obs-filters.rc)
+endif()
+
 add_library(obs-filters MODULE
 	${obs-filters_SOURCES}
 	${obs-filters_config_HEADERS}

+ 7 - 0
plugins/obs-outputs/CMakeLists.txt

@@ -155,6 +155,13 @@ set(obs-outputs_SOURCES
 	flv-mux.c
 	net-if.c)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS output module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-outputs.rc)
+	list(APPEND obs-outputs_SOURCES
+		obs-outputs.rc)
+endif()
+
 add_library(obs-outputs MODULE
 	${ftl_SOURCES}
 	${ftl_HEADERS}

+ 7 - 0
plugins/obs-qsv11/CMakeLists.txt

@@ -58,6 +58,13 @@ set(obs-qsv11_SOURCES
 	obs-qsv11.c
 	obs-qsv11-plugin-main.c)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS QSV encoder")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-qsv11.rc)
+	list(APPEND obs-qsv11_SOURCES
+		obs-qsv11.rc)
+endif()
+
 set(obs-qsv11_HEADERS
 	bits/linux_defs.h
 	bits/windows_defs.h

+ 4 - 1
plugins/obs-text/CMakeLists.txt

@@ -5,8 +5,11 @@ endif()
 project(obs-text)
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "OBS GDI+ text module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-text.rc)
 	set(obs-text_PLATFORM_SOURCES
-		gdiplus/obs-text.cpp)
+		gdiplus/obs-text.cpp
+		obs-text.rc)
 	set(obs-text_PLATFORM_DEPS
 		gdiplus)
 endif()

+ 7 - 0
plugins/obs-transitions/CMakeLists.txt

@@ -11,6 +11,13 @@ set(obs-transitions_SOURCES
 	transition-stinger.c
 	)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Transitions module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-transitions.rc)
+	list(APPEND obs-transitions_SOURCES
+		obs-transitions.rc)
+endif()
+
 add_library(obs-transitions MODULE
 	${obs-transitions_SOURCES})
 target_link_libraries(obs-transitions

+ 7 - 0
plugins/obs-x264/CMakeLists.txt

@@ -8,6 +8,13 @@ set(obs-x264_SOURCES
 	obs-x264.c
 	obs-x264-plugin-main.c)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS x264 encoder")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obs-x264.rc)
+	list(APPEND obs-x264_SOURCES
+		obs-x264.rc)
+endif()
+
 add_library(obs-x264 MODULE
 	${obs-x264_SOURCES})
 target_link_libraries(obs-x264

+ 7 - 0
plugins/rtmp-services/CMakeLists.txt

@@ -8,6 +8,13 @@ set(rtmp-services_SOURCES
 	rtmp-custom.c
 	rtmp-services-main.c)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS RTMP Services")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in rtmp-services.rc)
+	list(APPEND rtmp-services_SOURCES
+		rtmp-services.rc)
+endif()
+
 set(rtmp-services_HEADERS
 	twitch.h
 	rtmp-format-ver.h)

+ 4 - 1
plugins/text-freetype2/CMakeLists.txt

@@ -14,9 +14,12 @@ elseif(NOT FREETYPE_FOUND)
 endif()
 
 if(WIN32)
+	set(MODULE_DESCRIPTION "OBS Freetype text module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in text-freetype2.rc)
 	set(text-freetype2_PLATFORM_SOURCES
 		find-font.c
-		find-font-windows.c)
+		find-font-windows.c
+		text-freetype2.rc)
 elseif(APPLE)
 	find_package(Iconv QUIET)
 	if(NOT ICONV_FOUND AND ENABLE_FREETYPE)

+ 7 - 0
plugins/vlc-video/CMakeLists.txt

@@ -31,6 +31,13 @@ set(vlc-video_SOURCES
 	vlc-video-source.c
 	)
 
+if(WIN32)
+	set(MODULE_DESCRIPTION "OBS VLC module")
+	configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in vlc-video.rc)
+	list(APPEND vlc-video_SOURCES
+		vlc-video.rc)
+endif()
+
 add_library(vlc-video MODULE
 	${vlc-video_SOURCES}
 	${vlc-video_HEADERS})

+ 4 - 1
plugins/win-dshow/CMakeLists.txt

@@ -12,11 +12,14 @@ set(win-dshow_HEADERS
 	encode-dstr.hpp
 	ffmpeg-decode.h)
 
+set(MODULE_DESCRIPTION "OBS DirectShow module")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in win-dshow.rc)
 set(win-dshow_SOURCES
 	win-dshow.cpp
 	win-dshow-encoder.cpp
 	dshow-plugin.cpp
-	ffmpeg-decode.c)
+	ffmpeg-decode.c
+	win-dshow.rc)
 
 set(libdshowcapture_SOURCES
 	libdshowcapture/source/capture-filter.cpp

+ 3 - 1
plugins/win-ivcam/CMakeLists.txt

@@ -40,9 +40,11 @@ set(win-ivcam_seg_library_SOURCES
 	${win-ivcam_seg_library_GENERATED_FILES}
 	)
 
+set(MODULE_DESCRIPTION "OBS Intel(R) RealSense(TM) module")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in win-ivcam.rc)
 set(win-ivcam_SOURCES
 	realsense.cpp
-	)
+	win-ivcam.rc)
 
 source_group("seg_library\\Source Files" FILES ${win-ivcam_seg_library_SOURCES})
 source_group("seg_library\\Header Files" FILES ${win-ivcam_seg_library_HEADERS})

+ 6 - 2
plugins/win-mf/CMakeLists.txt

@@ -9,6 +9,8 @@ configure_file(
 set(win-mf_config_HEADERS
 	"${CMAKE_CURRENT_BINARY_DIR}/mf-config.hpp")
 
+set(MODULE_DESCRIPTION "OBS Windows Media Foundations H.264/AAC encoder")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in win-mf.rc)
 if(ENABLE_WINMF)
 	set(win-mf_SOURCES
 		mf-plugin.cpp
@@ -17,7 +19,8 @@ if(ENABLE_WINMF)
 		mf-common.cpp
 		mf-encoder-descriptor.cpp
 		mf-h264.cpp
-		mf-h264-encoder.cpp)
+		mf-h264-encoder.cpp
+		win-mf.rc)
 
 	set(win-mf_HEADERS
 		mf-common.hpp
@@ -35,7 +38,8 @@ if(ENABLE_WINMF)
 		wmcodecdspuuid)
 else()
 	set(win-mf_SOURCES
-		mf-plugin.cpp)
+		mf-plugin.cpp
+		win-mf.rc)
 endif()
 
 add_library(win-mf MODULE

+ 4 - 1
plugins/win-wasapi/CMakeLists.txt

@@ -3,10 +3,13 @@ project(win-wasapi)
 set(win-wasapi_HEADERS
 	enum-wasapi.hpp)
 
+set(MODULE_DESCRIPTION "OBS WASAPI module")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in win-wasapi.rc)
 set(win-wasapi_SOURCES
 	win-wasapi.cpp
 	enum-wasapi.cpp
-	plugin-main.cpp)
+	plugin-main.cpp
+	win-wasapi.rc)
 
 add_library(win-wasapi MODULE
 	${win-wasapi_SOURCES}