Skip to content
Snippets Groups Projects
Commit 68358593 authored by Palana's avatar Palana
Browse files

add infrastructure for app bundle target and unmark as advanced

parent 78eb116c
No related branches found
No related tags found
No related merge requests found
......@@ -25,12 +25,13 @@ if(UNIX)
set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_RPATH};@loader_path/;@executable_path/")
option(BUILD_APP_BUNDLE "Build app bundle" false)
#TODO: figure out distribution options
mark_as_advanced(BUILD_APP_BUNDLE)
endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
include(obs_helpers)
obs_add_data_dir(/)
set(LIBRARY_OUTPUT_PATH ${obs_BINARY_DIR}/bin)
set(RUNTIME_OUTPUT_PATH ${obs_BINARY_DIR}/bin)
......
#copy data files and libs into (additional) directory (trees)
#todo: improve dependency interaction
set(OBS_CORE_LIBS "" CACHE INTERNAL "obs core libs")
set(OBS_CORE_LIB_TARGETS "" CACHE INTERNAL "obs core lib targets")
function(obs_add_core_lib lib)
get_property(location TARGET ${lib} PROPERTY LOCATION)
list(APPEND OBS_CORE_LIBS ${location})
set(OBS_CORE_LIBS ${OBS_CORE_LIBS} CACHE INTERNAL "")
get_filename_component(filename ${location} NAME)
foreach(target ${OBS_CORE_LIB_TARGETS})
get_property(tar_location TARGET ${target} PROPERTY LOCATION)
get_filename_component(dir ${tar_location} DIRECTORY)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${location}
"${dir}/")
set_property(DIRECTORY ${dir} APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES ${filename})
endforeach()
endfunction()
function(obs_add_core_lib_target target)
list(APPEND OBS_CORE_LIB_DIRS ${target})
set(OBS_CORE_LIB_TARGETS ${OBS_CORE_LIB_TARGETS} CACHE INTERNAL "")
get_property(tar_location TARGET ${target} PROPERTY LOCATION)
get_filename_component(dir ${tar_location} DIRECTORY)
foreach(lib ${OBS_CORE_LIBS})
get_filename_component(filename ${lib} NAME)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${lib}
"${dir}/")
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES "${dir}/${filename}")
endforeach()
endfunction()
set(OBS_DATA_DIRS "" CACHE INTERNAL "data_dirs")
set(OBS_DATA_SOURCES "" CACHE INTERNAL "source_dirs")
function(obs_add_data_source prefix)
string(MD5 hash ${prefix})
set(source_name "OBS_DATA_SOURCES_${hash}")
set(prefix_name "OBS_DATA_SOURCE_${hash}")
set(args ${ARGN})
foreach(target ${OBS_DATA_DIRS})
file(COPY
${args}
DESTINATION
"${target}/${prefix}")
endforeach()
set(${source_name} ${args} CACHE INTERNAL "")
set(${prefix_name} ${prefix} CACHE INTERNAL "")
list(APPEND OBS_DATA_SOURCES ${hash})
set(OBS_DATA_SOURCES ${OBS_DATA_SOURCES} CACHE INTERNAL "")
endfunction()
function(obs_add_data_dir dir)
set(dir "${obs_BINARY_DIR}/${dir}")
list(APPEND OBS_DATA_DIRS ${dir})
set(OBS_DATA_DIRS ${OBS_DATA_DIRS} CACHE INTERNAL "")
foreach(hash ${OBS_DATA_SOURCES})
set(source_name "OBS_DATA_SOURCES_${hash}")
set(prefix_name "OBS_DATA_SOURCE_${hash}")
file(COPY
${${source_name}}
DESTINATION
"${dir}/${${prefix_name}}")
endforeach()
endfunction()
......@@ -71,3 +71,5 @@ target_link_libraries(libobs-opengl
libobs
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES})
obs_add_core_lib(libobs-opengl)
......@@ -86,7 +86,7 @@ target_link_libraries(libobs
${LIBAVUTIL_LIBRARIES}
${LIBSWRESAMPLE_LIBRARIES})
file(COPY
${obs_SOURCE_DIR}/build/data/libobs/default.effect
DESTINATION
${obs_BINARY_DIR}/data/libobs/)
obs_add_core_lib(libobs)
obs_add_data_source(/data/libobs/
${obs_SOURCE_DIR}/build/data/libobs/default.effect)
......@@ -96,11 +96,13 @@ add_executable(obs
if(APPLE)
set_target_properties(obs PROPERTIES
MACOSX_BUNDLE ${BUILD_APP_BUNDLE})
if(BUILD_APP_BUNDLE)
obs_add_core_lib_target(obs)
obs_add_data_dir(/bin/obs.app/Contents/)
endif()
endif()
file(COPY
obs_add_data_source(/data/obs-studio/locale
${obs_SOURCE_DIR}/build/data/obs-studio/locale/en.txt
${obs_SOURCE_DIR}/build/data/obs-studio/locale/ja.txt
${obs_SOURCE_DIR}/build/data/obs-studio/locale/locale.ini
DESTINATION
${obs_BINARY_DIR}/data/obs-studio/locale/)
${obs_SOURCE_DIR}/build/data/obs-studio/locale/locale.ini)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment