Merge pull request #29 from BtbN/cmake

Restructure installation and package generation
master
Jim 2014-01-25 10:39:33 -08:00
commit 143f5e4bd6
8 changed files with 212 additions and 82 deletions

View File

@ -8,6 +8,8 @@ project(obs-studio)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include(ObsHelpers)
if(NOT _one_time_action_done) if(NOT _one_time_action_done)
if(MSVC) if(MSVC)
file(GENERATE file(GENERATE
@ -18,8 +20,6 @@ if(NOT _one_time_action_done)
set(_one_time_action_done TRUE CACHE INTERNAL "") set(_one_time_action_done TRUE CACHE INTERNAL "")
endif() endif()
include(ObsHelpers)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo) set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif() endif()
@ -52,19 +52,23 @@ if(APPLE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif() endif()
add_subdirectory(deps) if(NOT INSTALLER_RUN)
add_subdirectory(libobs) add_subdirectory(deps)
add_subdirectory(libobs)
if(WIN32) if(WIN32)
add_subdirectory(libobs-d3d11) add_subdirectory(libobs-d3d11)
add_subdirectory(libobs-d3d9) add_subdirectory(libobs-d3d9)
endif()
add_subdirectory(libobs-opengl)
add_subdirectory(obs)
add_subdirectory(plugins)
add_subdirectory(test)
else()
obs_generate_multiarch_installer()
endif() endif()
add_subdirectory(libobs-opengl)
add_subdirectory(obs)
add_subdirectory(plugins)
add_subdirectory(test)
obs_install_additional() obs_install_additional()
# CPack Configuration # CPack Configuration
@ -81,8 +85,17 @@ set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "1") set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OBS Studio - Multi-platform broadcasting software") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OBS Studio - Multi-platform broadcasting software")
set(CPACK_PACKAGE_EXECUTABLES "obs;OBS Studio") if(INSTALLER_RUN)
set(CPACK_CREATE_DESKTOP_LINKS "obs") set(CPACK_PACKAGE_EXECUTABLES
"${OBS_EXECUTABLE32_DESTINATION}/obs" "OBS Studio (32bit)"
"${OBS_EXECUTABLE64_DESTINATION}/obs" "OBS Studio (64bit)")
set(CPACK_CREATE_DESKTOP_LINKS
"${OBS_EXECUTABLE32_DESTINATION}/obs"
"${OBS_EXECUTABLE64_DESTINATION}/obs")
else()
set(CPACK_PACKAGE_EXECUTABLES "${OBS_EXECUTABLE_DESTINATION}/obs;OBS Studio")
set(CPACK_CREATE_DESKTOP_LINKS "${OBS_EXECUTABLE_DESTINATION}/obs")
endif()
set(CPACK_BUNDLE_NAME "OBS Studio") set(CPACK_BUNDLE_NAME "OBS Studio")
set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/cmake/osxbundle/Info.plist") set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/cmake/osxbundle/Info.plist")
@ -93,7 +106,13 @@ set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_NSIS_MODIFY_PATH ON) set(CPACK_NSIS_MODIFY_PATH ON)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(INSTALLER_RUN)
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio")
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(WIN32)
set(CPACK_PACKAGE_NAME "OBS Studio (64bit)")
endif()
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio64") SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio64")
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
else() else()

