2020-01-10 07:14:08 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(looking-glass-obs C)
|
|
|
|
|
2021-07-24 00:25:42 +00:00
|
|
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
|
2020-01-10 07:14:08 +00:00
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(FeatureSummary)
|
|
|
|
|
2021-07-24 01:21:26 +00:00
|
|
|
set(OPTIMIZE_FOR_NATIVE_DEFAULT ON)
|
2021-07-24 00:25:42 +00:00
|
|
|
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
|
2020-01-10 07:14:08 +00:00
|
|
|
|
|
|
|
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
|
|
|
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
|
|
|
|
|
|
|
add_compile_options(
|
|
|
|
"-Wall"
|
|
|
|
"-Werror"
|
|
|
|
"-Wfatal-errors"
|
|
|
|
"-ffast-math"
|
|
|
|
"-fdata-sections"
|
|
|
|
"-ffunction-sections"
|
|
|
|
"-fpic"
|
|
|
|
"$<$<CONFIG:DEBUG>:-O0;-g3;-ggdb>"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(EXE_FLAGS "-Wl,--gc-sections")
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
|
2021-05-31 14:40:39 +00:00
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(OBS_PLUGIN_DIR 64bit)
|
|
|
|
else()
|
|
|
|
set(OBS_PLUGIN_DIR 32bit)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USER_INSTALL)
|
|
|
|
if(DEFINED ENV{XDG_CONFIG_HOME})
|
|
|
|
set(OBS_PLUGIN_PREFIX $ENV{XDG_CONFIG_HOME})
|
|
|
|
else()
|
|
|
|
set(OBS_PLUGIN_PREFIX $ENV{HOME}/.config)
|
|
|
|
endif()
|
|
|
|
set(OBS_PLUGIN_PREFIX ${OBS_PLUGIN_PREFIX}/obs-studio/plugins)
|
|
|
|
else()
|
|
|
|
set(OBS_PLUGIN_PREFIX ${CMAKE_INSTALL_DATADIR}/obs/obs-plugins)
|
|
|
|
endif()
|
|
|
|
|
2020-01-10 07:14:08 +00:00
|
|
|
add_definitions(-D ATOMIC_LOCKING)
|
|
|
|
|
2020-10-08 15:17:20 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
|
|
|
${CMAKE_BINARY_DIR}/_version.c
|
2020-10-08 15:51:28 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P
|
2020-10-08 15:17:20 +00:00
|
|
|
${PROJECT_TOP}/version.cmake
|
|
|
|
)
|
|
|
|
|
2020-01-10 07:14:08 +00:00
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/include
|
|
|
|
${CMAKE_BINARY_DIR}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
link_libraries(
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
rt
|
|
|
|
m
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SOURCES
|
2020-10-08 15:17:20 +00:00
|
|
|
${CMAKE_BINARY_DIR}/version.c
|
2020-01-10 07:14:08 +00:00
|
|
|
main.c
|
|
|
|
lg.c
|
|
|
|
)
|
|
|
|
|
2020-01-31 10:39:57 +00:00
|
|
|
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common")
|
|
|
|
add_subdirectory("${PROJECT_TOP}/repos/LGMP/lgmp" "${CMAKE_BINARY_DIR}/lgmp" )
|
2020-01-10 07:14:08 +00:00
|
|
|
|
|
|
|
add_library(looking-glass-obs SHARED ${SOURCES})
|
|
|
|
target_link_libraries(looking-glass-obs
|
|
|
|
${EXE_FLAGS}
|
|
|
|
lg_common
|
|
|
|
lgmp
|
|
|
|
)
|
|
|
|
|
2021-05-31 14:40:39 +00:00
|
|
|
install(TARGETS looking-glass-obs
|
|
|
|
LIBRARY DESTINATION ${OBS_PLUGIN_PREFIX}/${CMAKE_PROJECT_NAME}/bin/${OBS_PLUGIN_DIR}
|
|
|
|
)
|
|
|
|
|
2020-01-10 07:14:08 +00:00
|
|
|
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
|