diff --git a/cmake/Modules/ObsHelpers.cmake b/cmake/Modules/ObsHelpers.cmake index 1856710ff..885e30643 100644 --- a/cmake/Modules/ObsHelpers.cmake +++ b/cmake/Modules/ObsHelpers.cmake @@ -42,7 +42,10 @@ if(NOT UNIX_STRUCTURE) set(OBS_PLUGIN_DESTINATION "obs-plugins") set(OBS_PLUGIN32_DESTINATION "obs-plugins") set(OBS_PLUGIN64_DESTINATION "obs-plugins") - add_definitions(-DOBS_DATA_PATH="../${OBS_DATA_DESTINATION}") + + set(OBS_DATA_PATH "../${OBS_DATA_DESTINATION}") + set(OBS_INSTALL_PREFIX "") + set(OBS_RELATIVE_PREFIX "../") else() set(OBS_EXECUTABLE_DESTINATION "bin/${_lib_suffix}bit") set(OBS_EXECUTABLE32_DESTINATION "bin/32bit") @@ -53,25 +56,34 @@ if(NOT UNIX_STRUCTURE) set(OBS_PLUGIN_DESTINATION "obs-plugins/${_lib_suffix}bit") set(OBS_PLUGIN32_DESTINATION "obs-plugins/32bit") set(OBS_PLUGIN64_DESTINATION "obs-plugins/64bit") - add_definitions(-DOBS_DATA_PATH="../../${OBS_DATA_DESTINATION}") + + set(OBS_DATA_PATH "../../${OBS_DATA_DESTINATION}") + set(OBS_INSTALL_PREFIX "") + set(OBS_RELATIVE_PREFIX "../../") endif() set(OBS_CMAKE_DESTINATION "cmake") set(OBS_INCLUDE_DESTINATION "include") else() + if(NOT OBS_MULTIARCH_SUFFIX AND DEFINED ENV{OBS_MULTIARCH_SUFFIX}) + set(OBS_MULTIARCH_SUFFIX "$ENV{OBS_MULTIARCH_SUFFIX}") + endif() + set(OBS_EXECUTABLE_DESTINATION "bin") set(OBS_EXECUTABLE32_DESTINATION "bin32") set(OBS_EXECUTABLE64_DESTINATION "bin64") - set(OBS_LIBRARY_DESTINATION "lib") + set(OBS_LIBRARY_DESTINATION "lib${OBS_MULTIARCH_SUFFIX}") 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_PLUGIN_DESTINATION "${OBS_LIBRARY_DESTINATION}/obs-plugins") + set(OBS_PLUGIN32_DESTINATION "${OBS_LIBRARY32_DESTINATION}/obs-plugins") + set(OBS_PLUGIN64_DESTINATION "${OBS_LIBRARY64_DESTINATION}/obs-plugins") set(OBS_DATA_DESTINATION "share/obs") - set(OBS_CMAKE_DESTINATION "lib/cmake") + set(OBS_CMAKE_DESTINATION "${OBS_LIBRARY_DESTINATION}/cmake") set(OBS_INCLUDE_DESTINATION "include/obs") - add_definitions(-DOBS_DATA_PATH="${OBS_DATA_DESTINATION}") - add_definitions(-DOBS_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}/") + + set(OBS_DATA_PATH "${OBS_DATA_DESTINATION}") + set(OBS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") + set(OBS_RELATIVE_PREFIX "../") endif() function(obs_finish_bundle) @@ -340,16 +352,14 @@ function(install_obs_pdb ttype target) endfunction() macro(install_obs_core target) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(APPLE) + set(_bit_suffix "") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_bit_suffix "64bit/") else() set(_bit_suffix "32bit/") endif() - if(APPLE) - set(_bit_suffix "") - endif() - if("${ARGV1}" STREQUAL "EXPORT") export_obs_core("${target}" "${ARGV2}") else() @@ -383,15 +393,16 @@ macro(install_obs_core target) endmacro() macro(install_obs_plugin target) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(APPLE) + set(_bit_suffix "") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_bit_suffix "64bit/") else() set(_bit_suffix "32bit/") endif() - if(APPLE) - set(_bit_suffix "") - endif() + set_target_properties(${target} PROPERTIES + PREFIX "") install(TARGETS ${target} LIBRARY DESTINATION "${OBS_PLUGIN_DESTINATION}" diff --git a/libobs/obs-config.h b/libobs/obs-config.h index c9af513ac..dfda62350 100644 --- a/libobs/obs-config.h +++ b/libobs/obs-config.h @@ -56,7 +56,11 @@ #ifdef HAVE_OBSCONFIG_H # include "obsconfig.h" #else - -#define OBS_VERSION "unknown" - +# define OBS_VERSION "unknown" +# define OBS_DATA_PATH "../../data" +# define OBS_INSTALL_PREFIX "" +# define OBS_PLUGIN_DESTINATION "obs-plugins" +# define OBS_RELATIVE_PREFIX "../../" #endif + +#define OBS_INSTALL_DATA_PATH OBS_INSTALL_PREFIX OBS_DATA_PATH diff --git a/libobs/obsconfig.h.in b/libobs/obsconfig.h.in index a55dbc5c6..f6b636fd2 100644 --- a/libobs/obsconfig.h.in +++ b/libobs/obsconfig.h.in @@ -2,4 +2,7 @@ #pragma once #define OBS_VERSION "@OBS_VERSION@" - +#define OBS_DATA_PATH "@OBS_DATA_PATH@" +#define OBS_INSTALL_PREFIX "@OBS_INSTALL_PREFIX@" +#define OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION@" +#define OBS_RELATIVE_PREFIX "@OBS_RELATIVE_PREFIX@" diff --git a/libobs/util/c99defs.h b/libobs/util/c99defs.h index fe72f83cd..3babdeea4 100644 --- a/libobs/util/c99defs.h +++ b/libobs/util/c99defs.h @@ -76,13 +76,3 @@ typedef int64_t off64_t; #define SIZE_T_FORMAT "%zu" #endif /* _MSC_VER */ - -#ifndef OBS_DATA_PATH -#define OBS_DATA_PATH "../../data" -#endif - -#ifndef OBS_INSTALL_PREFIX -#define OBS_INSTALL_PREFIX "" -#endif - -#define OBS_INSTALL_DATA_PATH OBS_INSTALL_PREFIX OBS_DATA_PATH diff --git a/obs/platform-osx.mm b/obs/platform-osx.mm index ee781cf47..a230cd99a 100644 --- a/obs/platform-osx.mm +++ b/obs/platform-osx.mm @@ -17,6 +17,7 @@ #include #include +#include #include "platform.hpp" #include "obs-app.hpp" diff --git a/obs/platform-windows.cpp b/obs/platform-windows.cpp index 3168840b6..5686a1966 100644 --- a/obs/platform-windows.cpp +++ b/obs/platform-windows.cpp @@ -17,6 +17,7 @@ #include #include +#include "obs-config.h" #include "obs-app.hpp" #include "platform.hpp" using namespace std; diff --git a/obs/platform-x11.cpp b/obs/platform-x11.cpp index ea834cca4..715f5073b 100644 --- a/obs/platform-x11.cpp +++ b/obs/platform-x11.cpp @@ -20,6 +20,7 @@ * Even if there are not multiple monitors, this should still work. */ +#include #include "obs-app.hpp" #include