Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
- Change vcpkg handling to automatically detect vcpkg via the
VCPKG_TOOLCHAIN variable set by the official toolchain file
- Change names of the function export compiler definitions
- Change default behavior of BUILD_SHARED_LIBS to ON
  • Loading branch information
hobyst committed Sep 2, 2023
1 parent 104fdb3 commit e1ff002
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMake/BackendsDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endfunction()
if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL")
# All dependencies are searched as soft dependencies so that they won't error out if the library
# is declared by other means
if(RMLUI_USING_VCPKG)
if(VCPKG_TOOLCHAIN)
# vcpkg uses a different name for their SDL find module and target than the official CMake one
find_package("SDL2")

Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ option(RMLUI_ENABLE_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires
option(RMLUI_ENABLE_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF)
option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF)
set(RMLUI_SAMPLES_BACKEND "GLFW_GL3" CACHE STRING "Backend to use when building the RmlUi samples. Choose one from ./CMake/Backends.cmake.")
option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." OFF)
option(RMLUI_USING_VCPKG "If true, the CMake project will adapt its behavior to accept third-party dependencies from vcpkg." OFF)
option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." ON)

# Add custom CMake modules path for external dependencies
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules")
Expand Down
2 changes: 1 addition & 1 deletion Include/RmlUi/Core/Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#if !defined RMLUI_STATIC_LIB
#if defined RMLUI_PLATFORM_WIN32
#if defined RMLUICORE_EXPORTS
#if defined RMLUI_CORE_EXPORTS
#define RMLUICORE_API __declspec(dllexport)
// Note: Changing a RMLUICORE_API_INLINE method
// breaks ABI compatibility!!
Expand Down
2 changes: 1 addition & 1 deletion Include/RmlUi/Debugger/Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#if !defined RMLUI_STATIC_LIB
#ifdef RMLUI_PLATFORM_WIN32
#ifdef RMLUIDEBUGGER_EXPORTS
#ifdef RMLUI_DEBUGGER_EXPORTS
#define RMLUIDEBUGGER_API __declspec(dllexport)
#else
#define RMLUIDEBUGGER_API __declspec(dllimport)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ elseif(rmlui_core_TYPE STREQUAL "SHARED_LIBRARY")
# If RmlUi is being compiled as a shared library, notify code to export functions using __dllspec()
# For applications consuming the library, the headers will automatically use dllimport
# Platform and compiler handling is already done by code via pre-processor macros
target_compile_definitions(rmlui_core PRIVATE "RMLUICORE_EXPORTS")
target_compile_definitions(rmlui_core PRIVATE "RMLUI_CORE_EXPORTS")
endif()

# Negotiate usage of the default font engine
Expand Down
2 changes: 1 addition & 1 deletion Source/Debugger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if(rmlui_debugger_TYPE STREQUAL "SHARED_LIBRARY")
# If RmlUi debugger is being compiled as a shared library, notify code to export functions using __dllspec()
# For applications consuming the library, the headers will automatically use dllimport
# Platform and compiler handling is already done by code via pre-processor macros
target_compile_definitions(rmlui_debugger PRIVATE "RMLUIDEBUGGER_EXPORTS")
target_compile_definitions(rmlui_debugger PRIVATE "RMLUI_DEBUGGER_EXPORTS")
endif()

# Set additional target properties
Expand Down

0 comments on commit e1ff002

Please sign in to comment.