View File

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\64bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\64bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\64bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\64bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\64bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\64bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\64bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\64bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\32bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\32bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\32bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\32bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\32bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\32bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">
<LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\obs.exe</LocalDebuggerCommand> <LocalDebuggerCommand>$(SolutionDir)rundir\$(Configuration)\bin\32bit\obs.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)rundir\$(Configuration)\bin\32bit</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,28 +1,56 @@
set(OBS_OUTPUT_DIR "${CMAKE_BINARY_DIR}/rundir") set(OBS_OUTPUT_DIR "${CMAKE_BINARY_DIR}/rundir")
set(OBS_EXECUTABLE_DESTINATION "bin") if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OBS_LIBRARY_DESTINATION "lib") set(_lib_suffix 64)
set(OBS_PLUGIN_DESTINATION "lib/obs-plugins")
set(OBS_DATA_DESTINATION "share/obs")
if(WIN32 OR APPLE)
set(_struct_def FALSE)
else() else()
set(_struct_def TRUE) set(_lib_suffix 32)
endif() endif()
if(WIN32 OR APPLE)
set(_struct_def FALSE)
else()
set(_struct_def TRUE)
endif()
option(INSTALLER_RUN "Build a multiarch installer, needs to run indenepdently after both archs have compiled" FALSE)
option(UNIX_STRUCTURE "Build with standard unix filesystem structure" ${_struct_def}) option(UNIX_STRUCTURE "Build with standard unix filesystem structure" ${_struct_def})
if(INSTALLER_RUN AND NOT DEFINED ENV{obsInstallerTempDir})
message(FATAL_ERROR "Environment variable obsInstallerTempDir is needed for multiarch installer generation")
endif()
if(NOT UNIX_STRUCTURE) if(NOT UNIX_STRUCTURE)
set(OBS_EXECUTABLE_DESTINATION ".") set(OBS_EXECUTABLE_DESTINATION "bin/${_lib_suffix}bit")
set(OBS_LIBRARY_DESTINATION ".") set(OBS_EXECUTABLE32_DESTINATION "bin/32bit")
set(OBS_PLUGIN_DESTINATION "obs-plugins") set(OBS_EXECUTABLE64_DESTINATION "bin/64bit")
set(OBS_LIBRARY_DESTINATION "bin/${_lib_suffix}bit")
set(OBS_LIBRARY32_DESTINATION "lib32")
set(OBS_LIBRARY64_DESTINATION "lib64")
set(OBS_PLUGIN_DESTINATION "obs-plugins/${_lib_suffix}bit")
set(OBS_PLUGIN32_DESTINATION "obs-plugins/32bit")
set(OBS_PLUGIN64_DESTINATION "obs-plugins/64bit")
set(OBS_DATA_DESTINATION "data") set(OBS_DATA_DESTINATION "data")
add_definitions(-DOBS_DATA_PATH="../../${OBS_DATA_DESTINATION}")
else() else()
set(OBS_EXECUTABLE_DESTINATION "bin")
set(OBS_EXECUTABLE32_DESTINATION "bin32")
set(OBS_EXECUTABLE64_DESTINATION "bin64")
set(OBS_LIBRARY_DESTINATION "lib")
set(OBS_LIBRARY32_DESTINATION "lib32")
set(OBS_LIBRARY64_DESTINATION "lib64")
set(OBS_PLUGIN_DESTINATION "lib/obs-plugins")
set(OBS_PLUGIN32_DESTINATION "lib32/obs-plugins")
set(OBS_PLUGIN64_DESTINATION "lib64/obs-plugins")
set(OBS_DATA_DESTINATION "share/obs")
add_definitions(-DOBS_DATA_PATH="${OBS_DATA_DESTINATION}")
add_definitions(-DOBS_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}/") add_definitions(-DOBS_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}/")
endif() endif()
add_definitions(-DOBS_DATA_PATH="${OBS_DATA_DESTINATION}") function(obs_generate_multiarch_installer)
install(DIRECTORY "$ENV{obsInstallerTempDir}/"
DESTINATION "."
USE_SOURCE_PERMISSIONS)
endfunction()
function(obs_install_additional) function(obs_install_additional)
set(addfdir "${CMAKE_SOURCE_DIR}/additional_install_files") set(addfdir "${CMAKE_SOURCE_DIR}/additional_install_files")
@ -38,36 +66,94 @@ function(obs_install_additional)
install(DIRECTORY "${addfdir}/misc/" install(DIRECTORY "${addfdir}/misc/"
DESTINATION "." DESTINATION "."
USE_SOURCE_PERMISSIONS) USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
install(DIRECTORY "${addfdir}/data/" install(DIRECTORY "${addfdir}/data/"
DESTINATION "${OBS_DATA_DESTINATION}" DESTINATION "${OBS_DATA_DESTINATION}"
USE_SOURCE_PERMISSIONS) USE_SOURCE_PERMISSIONS
install(DIRECTORY "${addfdir}/libs${_lib_suffix}/" PATTERN ".gitignore" EXCLUDE)
DESTINATION "${OBS_LIBRARY_DESTINATION}"
USE_SOURCE_PERMISSIONS) if(INSTALLER_RUN)
install(DIRECTORY "${addfdir}/exec${_lib_suffix}/" install(DIRECTORY "${addfdir}/libs32/"
DESTINATION "${OBS_EXECUTABLE_DESTINATION}" DESTINATION "${OBS_LIBRARY32_DESTINATION}"
USE_SOURCE_PERMISSIONS) USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
install(DIRECTORY "${addfdir}/exec32/"
DESTINATION "${OBS_EXECUTABLE32_DESTINATION}"
USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
install(DIRECTORY "${addfdir}/libs64/"
DESTINATION "${OBS_LIBRARY64_DESTINATION}"
USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
install(DIRECTORY "${addfdir}/exec64/"
DESTINATION "${OBS_EXECUTABLE64_DESTINATION}"
USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
else()
install(DIRECTORY "${addfdir}/libs${_lib_suffix}/"
DESTINATION "${OBS_LIBRARY_DESTINATION}"
USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
install(DIRECTORY "${addfdir}/exec${_lib_suffix}/"
DESTINATION "${OBS_EXECUTABLE_DESTINATION}"
USE_SOURCE_PERMISSIONS
PATTERN ".gitignore" EXCLUDE)
endif()
endfunction() endfunction()
macro(install_obs_core target) macro(install_obs_core target)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_lib_suffix 64)
else()
set(_lib_suffix 32)
endif()
install(TARGETS ${target} install(TARGETS ${target}
LIBRARY DESTINATION "${OBS_LIBRARY_DESTINATION}" LIBRARY DESTINATION "${OBS_LIBRARY_DESTINATION}"
RUNTIME DESTINATION "${OBS_EXECUTABLE_DESTINATION}") RUNTIME DESTINATION "${OBS_EXECUTABLE_DESTINATION}")
add_custom_command(TARGET ${target} POST_BUILD add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${target}>" "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/$<TARGET_FILE_NAME:${target}>" "$<TARGET_FILE:${target}>" "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/bin/${_lib_suffix}bit/$<TARGET_FILE_NAME:${target}>"
VERBATIM) VERBATIM)
if(DEFINED ENV{obsInstallerTempDir})
get_property(target_type TARGET ${target} PROPERTY TYPE)
if("${target_type}" STREQUAL "EXECUTABLE")
set(tmp_target_dir "${OBS_EXECUTABLE_DESTINATION}")
else()
set(tmp_target_dir "${OBS_LIBRARY_DESTINATION}")
endif()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${target}>" "$ENV{obsInstallerTempDir}/${tmp_target_dir}/$<TARGET_FILE_NAME:${target}>"
VERBATIM)
endif()
endmacro() endmacro()
macro(install_obs_plugin target) macro(install_obs_plugin target)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_lib_suffix 64)
else()
set(_lib_suffix 32)
endif()
install(TARGETS ${target} install(TARGETS ${target}
LIBRARY DESTINATION "${OBS_PLUGIN_DESTINATION}" LIBRARY DESTINATION "${OBS_PLUGIN_DESTINATION}"
RUNTIME DESTINATION "${OBS_PLUGIN_DESTINATION}") RUNTIME DESTINATION "${OBS_PLUGIN_DESTINATION}")
add_custom_command(TARGET ${target} POST_BUILD add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${target}>" "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/obs-plugins/$<TARGET_FILE_NAME:${target}>" "$<TARGET_FILE:${target}>" "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/obs-plugins/${_lib_suffix}bit/$<TARGET_FILE_NAME:${target}>"
VERBATIM) VERBATIM)
if(DEFINED ENV{obsInstallerTempDir})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${target}>" "$ENV{obsInstallerTempDir}/${OBS_PLUGIN_DESTINATION}/$<TARGET_FILE_NAME:${target}>"
VERBATIM)
endif()
endmacro() endmacro()
macro(install_obs_data target datadir datadest) macro(install_obs_data target datadir datadest)
@ -75,9 +161,16 @@ macro(install_obs_data target datadir datadest)
DESTINATION "${OBS_DATA_DESTINATION}/${datadest}" DESTINATION "${OBS_DATA_DESTINATION}/${datadest}"
USE_SOURCE_PERMISSIONS) USE_SOURCE_PERMISSIONS)
add_custom_command(TARGET ${target} POST_BUILD add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/${datadir}" "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/data/${datadest}" "${CMAKE_CURRENT_SOURCE_DIR}/${datadir}" "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/data/${datadest}"
VERBATIM) VERBATIM)
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND DEFINED ENV{obsInstallerTempDir})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/${datadir}" "$ENV{obsInstallerTempDir}/${OBS_DATA_DESTINATION}/${datadest}"
VERBATIM)
endif()
endmacro() endmacro()
macro(install_obs_plugin_data target datadir) macro(install_obs_plugin_data target datadir)

