mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Add SFML:: namespace to targets
This removes the sfml- prefixed targets from the export set. The sfml- prefixed targets are still available within the build tree but not to downstream users thus making this an API breaking change when compared to the 2.x releases. To keep things consistent, usage of the sfml- targets were replaced with their namespaced counterparts. This has a number of benefits: 1. It's more idiomatic. Modern CMake libraries are expected to have namespaced targets. 2. Namespaced targets are less likely to collide with user-defined targets. No one will accidentally define a SFML:: target. 3. If a namespaced target is not found by CMake, configuration will immediately stop.
This commit is contained in:
parent
b717a68fba
commit
4586db91a9
@ -50,10 +50,10 @@ function(sfml_set_common_ios_properties target)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# add a new target which is a SFML library
|
# add a new target which is a SFML library
|
||||||
# example: sfml_add_library(sfml-graphics
|
# example: sfml_add_library(Graphics
|
||||||
# SOURCES sprite.cpp image.cpp ...
|
# SOURCES sprite.cpp image.cpp ...
|
||||||
# [STATIC]) # Always create a static library and ignore BUILD_SHARED_LIBS
|
# [STATIC]) # Always create a static library and ignore BUILD_SHARED_LIBS
|
||||||
macro(sfml_add_library target)
|
macro(sfml_add_library module)
|
||||||
|
|
||||||
# parse the arguments
|
# parse the arguments
|
||||||
cmake_parse_arguments(THIS "STATIC" "" "SOURCES" ${ARGN})
|
cmake_parse_arguments(THIS "STATIC" "" "SOURCES" ${ARGN})
|
||||||
@ -62,11 +62,13 @@ macro(sfml_add_library target)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create the target
|
# create the target
|
||||||
|
string(TOLOWER sfml-${module} target)
|
||||||
if (THIS_STATIC)
|
if (THIS_STATIC)
|
||||||
add_library(${target} STATIC ${THIS_SOURCES})
|
add_library(${target} STATIC ${THIS_SOURCES})
|
||||||
else()
|
else()
|
||||||
add_library(${target} ${THIS_SOURCES})
|
add_library(${target} ${THIS_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
add_library(SFML::${module} ALIAS ${target})
|
||||||
|
|
||||||
# enable C++17 support
|
# enable C++17 support
|
||||||
target_compile_features(${target} PUBLIC cxx_std_17)
|
target_compile_features(${target} PUBLIC cxx_std_17)
|
||||||
@ -78,6 +80,9 @@ macro(sfml_add_library target)
|
|||||||
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
|
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
|
||||||
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
|
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
|
||||||
|
|
||||||
|
# define the export name of the module
|
||||||
|
set_target_properties(${target} PROPERTIES EXPORT_NAME ${module})
|
||||||
|
|
||||||
# adjust the output file prefix/suffix to match our conventions
|
# adjust the output file prefix/suffix to match our conventions
|
||||||
if(BUILD_SHARED_LIBS AND NOT THIS_STATIC)
|
if(BUILD_SHARED_LIBS AND NOT THIS_STATIC)
|
||||||
if(SFML_OS_WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
@ -232,7 +237,7 @@ endmacro()
|
|||||||
# example: sfml_add_example(ftp
|
# example: sfml_add_example(ftp
|
||||||
# SOURCES ftp.cpp ...
|
# SOURCES ftp.cpp ...
|
||||||
# BUNDLE_RESOURCES MainMenu.nib ... # Files to be added in target but not installed next to the executable
|
# BUNDLE_RESOURCES MainMenu.nib ... # Files to be added in target but not installed next to the executable
|
||||||
# DEPENDS sfml-network
|
# DEPENDS SFML::Network
|
||||||
# RESOURCES_DIR resources) # A directory to install next to the executable and sources
|
# RESOURCES_DIR resources) # A directory to install next to the executable and sources
|
||||||
macro(sfml_add_example target)
|
macro(sfml_add_example target)
|
||||||
|
|
||||||
@ -251,7 +256,7 @@ macro(sfml_add_example target)
|
|||||||
# create the target
|
# create the target
|
||||||
if(THIS_GUI_APP AND SFML_OS_WINDOWS AND NOT DEFINED CMAKE_CONFIGURATION_TYPES AND ${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
if(THIS_GUI_APP AND SFML_OS_WINDOWS AND NOT DEFINED CMAKE_CONFIGURATION_TYPES AND ${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
||||||
add_executable(${target} WIN32 ${target_input})
|
add_executable(${target} WIN32 ${target_input})
|
||||||
target_link_libraries(${target} PRIVATE sfml-main)
|
target_link_libraries(${target} PRIVATE SFML::Main)
|
||||||
elseif(THIS_GUI_APP AND SFML_OS_IOS)
|
elseif(THIS_GUI_APP AND SFML_OS_IOS)
|
||||||
|
|
||||||
# For iOS apps we need the launch screen storyboard,
|
# For iOS apps we need the launch screen storyboard,
|
||||||
@ -265,7 +270,7 @@ macro(sfml_add_example target)
|
|||||||
set_target_properties(${target} PROPERTIES RESOURCE "${RESOURCES}"
|
set_target_properties(${target} PROPERTIES RESOURCE "${RESOURCES}"
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${INFO_PLIST}
|
MACOSX_BUNDLE_INFO_PLIST ${INFO_PLIST}
|
||||||
MACOSX_BUNDLE_ICON_FILE icon.icns)
|
MACOSX_BUNDLE_ICON_FILE icon.icns)
|
||||||
target_link_libraries(${target} PRIVATE sfml-main)
|
target_link_libraries(${target} PRIVATE SFML::Main)
|
||||||
else()
|
else()
|
||||||
add_executable(${target} ${target_input})
|
add_executable(${target} ${target_input})
|
||||||
endif()
|
endif()
|
||||||
@ -298,7 +303,7 @@ endmacro()
|
|||||||
# add a new target which is a SFML test
|
# add a new target which is a SFML test
|
||||||
# example: sfml_add_test(sfml-test
|
# example: sfml_add_test(sfml-test
|
||||||
# ftp.cpp ...
|
# ftp.cpp ...
|
||||||
# sfml-network)
|
# SFML::Network)
|
||||||
function(sfml_add_test target SOURCES DEPENDS)
|
function(sfml_add_test target SOURCES DEPENDS)
|
||||||
|
|
||||||
# set a source group for the source files
|
# set a source group for the source files
|
||||||
@ -447,6 +452,7 @@ function(sfml_export_targets)
|
|||||||
|
|
||||||
install(EXPORT SFMLConfigExport
|
install(EXPORT SFMLConfigExport
|
||||||
FILE ${targets_config_filename}
|
FILE ${targets_config_filename}
|
||||||
|
NAMESPACE SFML::
|
||||||
DESTINATION ${config_package_location})
|
DESTINATION ${config_package_location})
|
||||||
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SFMLConfig.cmake"
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SFMLConfig.cmake"
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
# Usage
|
# Usage
|
||||||
# -----
|
# -----
|
||||||
#
|
#
|
||||||
# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
|
# When you try to locate the SFML libraries, you must specify which modules you want to use (System, Window, Graphics, Network, Audio, Main).
|
||||||
# If none is given, no imported target will be created and you won't be able to link to SFML libraries.
|
# If none is given, no imported target will be created and you won't be able to link to SFML libraries.
|
||||||
# example:
|
# example:
|
||||||
# find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
|
# find_package(SFML COMPONENTS Graphics Window System) # find the graphics, window and system modules
|
||||||
#
|
#
|
||||||
# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
|
# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
|
||||||
# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
|
# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
|
||||||
@ -22,7 +22,7 @@
|
|||||||
# they will all be configured automatically, even if you use SFML static libraries.
|
# they will all be configured automatically, even if you use SFML static libraries.
|
||||||
# example:
|
# example:
|
||||||
# set(SFML_STATIC_LIBRARIES TRUE)
|
# set(SFML_STATIC_LIBRARIES TRUE)
|
||||||
# find_package(SFML 3 COMPONENTS network system)
|
# find_package(SFML 3 COMPONENTS Network System)
|
||||||
#
|
#
|
||||||
# When searching for SFML with find_package(), keep in mind that it will also find versions which are
|
# When searching for SFML with find_package(), keep in mind that it will also find versions which are
|
||||||
# in development (i.e. between two released versions), if you have them in your search path.
|
# in development (i.e. between two released versions), if you have them in your search path.
|
||||||
@ -49,24 +49,24 @@
|
|||||||
# ------
|
# ------
|
||||||
#
|
#
|
||||||
# This script defines the following variables:
|
# This script defines the following variables:
|
||||||
# - For each specified module XXX (system, window, graphics, network, audio, main):
|
# - For each specified module XXX (System, Window, Graphics, Network, Audio, Main):
|
||||||
# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
|
# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
|
||||||
# - SFML_FOUND: true if all the required modules are found
|
# - SFML_FOUND: true if all the required modules are found
|
||||||
#
|
#
|
||||||
# And the following targets:
|
# And the following targets:
|
||||||
# - For each specified module XXX (system, window, graphics, network, audio, main):
|
# - For each specified module XXX (System, Window, Graphics, Network, Audio, Main):
|
||||||
# - sfml-XXX
|
# - SFML::XXX
|
||||||
# The SFML targets are the same for both Debug and Release build configurations and will automatically provide
|
# The SFML targets are the same for both Debug and Release build configurations and will automatically provide
|
||||||
# correct settings based on your currently active build configuration. The SFML targets name also do not change
|
# correct settings based on your currently active build configuration. The SFML targets name also do not change
|
||||||
# when using dynamic or static SFML libraries.
|
# when using dynamic or static SFML libraries.
|
||||||
#
|
#
|
||||||
# When linking against a SFML target, you do not need to specify indirect dependencies. For example, linking
|
# When linking against a SFML target, you do not need to specify indirect dependencies. For example, linking
|
||||||
# against sfml-graphics will also automatically link against sfml-window and sfml-system.
|
# against SFML::Graphics will also automatically link against SFML::Window and SFML::System.
|
||||||
#
|
#
|
||||||
# example:
|
# example:
|
||||||
# find_package(SFML 2 COMPONENTS graphics audio REQUIRED)
|
# find_package(SFML 3 COMPONENTS Graphics Audio REQUIRED)
|
||||||
# add_executable(myapp ...)
|
# add_executable(myapp ...)
|
||||||
# target_link_libraries(myapp sfml-graphics sfml-audio)
|
# target_link_libraries(myapp PRIVATE SFML::Graphics SFML::Audio)
|
||||||
|
|
||||||
if (NOT SFML_FIND_COMPONENTS)
|
if (NOT SFML_FIND_COMPONENTS)
|
||||||
message(FATAL_ERROR "find_package(SFML) called with no component")
|
message(FATAL_ERROR "find_package(SFML) called with no component")
|
||||||
@ -93,10 +93,10 @@ find_path(SFML_DOC_DIR SFML.tag
|
|||||||
# Update requested components (eg. request window component if graphics component was requested)
|
# Update requested components (eg. request window component if graphics component was requested)
|
||||||
set(FIND_SFML_SYSTEM_DEPENDENCIES "")
|
set(FIND_SFML_SYSTEM_DEPENDENCIES "")
|
||||||
set(FIND_SFML_MAIN_DEPENDENCIES "")
|
set(FIND_SFML_MAIN_DEPENDENCIES "")
|
||||||
set(FIND_SFML_AUDIO_DEPENDENCIES system)
|
set(FIND_SFML_AUDIO_DEPENDENCIES System)
|
||||||
set(FIND_SFML_NETWORK_DEPENDENCIES system)
|
set(FIND_SFML_NETWORK_DEPENDENCIES System)
|
||||||
set(FIND_SFML_WINDOW_DEPENDENCIES system)
|
set(FIND_SFML_WINDOW_DEPENDENCIES System)
|
||||||
set(FIND_SFML_GRAPHICS_DEPENDENCIES window system)
|
set(FIND_SFML_GRAPHICS_DEPENDENCIES Window System)
|
||||||
set(FIND_SFML_ADDITIONAL_COMPONENTS "")
|
set(FIND_SFML_ADDITIONAL_COMPONENTS "")
|
||||||
foreach(component ${SFML_FIND_COMPONENTS})
|
foreach(component ${SFML_FIND_COMPONENTS})
|
||||||
string(TOUPPER "${component}" UPPER_COMPONENT)
|
string(TOUPPER "${component}" UPPER_COMPONENT)
|
||||||
@ -130,7 +130,7 @@ if (EXISTS "${targets_config_file}")
|
|||||||
|
|
||||||
foreach (component ${SFML_FIND_COMPONENTS})
|
foreach (component ${SFML_FIND_COMPONENTS})
|
||||||
string(TOUPPER "${component}" UPPER_COMPONENT)
|
string(TOUPPER "${component}" UPPER_COMPONENT)
|
||||||
if (TARGET sfml-${component})
|
if (TARGET SFML::${component})
|
||||||
set(SFML_${UPPER_COMPONENT}_FOUND TRUE)
|
set(SFML_${UPPER_COMPONENT}_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
set(FIND_SFML_ERROR "Found SFML but requested component '${component}' is missing in the config defined in ${SFML_DIR}.")
|
set(FIND_SFML_ERROR "Found SFML but requested component '${component}' is missing in the config defined in ${SFML_DIR}.")
|
||||||
|
@ -36,8 +36,8 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# sfml-window
|
# SFML::Window
|
||||||
list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
||||||
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
||||||
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
|
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
|
||||||
sfml_bind_dependency(TARGET X11 FRIENDLY_NAME "X11" SEARCH_NAMES "X11")
|
sfml_bind_dependency(TARGET X11 FRIENDLY_NAME "X11" SEARCH_NAMES "X11")
|
||||||
@ -56,14 +56,14 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# sfml-graphics
|
# SFML::Graphics
|
||||||
list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT_INDEX)
|
list(FIND SFML_FIND_COMPONENTS "Graphics" FIND_SFML_GRAPHICS_COMPONENT_INDEX)
|
||||||
if(FIND_SFML_GRAPHICS_COMPONENT_INDEX GREATER -1)
|
if(FIND_SFML_GRAPHICS_COMPONENT_INDEX GREATER -1)
|
||||||
sfml_bind_dependency(TARGET Freetype FRIENDLY_NAME "FreeType" SEARCH_NAMES "freetype")
|
sfml_bind_dependency(TARGET Freetype FRIENDLY_NAME "FreeType" SEARCH_NAMES "freetype")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# sfml-audio
|
# SFML::Audio
|
||||||
list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT_INDEX)
|
list(FIND SFML_FIND_COMPONENTS "Audio" FIND_SFML_AUDIO_COMPONENT_INDEX)
|
||||||
if(FIND_SFML_AUDIO_COMPONENT_INDEX GREATER -1)
|
if(FIND_SFML_AUDIO_COMPONENT_INDEX GREATER -1)
|
||||||
sfml_bind_dependency(TARGET OpenAL FRIENDLY_NAME "OpenAL" SEARCH_NAMES "OpenAL" "openal" "openal32")
|
sfml_bind_dependency(TARGET OpenAL FRIENDLY_NAME "OpenAL" SEARCH_NAMES "OpenAL" "openal" "openal32")
|
||||||
if (NOT FIND_SFML_OS_IOS)
|
if (NOT FIND_SFML_OS_IOS)
|
||||||
|
@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/X11.cpp)
|
|||||||
# define the X11 target
|
# define the X11 target
|
||||||
sfml_add_example(X11Example GUI_APP
|
sfml_add_example(X11Example GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-window X11)
|
DEPENDS SFML::Window X11)
|
||||||
|
|
||||||
# external dependency headers
|
# external dependency headers
|
||||||
target_include_directories(X11Example SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/X11)
|
target_include_directories(X11Example SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/X11)
|
@ -54,8 +54,8 @@ set_source_files_properties(${RESOURCES} PROPERTIES
|
|||||||
sfml_add_example(cocoa
|
sfml_add_example(cocoa
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
BUNDLE_RESOURCES ${RESOURCES}
|
BUNDLE_RESOURCES ${RESOURCES}
|
||||||
DEPENDS sfml-system sfml-window sfml-graphics)
|
DEPENDS SFML::System SFML::Window SFML::Graphics)
|
||||||
set_target_properties(cocoa PROPERTIES
|
set_target_properties(cocoa PROPERTIES
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${SRCROOT}/resources/Cocoa-Info.plist)
|
MACOSX_BUNDLE_INFO_PLIST ${SRCROOT}/resources/Cocoa-Info.plist)
|
||||||
target_link_libraries(cocoa PRIVATE "-framework Cocoa" "-framework Foundation" sfml-graphics)
|
target_link_libraries(cocoa PRIVATE "-framework Cocoa" "-framework Foundation" SFML::Graphics)
|
||||||
|
@ -7,4 +7,4 @@ set(SRC ${SRCROOT}/Ftp.cpp)
|
|||||||
# define the ftp target
|
# define the ftp target
|
||||||
sfml_add_example(ftp
|
sfml_add_example(ftp
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-network)
|
DEPENDS SFML::Network)
|
||||||
|
@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/Island.cpp)
|
|||||||
# define the island target
|
# define the island target
|
||||||
sfml_add_example(island GUI_APP
|
sfml_add_example(island GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics
|
DEPENDS SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
|
||||||
# external dependency headers
|
# external dependency headers
|
||||||
|
@ -7,5 +7,5 @@ set(SRC ${SRCROOT}/Joystick.cpp)
|
|||||||
# define the joystick target
|
# define the joystick target
|
||||||
sfml_add_example(joystick GUI_APP
|
sfml_add_example(joystick GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics
|
DEPENDS SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
@ -15,7 +15,7 @@ endif()
|
|||||||
sfml_add_example(opengl GUI_APP
|
sfml_add_example(opengl GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
BUNDLE_RESOURCES ${RESOURCES}
|
BUNDLE_RESOURCES ${RESOURCES}
|
||||||
DEPENDS sfml-graphics
|
DEPENDS SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
|
||||||
# external dependency headers
|
# external dependency headers
|
||||||
|
@ -9,5 +9,5 @@ set(SRC
|
|||||||
# define the shader target
|
# define the shader target
|
||||||
sfml_add_example(shader GUI_APP
|
sfml_add_example(shader GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics
|
DEPENDS SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
@ -9,4 +9,4 @@ set(SRC ${SRCROOT}/Sockets.cpp
|
|||||||
# define the sockets target
|
# define the sockets target
|
||||||
sfml_add_example(sockets
|
sfml_add_example(sockets
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-network)
|
DEPENDS SFML::Network)
|
||||||
|
@ -7,5 +7,5 @@ set(SRC ${SRCROOT}/Sound.cpp)
|
|||||||
# define the sound target
|
# define the sound target
|
||||||
sfml_add_example(sound
|
sfml_add_example(sound
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-audio
|
DEPENDS SFML::Audio
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
@ -7,4 +7,4 @@ set(SRC ${SRCROOT}/SoundCapture.cpp)
|
|||||||
# define the sound-capture target
|
# define the sound-capture target
|
||||||
sfml_add_example(sound-capture
|
sfml_add_example(sound-capture
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-audio)
|
DEPENDS SFML::Audio)
|
||||||
|
@ -14,5 +14,5 @@ endif()
|
|||||||
sfml_add_example(tennis GUI_APP
|
sfml_add_example(tennis GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
BUNDLE_RESOURCES ${RESOURCES}
|
BUNDLE_RESOURCES ${RESOURCES}
|
||||||
DEPENDS sfml-audio sfml-graphics
|
DEPENDS SFML::Audio SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
@ -9,4 +9,4 @@ set(SRC ${SRCROOT}/VoIP.cpp
|
|||||||
# define the voip target
|
# define the voip target
|
||||||
sfml_add_example(voip
|
sfml_add_example(voip
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-audio sfml-network)
|
DEPENDS SFML::Audio SFML::Network)
|
||||||
|
@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/Vulkan.cpp)
|
|||||||
# define the window target
|
# define the window target
|
||||||
sfml_add_example(vulkan GUI_APP
|
sfml_add_example(vulkan GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics
|
DEPENDS SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
|
||||||
# external dependency headers
|
# external dependency headers
|
||||||
|
@ -7,5 +7,5 @@ set(SRC ${SRCROOT}/Win32.cpp)
|
|||||||
# define the win32 target
|
# define the win32 target
|
||||||
sfml_add_example(win32 GUI_APP
|
sfml_add_example(win32 GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics
|
DEPENDS SFML::Graphics
|
||||||
RESOURCES_DIR resources)
|
RESOURCES_DIR resources)
|
||||||
|
@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/Window.cpp)
|
|||||||
# define the window target
|
# define the window target
|
||||||
sfml_add_example(window GUI_APP
|
sfml_add_example(window GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-window)
|
DEPENDS SFML::Window)
|
||||||
|
|
||||||
# external dependency headers
|
# external dependency headers
|
||||||
target_include_directories(window SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/window)
|
target_include_directories(window SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/window)
|
@ -77,7 +77,7 @@ target_compile_definitions(VORBIS INTERFACE "OV_EXCLUDE_STATIC_CALLBACKS")
|
|||||||
target_compile_definitions(FLAC INTERFACE "FLAC__NO_DLL")
|
target_compile_definitions(FLAC INTERFACE "FLAC__NO_DLL")
|
||||||
|
|
||||||
# define the sfml-audio target
|
# define the sfml-audio target
|
||||||
sfml_add_library(sfml-audio
|
sfml_add_library(Audio
|
||||||
SOURCES ${SRC} ${CODECS_SRC})
|
SOURCES ${SRC} ${CODECS_SRC})
|
||||||
|
|
||||||
# setup dependencies
|
# setup dependencies
|
||||||
@ -91,5 +91,5 @@ if(SFML_OS_ANDROID)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(sfml-audio
|
target_link_libraries(sfml-audio
|
||||||
PUBLIC sfml-system
|
PUBLIC SFML::System
|
||||||
PRIVATE VORBIS FLAC)
|
PRIVATE VORBIS FLAC)
|
||||||
|
@ -87,11 +87,11 @@ source_group("render texture" FILES ${RENDER_TEXTURE_SRC})
|
|||||||
|
|
||||||
|
|
||||||
# define the sfml-graphics target
|
# define the sfml-graphics target
|
||||||
sfml_add_library(sfml-graphics
|
sfml_add_library(Graphics
|
||||||
SOURCES ${SRC} ${DRAWABLES_SRC} ${RENDER_TEXTURE_SRC} ${STB_SRC})
|
SOURCES ${SRC} ${DRAWABLES_SRC} ${RENDER_TEXTURE_SRC} ${STB_SRC})
|
||||||
|
|
||||||
# setup dependencies
|
# setup dependencies
|
||||||
target_link_libraries(sfml-graphics PUBLIC sfml-window)
|
target_link_libraries(sfml-graphics PUBLIC SFML::Window)
|
||||||
|
|
||||||
# stb_image sources
|
# stb_image sources
|
||||||
target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image")
|
target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image")
|
||||||
|
@ -14,7 +14,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# define the sfml-main target
|
# define the sfml-main target
|
||||||
sfml_add_library(sfml-main STATIC SOURCES ${SRC})
|
sfml_add_library(Main STATIC SOURCES ${SRC})
|
||||||
|
|
||||||
if(SFML_OS_ANDROID)
|
if(SFML_OS_ANDROID)
|
||||||
# glad sources
|
# glad sources
|
||||||
@ -32,5 +32,5 @@ set_target_properties(sfml-main PROPERTIES
|
|||||||
# from depending on shared libraries), we need a boostrap activity which
|
# from depending on shared libraries), we need a boostrap activity which
|
||||||
# will load our shared libraries manually
|
# will load our shared libraries manually
|
||||||
if(SFML_OS_ANDROID)
|
if(SFML_OS_ANDROID)
|
||||||
sfml_add_library(sfml-activity SOURCES ${SRCROOT}/SFMLActivity.cpp)
|
sfml_add_library(Activity SOURCES ${SRCROOT}/SFMLActivity.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
@ -45,11 +45,11 @@ endif()
|
|||||||
source_group("" FILES ${SRC})
|
source_group("" FILES ${SRC})
|
||||||
|
|
||||||
# define the sfml-network target
|
# define the sfml-network target
|
||||||
sfml_add_library(sfml-network
|
sfml_add_library(Network
|
||||||
SOURCES ${SRC})
|
SOURCES ${SRC})
|
||||||
|
|
||||||
# setup dependencies
|
# setup dependencies
|
||||||
target_link_libraries(sfml-network PUBLIC sfml-system)
|
target_link_libraries(sfml-network PUBLIC SFML::System)
|
||||||
if(SFML_OS_WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
target_link_libraries(sfml-network PRIVATE ws2_32)
|
target_link_libraries(sfml-network PRIVATE ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
@ -47,7 +47,7 @@ endif()
|
|||||||
source_group("unix" FILES ${PLATFORM_SRC})
|
source_group("unix" FILES ${PLATFORM_SRC})
|
||||||
|
|
||||||
# define the sfml-system target
|
# define the sfml-system target
|
||||||
sfml_add_library(sfml-system
|
sfml_add_library(System
|
||||||
SOURCES ${SRC} ${PLATFORM_SRC})
|
SOURCES ${SRC} ${PLATFORM_SRC})
|
||||||
|
|
||||||
if(SFML_OS_ANDROID)
|
if(SFML_OS_ANDROID)
|
||||||
|
@ -234,9 +234,9 @@ elseif(SFML_OS_ANDROID)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# define the sfml-window target
|
# define the sfml-window target
|
||||||
sfml_add_library(sfml-window
|
sfml_add_library(Window
|
||||||
SOURCES ${SRC} ${PLATFORM_SRC})
|
SOURCES ${SRC} ${PLATFORM_SRC})
|
||||||
target_link_libraries(sfml-window PUBLIC sfml-system)
|
target_link_libraries(sfml-window PUBLIC SFML::System)
|
||||||
|
|
||||||
# glad sources
|
# glad sources
|
||||||
target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include")
|
target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include")
|
||||||
|
@ -15,8 +15,7 @@ SET(SYSTEM_SRC
|
|||||||
"${SRCROOT}/TestUtilities/SystemUtil.hpp"
|
"${SRCROOT}/TestUtilities/SystemUtil.hpp"
|
||||||
"${SRCROOT}/TestUtilities/SystemUtil.cpp"
|
"${SRCROOT}/TestUtilities/SystemUtil.cpp"
|
||||||
)
|
)
|
||||||
|
sfml_add_test(test-sfml-system "${SYSTEM_SRC}" SFML::System)
|
||||||
sfml_add_test(test-sfml-system "${SYSTEM_SRC}" sfml-system)
|
|
||||||
target_link_libraries(test-sfml-system PRIVATE sfml-test-main)
|
target_link_libraries(test-sfml-system PRIVATE sfml-test-main)
|
||||||
|
|
||||||
if(SFML_BUILD_WINDOW)
|
if(SFML_BUILD_WINDOW)
|
||||||
@ -25,7 +24,7 @@ if(SFML_BUILD_WINDOW)
|
|||||||
"${SRCROOT}/TestUtilities/WindowUtil.hpp"
|
"${SRCROOT}/TestUtilities/WindowUtil.hpp"
|
||||||
"${SRCROOT}/TestUtilities/WindowUtil.cpp"
|
"${SRCROOT}/TestUtilities/WindowUtil.cpp"
|
||||||
)
|
)
|
||||||
sfml_add_test(test-sfml-window "${WINDOW_SRC}" sfml-window)
|
sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window)
|
||||||
target_link_libraries(test-sfml-window PRIVATE sfml-test-main)
|
target_link_libraries(test-sfml-window PRIVATE sfml-test-main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ if(SFML_BUILD_GRAPHICS)
|
|||||||
"${SRCROOT}/TestUtilities/GraphicsUtil.hpp"
|
"${SRCROOT}/TestUtilities/GraphicsUtil.hpp"
|
||||||
"${SRCROOT}/TestUtilities/GraphicsUtil.cpp"
|
"${SRCROOT}/TestUtilities/GraphicsUtil.cpp"
|
||||||
)
|
)
|
||||||
sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" sfml-graphics)
|
sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics)
|
||||||
target_link_libraries(test-sfml-graphics PRIVATE sfml-test-main)
|
target_link_libraries(test-sfml-graphics PRIVATE sfml-test-main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ if(SFML_BUILD_NETWORK)
|
|||||||
SET(NETWORK_SRC
|
SET(NETWORK_SRC
|
||||||
"${SRCROOT}/Network/Packet.cpp"
|
"${SRCROOT}/Network/Packet.cpp"
|
||||||
)
|
)
|
||||||
sfml_add_test(test-sfml-network "${NETWORK_SRC}" sfml-network)
|
sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network)
|
||||||
target_link_libraries(test-sfml-network PRIVATE sfml-test-main)
|
target_link_libraries(test-sfml-network PRIVATE sfml-test-main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user