2014-01-20 07:58:58 -08:00
|
|
|
project(libobs)
|
|
|
|
|
2014-09-23 05:05:53 -07:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2014-09-23 06:26:08 -07:00
|
|
|
find_package(FFMpeg REQUIRED
|
|
|
|
COMPONENTS avformat avutil swscale swresample
|
|
|
|
OPTIONAL_COMPONENTS avcodec)
|
|
|
|
include_directories(${FFMPEG_INCLUDE_DIRS})
|
2014-02-18 12:37:56 -08:00
|
|
|
|
2014-09-23 06:26:08 -07:00
|
|
|
list(REMOVE_ITEM FFMPEG_LIBRARIES ${FFMPEG_AVCODEC_LIBRARIES})
|
2014-01-20 07:58:58 -08:00
|
|
|
|
2014-06-28 11:37:33 -07:00
|
|
|
find_package(ImageMagick QUIET COMPONENTS MagickCore)
|
|
|
|
|
2014-09-23 06:26:08 -07:00
|
|
|
if(NOT ImageMagick_MagickCore_FOUND AND NOT FFMPEG_AVCODEC_FOUND)
|
2014-06-28 11:37:33 -07:00
|
|
|
message(FATAL_ERROR "Either MagickCore or Libavcodec is required, but both were not found")
|
|
|
|
endif()
|
|
|
|
|
2014-12-04 06:38:58 -08:00
|
|
|
option(LIBOBS_PREFER_IMAGEMAGICK "Prefer ImageMagick over ffmpeg for image loading" OFF)
|
2014-06-28 11:37:33 -07:00
|
|
|
|
2014-09-23 06:26:08 -07:00
|
|
|
if(NOT FFMPEG_AVCODEC_FOUND OR (ImageMagick_MagickCore_FOUND AND LIBOBS_PREFER_IMAGEMAGICK))
|
2014-06-28 11:37:33 -07:00
|
|
|
message(STATUS "Using ImageMagick for image loading in libobs")
|
|
|
|
|
|
|
|
set(libobs_image_loading_SOURCES
|
|
|
|
graphics/graphics-magick.c)
|
|
|
|
set(libobs_image_loading_LIBRARIES
|
|
|
|
${ImageMagick_LIBRARIES})
|
|
|
|
|
2014-09-23 06:26:08 -07:00
|
|
|
include_directories(${ImageMagick_INCLUDE_DIRS})
|
2014-06-28 11:37:33 -07:00
|
|
|
else()
|
|
|
|
message(STATUS "Using libavcodec for image loading in libobs")
|
|
|
|
|
|
|
|
set(libobs_image_loading_SOURCES
|
|
|
|
graphics/graphics-ffmpeg.c)
|
|
|
|
set(libobs_image_loading_LIBRARIES
|
2014-09-23 06:26:08 -07:00
|
|
|
${FFMPEG_AVCODEC_LIBRARIES})
|
2014-06-28 11:37:33 -07:00
|
|
|
endif()
|
2014-06-27 15:33:03 -07:00
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
add_definitions(-DLIBOBS_EXPORTS)
|
|
|
|
|
2014-07-17 09:02:43 -07:00
|
|
|
include_directories(${OBS_JANSSON_INCLUDE_DIRS})
|
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
if(WIN32)
|
|
|
|
set(libobs_PLATFORM_SOURCES
|
2015-01-02 05:57:06 -08:00
|
|
|
obs-win-crash-handler.c
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-windows.c
|
2014-02-26 22:43:31 -08:00
|
|
|
util/threading-windows.c
|
2014-11-26 21:36:48 -08:00
|
|
|
util/pipe-windows.c
|
2014-01-20 07:58:58 -08:00
|
|
|
util/platform-windows.c)
|
2015-02-03 21:10:20 -08:00
|
|
|
set(libobs_PLATFORM_DEPS winmm)
|
|
|
|
if(MSVC)
|
|
|
|
set(libobs_PLATFORM_DEPS
|
|
|
|
${libobs_PLATFORM_DEPS}
|
|
|
|
w32-pthreads)
|
|
|
|
endif()
|
2014-01-20 07:58:58 -08:00
|
|
|
elseif(APPLE)
|
|
|
|
set(libobs_PLATFORM_SOURCES
|
|
|
|
obs-cocoa.c
|
2014-02-26 22:43:31 -08:00
|
|
|
util/threading-posix.c
|
2014-11-26 21:36:48 -08:00
|
|
|
util/pipe-posix.c
|
2014-05-14 17:44:32 -07:00
|
|
|
util/platform-nix.c
|
2014-01-20 07:58:58 -08:00
|
|
|
util/platform-cocoa.m)
|
|
|
|
|
|
|
|
set_source_files_properties(${libobs_PLATFORM_SOURCES}
|
|
|
|
PROPERTIES
|
|
|
|
LANGUAGE C
|
|
|
|
COMPILE_FLAGS "-fobjc-arc")
|
|
|
|
|
|
|
|
find_library(COCOA Cocoa)
|
|
|
|
mark_as_advanced(COCOA)
|
|
|
|
include_directories(${COCOA})
|
|
|
|
|
2014-11-01 13:41:17 -07:00
|
|
|
find_library(APPKIT AppKit)
|
|
|
|
mark_as_advanced(APPKIT)
|
|
|
|
include_directories(${APPKIT})
|
|
|
|
|
|
|
|
find_library(IOKIT IOKit)
|
|
|
|
mark_as_advanced(IOKIT)
|
|
|
|
include_directories(${IOKIT})
|
|
|
|
|
|
|
|
find_library(CARBON Carbon)
|
|
|
|
mark_as_advanced(CARBON)
|
|
|
|
include_directories(${CARBON})
|
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
set(libobs_PLATFORM_DEPS
|
2014-11-01 13:41:17 -07:00
|
|
|
${COCOA}
|
|
|
|
${APPKIT}
|
|
|
|
${IOKIT}
|
|
|
|
${CARBON})
|
2014-01-20 07:58:58 -08:00
|
|
|
elseif(UNIX)
|
|
|
|
set(libobs_PLATFORM_SOURCES
|
|
|
|
obs-nix.c
|
2014-02-26 22:54:05 -08:00
|
|
|
util/threading-posix.c
|
2014-11-26 21:36:48 -08:00
|
|
|
util/pipe-posix.c
|
2014-01-20 07:58:58 -08:00
|
|
|
util/platform-nix.c)
|
2015-05-03 06:45:15 -07:00
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
# use the sysinfo compatibility library on bsd
|
|
|
|
find_package(Libsysinfo REQUIRED)
|
|
|
|
include_directories(${SYSINFO_INCLUDE_DIRS})
|
|
|
|
set(libobs_PLATFORM_DEPS
|
|
|
|
${libobs_PLATFORM_DEPS}
|
|
|
|
${SYSINFO_LIBRARIES})
|
|
|
|
endif()
|
2014-01-20 07:58:58 -08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHc-")
|
2014-01-31 20:17:12 -08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc-")
|
2014-01-20 07:58:58 -08:00
|
|
|
endif()
|
|
|
|
|
2014-04-01 13:11:44 -07:00
|
|
|
configure_file(
|
2014-05-05 09:57:30 -07:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in"
|
|
|
|
"${CMAKE_BINARY_DIR}/config/obsconfig.h")
|
2014-04-01 13:11:44 -07:00
|
|
|
|
|
|
|
set(libobs_config_HEADERS
|
2014-05-05 09:57:30 -07:00
|
|
|
"${CMAKE_BINARY_DIR}/config/obsconfig.h"
|
2014-04-01 13:11:44 -07:00
|
|
|
obs-config.h)
|
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
set(libobs_callback_SOURCES
|
|
|
|
callback/calldata.c
|
2014-03-01 04:54:55 -08:00
|
|
|
callback/decl.c
|
2014-01-20 07:58:58 -08:00
|
|
|
callback/signal.c
|
|
|
|
callback/proc.c)
|
|
|
|
set(libobs_callback_HEADERS
|
|
|
|
callback/calldata.h
|
2014-03-01 04:54:55 -08:00
|
|
|
callback/decl.h
|
2014-01-20 07:58:58 -08:00
|
|
|
callback/proc.h
|
|
|
|
callback/signal.h)
|
|
|
|
|
|
|
|
set(libobs_graphics_SOURCES
|
2014-06-28 11:37:33 -07:00
|
|
|
${libobs_image_loading_SOURCES}
|
2014-01-20 07:58:58 -08:00
|
|
|
graphics/quat.c
|
|
|
|
graphics/effect-parser.c
|
|
|
|
graphics/axisang.c
|
|
|
|
graphics/vec4.c
|
|
|
|
graphics/vec2.c
|
|
|
|
graphics/texture-render.c
|
|
|
|
graphics/bounds.c
|
|
|
|
graphics/matrix3.c
|
|
|
|
graphics/matrix4.c
|
|
|
|
graphics/vec3.c
|
|
|
|
graphics/graphics.c
|
|
|
|
graphics/shader-parser.c
|
|
|
|
graphics/plane.c
|
|
|
|
graphics/effect.c
|
|
|
|
graphics/math-extra.c
|
|
|
|
graphics/graphics-imports.c)
|
|
|
|
set(libobs_graphics_HEADERS
|
|
|
|
graphics/plane.h
|
|
|
|
graphics/quat.h
|
|
|
|
graphics/input.h
|
|
|
|
graphics/axisang.h
|
|
|
|
graphics/shader-parser.h
|
|
|
|
graphics/effect.h
|
|
|
|
graphics/math-defs.h
|
|
|
|
graphics/matrix4.h
|
|
|
|
graphics/graphics.h
|
|
|
|
graphics/graphics-internal.h
|
2014-03-29 17:29:02 -07:00
|
|
|
graphics/device-exports.h
|
2014-01-20 07:58:58 -08:00
|
|
|
graphics/vec2.h
|
|
|
|
graphics/vec4.h
|
|
|
|
graphics/matrix3.h
|
|
|
|
graphics/vec3.h
|
|
|
|
graphics/math-extra.h
|
|
|
|
graphics/bounds.h
|
|
|
|
graphics/effect-parser.h)
|
|
|
|
|
|
|
|
set(libobs_mediaio_SOURCES
|
|
|
|
media-io/video-io.c
|
2014-04-15 08:23:38 -07:00
|
|
|
media-io/video-fourcc.c
|
2014-04-23 15:25:39 -07:00
|
|
|
media-io/video-matrices.c
|
2014-02-18 12:37:56 -08:00
|
|
|
media-io/audio-io.c
|
|
|
|
media-io/video-frame.c
|
2014-01-20 07:58:58 -08:00
|
|
|
media-io/format-conversion.c
|
2014-02-18 12:37:56 -08:00
|
|
|
media-io/audio-resampler-ffmpeg.c
|
2014-09-02 19:10:44 -07:00
|
|
|
media-io/video-scaler-ffmpeg.c
|
|
|
|
media-io/media-remux.c)
|
2014-01-20 07:58:58 -08:00
|
|
|
set(libobs_mediaio_HEADERS
|
2014-02-14 14:13:36 -08:00
|
|
|
media-io/media-io-defs.h
|
2014-01-20 07:58:58 -08:00
|
|
|
media-io/video-io.h
|
2014-02-18 12:37:56 -08:00
|
|
|
media-io/audio-io.h
|
2015-06-26 03:08:00 -07:00
|
|
|
media-io/audio-math.h
|
2014-02-18 12:37:56 -08:00
|
|
|
media-io/video-frame.h
|
|
|
|
media-io/format-conversion.h
|
2014-01-20 07:58:58 -08:00
|
|
|
media-io/audio-resampler.h
|
2014-09-02 19:10:44 -07:00
|
|
|
media-io/video-scaler.h
|
|
|
|
media-io/media-remux.h)
|
2014-01-20 07:58:58 -08:00
|
|
|
|
|
|
|
set(libobs_util_SOURCES
|
2014-04-01 11:55:18 -07:00
|
|
|
util/array-serializer.c
|
2014-01-20 07:58:58 -08:00
|
|
|
util/base.c
|
|
|
|
util/platform.c
|
|
|
|
util/cf-lexer.c
|
|
|
|
util/bmem.c
|
|
|
|
util/config-file.c
|
|
|
|
util/lexer.c
|
|
|
|
util/dstr.c
|
|
|
|
util/utf8.c
|
|
|
|
util/text-lookup.c
|
|
|
|
util/cf-parser.c)
|
|
|
|
set(libobs_util_HEADERS
|
2014-04-01 11:55:18 -07:00
|
|
|
util/array-serializer.h
|
2014-01-20 07:58:58 -08:00
|
|
|
util/utf8.h
|
|
|
|
util/base.h
|
|
|
|
util/text-lookup.h
|
|
|
|
util/vc/vc_inttypes.h
|
|
|
|
util/vc/vc_stdbool.h
|
|
|
|
util/vc/vc_stdint.h
|
|
|
|
util/bmem.h
|
|
|
|
util/c99defs.h
|
|
|
|
util/cf-parser.h
|
|
|
|
util/threading.h
|
2014-11-26 21:36:48 -08:00
|
|
|
util/pipe.h
|
2014-01-20 07:58:58 -08:00
|
|
|
util/cf-lexer.h
|
|
|
|
util/darray.h
|
|
|
|
util/circlebuf.h
|
|
|
|
util/dstr.h
|
|
|
|
util/serializer.h
|
|
|
|
util/config-file.h
|
|
|
|
util/lexer.h
|
|
|
|
util/platform.h)
|
|
|
|
|
|
|
|
set(libobs_libobs_SOURCES
|
|
|
|
${libobs_PLATFORM_SOURCES}
|
2014-11-18 15:50:32 -08:00
|
|
|
obs-audio-controls.c
|
2014-04-01 11:55:18 -07:00
|
|
|
obs-avc.c
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-encoder.c
|
libobs: Add services API, reduce repeated code
Add API for streaming services. The services API simplifies the
creation of custom service features and user interface.
Custom streaming services later on will be able to do things such as:
- Be able to use service-specific APIs via modules, allowing a more
direct means of communicating with the service and requesting or
setting service-specific information
- Get URL/stream key via other means of authentication such as OAuth,
or be able to build custom URLs for services that require that sort
of thing.
- Query information (such as viewer count, chat, follower
notifications, and other information)
- Set channel information (such as current game, current channel title,
activating commercials)
Also, I reduce some repeated code that was used for all libobs objects.
This includes the name of the object, the private data, settings, as
well as the signal and procedure handlers.
I also switched to using linked lists for the global object lists,
rather than using an array of pointers (you could say it was..
pointless.) ..Anyway, the linked list info is also stored in the shared
context data structure.
2014-04-19 20:38:53 -07:00
|
|
|
obs-service.c
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-source.c
|
|
|
|
obs-output.c
|
|
|
|
obs.c
|
2014-02-01 17:01:31 -08:00
|
|
|
obs-properties.c
|
2014-01-27 22:14:58 -08:00
|
|
|
obs-data.c
|
2014-11-01 13:41:17 -07:00
|
|
|
obs-hotkey.c
|
|
|
|
obs-hotkey-name-map.c
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-module.c
|
|
|
|
obs-display.c
|
2014-02-13 09:21:16 -08:00
|
|
|
obs-view.c
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-scene.c
|
|
|
|
obs-video.c)
|
|
|
|
set(libobs_libobs_HEADERS
|
2014-11-18 15:50:32 -08:00
|
|
|
obs-audio-controls.h
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-defs.h
|
2014-04-01 11:55:18 -07:00
|
|
|
obs-avc.h
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-encoder.h
|
|
|
|
obs-service.h
|
2014-01-26 17:48:14 -08:00
|
|
|
obs-internal.h
|
2014-01-20 07:58:58 -08:00
|
|
|
obs.h
|
2014-01-31 23:49:50 -08:00
|
|
|
obs-ui.h
|
2014-02-01 17:01:31 -08:00
|
|
|
obs-properties.h
|
2014-01-27 22:14:58 -08:00
|
|
|
obs-data.h
|
2014-09-14 13:31:57 -07:00
|
|
|
obs-interaction.h
|
2014-11-01 13:41:17 -07:00
|
|
|
obs-hotkey.h
|
|
|
|
obs-hotkeys.h
|
2014-01-20 07:58:58 -08:00
|
|
|
obs-module.h
|
|
|
|
obs-scene.h
|
|
|
|
obs-source.h
|
2014-06-28 11:45:10 -07:00
|
|
|
obs-output.h
|
2014-07-10 05:37:50 -07:00
|
|
|
obs-ffmpeg-compat.h
|
|
|
|
obs.hpp)
|
2014-01-20 07:58:58 -08:00
|
|
|
|
|
|
|
set(libobs_SOURCES
|
|
|
|
${libobs_callback_SOURCES}
|
|
|
|
${libobs_graphics_SOURCES}
|
|
|
|
${libobs_mediaio_SOURCES}
|
|
|
|
${libobs_util_SOURCES}
|
|
|
|
${libobs_libobs_SOURCES})
|
|
|
|
|
|
|
|
set(libobs_HEADERS
|
2014-05-05 09:57:30 -07:00
|
|
|
${libobs_config_HEADERS}
|
2014-01-20 07:58:58 -08:00
|
|
|
${libobs_callback_HEADERS}
|
|
|
|
${libobs_graphics_HEADERS}
|
|
|
|
${libobs_mediaio_HEADERS}
|
|
|
|
${libobs_util_HEADERS}
|
|
|
|
${libobs_libobs_HEADERS})
|
|
|
|
|
|
|
|
source_group("callback\\Source Files" FILES ${libobs_callback_SOURCES})
|
|
|
|
source_group("callback\\Header Files" FILES ${libobs_callback_HEADERS})
|
|
|
|
source_group("graphics\\Source Files" FILES ${libobs_graphics_SOURCES})
|
|
|
|
source_group("graphics\\Header Files" FILES ${libobs_graphics_HEADERS})
|
|
|
|
source_group("libobs\\Source Files" FILES ${libobs_libobs_SOURCES})
|
|
|
|
source_group("libobs\\Header Files" FILES ${libobs_libobs_HEADERS})
|
|
|
|
source_group("media-io\\Source Files" FILES ${libobs_mediaio_SOURCES})
|
|
|
|
source_group("media-io\\Header Files" FILES ${libobs_mediaio_HEADERS})
|
|
|
|
source_group("util\\Source Files" FILES ${libobs_util_SOURCES})
|
|
|
|
source_group("util\\Header Files" FILES ${libobs_util_HEADERS})
|
|
|
|
|
2014-07-06 13:02:34 -07:00
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
add_library(libobs SHARED ${libobs_SOURCES} ${libobs_HEADERS})
|
2014-07-06 13:02:34 -07:00
|
|
|
|
2014-01-20 07:58:58 -08:00
|
|
|
set_target_properties(libobs PROPERTIES
|
|
|
|
OUTPUT_NAME obs
|
|
|
|
VERSION "0"
|
|
|
|
SOVERSION "0")
|
2014-09-23 05:05:53 -07:00
|
|
|
target_compile_definitions(libobs
|
|
|
|
PUBLIC
|
|
|
|
HAVE_OBSCONFIG_H)
|
2014-05-08 14:08:45 -07:00
|
|
|
|
|
|
|
if(NOT MSVC)
|
2014-09-23 05:05:53 -07:00
|
|
|
target_compile_options(libobs
|
|
|
|
PUBLIC
|
|
|
|
-mmmx
|
|
|
|
-msse
|
|
|
|
-msse2)
|
2014-05-08 14:08:45 -07:00
|
|
|
endif()
|
|
|
|
|
2014-09-23 05:05:53 -07:00
|
|
|
|
|
|
|
target_compile_options(libobs
|
|
|
|
PUBLIC
|
|
|
|
"${THREADS_DEFINITIONS}")
|
2014-09-23 06:26:08 -07:00
|
|
|
target_include_directories(libobs
|
|
|
|
PUBLIC
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/config>"
|
|
|
|
"$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>")
|
2014-01-20 07:58:58 -08:00
|
|
|
target_link_libraries(libobs
|
2014-05-05 09:57:30 -07:00
|
|
|
PRIVATE
|
|
|
|
${libobs_PLATFORM_DEPS}
|
2014-06-28 11:37:33 -07:00
|
|
|
${libobs_image_loading_LIBRARIES}
|
2014-07-17 09:02:43 -07:00
|
|
|
${OBS_JANSSON_IMPORT}
|
2014-09-23 06:26:08 -07:00
|
|
|
${FFMPEG_LIBRARIES}
|
2014-09-23 05:05:53 -07:00
|
|
|
PUBLIC
|
|
|
|
${THREADS_LIBRARIES})
|
2014-05-05 09:57:30 -07:00
|
|
|
|
|
|
|
install_obs_core(libobs EXPORT LibObs)
|
2014-07-15 06:02:03 -07:00
|
|
|
install_obs_data(libobs data libobs)
|
2014-05-05 09:57:30 -07:00
|
|
|
install_obs_headers(${libobs_HEADERS})
|
2014-07-15 19:36:45 -07:00
|
|
|
|
|
|
|
obs_install_additional(libobs)
|