Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ set(SCRIPT_API "None" CACHE STRING "Which scripting API/language to use, if any.
set_property(CACHE SCRIPT_API PROPERTY STRINGS "None" "C#")

set(SCRIPT_BINDING_GENERATION OFF CACHE BOOL "If true, script binding generation will be supported through a specialized build target. Enable this if you plan on modifying the scripting API. Requires the SBGen tool dependency. Only relevant if you have selected a SCRIPT_API other than \"None\".")

set(DYNLIB_EXTRA_SEARCH_DIRECTORY "" CACHE STRING "If non-empty DynLib loading additionally searches the specified directory for libraries")
5 changes: 5 additions & 0 deletions Source/CMake/BsFrameworkConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@
#define BS_VERSION_STRING _MKSTR(BS_VERSION_MAJOR) "." _MKSTR(BS_VERSION_MINOR) "." _MKSTR(BS_VERSION_PATCH) ".0"

#define BS_IS_BANSHEE3D @BS_IS_BANSHEE3D@

#define BS_DYNLIB_EXTRA_ENABLED @BS_DYNLIB_EXTRA_ENABLED@
#if BS_DYNLIB_EXTRA_ENABLED == 1
#define BS_DYNLIB_EXTRA_SEARCH_DIRECTORY "@DYNLIB_EXTRA_SEARCH_DIRECTORY@"
#endif
6 changes: 6 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ else()
set(BS_SCRIPTING_ENABLED 0)
endif()

if(NOT DYNLIB_EXTRA_SEARCH_DIRECTORY STREQUAL "")
set(BS_DYNLIB_EXTRA_ENABLED 1)
else()
set(BS_DYNLIB_EXTRA_ENABLED 0)
endif()

## Generate config files
configure_file("${BSF_SOURCE_DIR}/CMake/BsEngineConfig.h.in" "${PROJECT_BINARY_DIR}/Generated/bsfEngine/BsEngineConfig.h")
configure_file("${BSF_SOURCE_DIR}/CMake/BsFrameworkConfig.h.in" "${PROJECT_BINARY_DIR}/Generated/bsfUtility/BsFrameworkConfig.h")
Expand Down
11 changes: 9 additions & 2 deletions Source/Foundation/bsfUtility/Utility/BsDynLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ namespace bs

if (!mHandle)
{
BS_EXCEPT(InternalErrorException,
"Could not load dynamic library " + mName + ". System Error: " + dynlibError());
#if BS_DYNLIB_EXTRA_ENABLED == 1
mHandle = (DYNLIB_HANDLE)DYNLIB_LOAD(Path::combine(Path(BS_DYNLIB_EXTRA_SEARCH_DIRECTORY),
Path(mName)).toString().c_str());
#endif // BS_DYNLIB_EXTRA_ENABLED
if (!mHandle)
{
BS_EXCEPT(InternalErrorException,
"Could not load dynamic library " + mName + ". System Error: " + dynlibError());
}
}
}

Expand Down