View File

@ -25,7 +25,9 @@
// support both foo.so and libfoo.so for now // support both foo.so and libfoo.so for now
static const char *plugin_patterns[] = { static const char *plugin_patterns[] = {
OBS_INSTALL_PREFIX "obs-plugins/%s.so", OBS_INSTALL_PREFIX "obs-plugins/%s.so",
OBS_INSTALL_PREFIX "obs-plugins/lib%s.so" OBS_INSTALL_PREFIX "obs-plugins/lib%s.so",
"../../obs-plugins/64bit/%s.so",
"../../obs-plugins/64bit/lib%s.so"
}; };
static const int plugin_patterns_size = static const int plugin_patterns_size =

View File

@ -28,7 +28,7 @@ static inline bool check_path(const char* data, const char *path,
dstr_copy(output, path); dstr_copy(output, path);
dstr_cat(output, data); dstr_cat(output, data);
blog(LOG_INFO, "Attempting path: %s\n", output->array); blog(LOG_INFO, "Attempting path: %s\n", output->array);
return access(output->array, R_OK) == 0; return access(output->array, R_OK) == 0;
} }
@ -39,8 +39,8 @@ static inline bool check_lib_path(const char* data, const char *path,
bool result = false; bool result = false;
struct dstr tmp; struct dstr tmp;
dstr_init_copy(&tmp, "lib"); dstr_init_copy(&tmp, "lib");
dstr_cat(&tmp, data); dstr_cat(&tmp, data);
dstr_cat(&tmp, ".so"); dstr_cat(&tmp, ".so");
result = check_path(tmp.array, path, output); result = check_path(tmp.array, path, output);
@ -58,12 +58,18 @@ char *find_plugin(const char *plugin)
struct dstr output; struct dstr output;
dstr_init(&output); dstr_init(&output);
if (check_lib_path(plugin, "obs-plugins/", &output)) if(sizeof(void*) == 4)
return output.array; {
if (check_lib_path(plugin, "../../obs-plugins/32bit/", &output))
return output.array;
}
if (check_lib_path(plugin, OBS_INSTALL_PREFIX "lib/obs-plugins/", if (OBS_INSTALL_PREFIX [0] != 0)
&output)) {
return output.array; if (check_lib_path(plugin, OBS_INSTALL_PREFIX "lib/obs-plugins/",
&output))
return output.array;
}
dstr_free(&output); dstr_free(&output);
return NULL; return NULL;
@ -81,9 +87,12 @@ char *find_libobs_data_file(const char *file)
if (check_path(file, OBS_DATA_PATH "/libobs/", &output)) if (check_path(file, OBS_DATA_PATH "/libobs/", &output))
return output.array; return output.array;
if (check_path(file, OBS_INSTALL_PREFIX OBS_DATA_PATH "/libobs/", if (OBS_INSTALL_PREFIX [0] != 0)
&output)) {
return output.array; if (check_path(file, OBS_INSTALL_PREFIX OBS_DATA_PATH "/libobs/",
&output))
return output.array;
}
dstr_free(&output); dstr_free(&output);
return NULL; return NULL;
@ -95,16 +104,19 @@ char *find_libobs_data_file(const char *file)
*/ */
char *obs_find_plugin_file(const char *file) char *obs_find_plugin_file(const char *file)
{ {
struct dstr output; struct dstr output;
dstr_init(&output); dstr_init(&output);
if (check_path(file, OBS_DATA_PATH "/obs-plugins/", &output)) if (check_path(file, OBS_DATA_PATH "/obs-plugins/", &output))
return output.array; return output.array;
if (check_path(file, OBS_INSTALL_PREFIX OBS_DATA_PATH "/obs-plugins/", if (OBS_INSTALL_PREFIX [0] != 0)
&output)) {
return output.array; if (check_path(file, OBS_INSTALL_PREFIX OBS_DATA_PATH "/obs-plugins/",
&output))
return output.array;
}
dstr_free(&output); dstr_free(&output);
return NULL; return NULL;
} }

View File

@ -24,7 +24,11 @@
char *find_plugin(const char *plugin) char *find_plugin(const char *plugin)
{ {
struct dstr path; struct dstr path;
dstr_init_copy(&path, OBS_INSTALL_PREFIX "obs-plugins/"); #ifdef _WIN64
dstr_init_copy(&path, "../../obs-plugins/64bit/");
#else
dstr_init_copy(&path, "../../obs-plugins/32bit/");
#endif
dstr_cat(&path, plugin); dstr_cat(&path, plugin);
return path.array; return path.array;
} }
@ -33,7 +37,7 @@ char *find_plugin(const char *plugin)
char *find_libobs_data_file(const char *file) char *find_libobs_data_file(const char *file)
{ {
struct dstr path; struct dstr path;
dstr_init_copy(&path, OBS_INSTALL_PREFIX OBS_DATA_PATH "/libobs/"); dstr_init_copy(&path, "../../data/libobs/");
dstr_cat(&path, file); dstr_cat(&path, file);
return path.array; return path.array;
} }
@ -42,7 +46,7 @@ char *find_libobs_data_file(const char *file)
char *obs_find_plugin_file(const char *file) char *obs_find_plugin_file(const char *file)
{ {
struct dstr path; struct dstr path;
dstr_init_copy(&path, OBS_INSTALL_PREFIX OBS_DATA_PATH "/obs-plugins/"); dstr_init_copy(&path, "../../data/obs-plugins/");
dstr_cat(&path, file); dstr_cat(&path, file);
return path.array; return path.array;
} }

View File

@ -69,7 +69,7 @@ typedef int64_t off64_t;
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#ifndef OBS_DATA_PATH #ifndef OBS_DATA_PATH
#define OBS_DATA_PATH "data" #define OBS_DATA_PATH "../../data"
#endif #endif
#ifndef OBS_INSTALL_PREFIX #ifndef OBS_INSTALL_PREFIX

View File

@ -40,7 +40,7 @@ static inline bool check_path(const char* data, const char *path,
return (access(output.c_str(), R_OK) == 0); return (access(output.c_str(), R_OK) == 0);
} }
#define INSTALL_DATA_PATH OBS_INSTALL_PREFIX "/" OBS_DATA_PATH "/obs-studio/" #define INSTALL_DATA_PATH OBS_INSTALL_PREFIX OBS_DATA_PATH "/obs-studio/"
bool GetDataFilePath(const char *data, string &output) bool GetDataFilePath(const char *data, string &output)
{ {