Skip to content

Commit

Permalink
SFML dependency wrapper code cleanup (#551)
Browse files Browse the repository at this point in the history
- Remove remnant of SFML <= 2.4 support
- Add prefix to variable names on loop
- Fix a typo in a comment
  • Loading branch information
hobyst authored and mikke89 committed Mar 31, 2024
1 parent 650b2c0 commit 6f3a14f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CMake/Backends.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[[
Details about sample backends, their source code files and linking requirements

Everytime a new backend gets added or its target name is modified, please update
Every time a new backend gets added or its target name is modified, please update
the list of available backends found in OptionsLists.cmake

This file is not meant to be used by consumers of the library, only by the RmlUi CMake project
Expand Down Expand Up @@ -114,7 +114,7 @@ target_sources(rmlui_backend_SFML_GL2 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h"
)
target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE
rmlui_backend_common_headers OpenGL::GL rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System
rmlui_backend_common_headers OpenGL::GL SFML::Graphics SFML::Window SFML::System
)

add_library(rmlui_backend_GLFW_GL2 INTERFACE)
Expand Down
14 changes: 5 additions & 9 deletions CMake/BackendsDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML")
]]

# For each SFML component the project requires
foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS})
foreach(rmlui_sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS})
# Make the component name lowercase
string(TOLOWER ${sfml_component} sfml_component_lower)
string(TOLOWER ${rmlui_sfml_component} rmlui_sfml_component_lower)

if(TARGET sfml-${sfml_component_lower})
if(TARGET sfml-${rmlui_sfml_component_lower})
#[[
RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE:
Because the target CMake version is 3.10, we can't alias non-global targets nor global imported targets.
Expand All @@ -150,14 +150,10 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML")
]]

# If the target exists, alias it
add_library(SFML::${sfml_component} INTERFACE IMPORTED)
target_link_libraries(SFML::${sfml_component} INTERFACE sfml-${sfml_component_lower})
add_library(SFML::${rmlui_sfml_component} INTERFACE IMPORTED)
target_link_libraries(SFML::${rmlui_sfml_component} INTERFACE sfml-${rmlui_sfml_component_lower})
endif()
endforeach()

# Because module-specific targets already exist, there's no need for the wrapper for the older find module
# Set up wrapper target as dumb target
add_library(rmlui_SFML_old_wrapper INTERFACE)
endif()
endif()

Expand Down

0 comments on commit 6f3a14f

Please sign in to comment.