mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fix CMake formatting inconsistencies
This commit is contained in:
parent
e948a5f41e
commit
753644a5bd
@ -100,7 +100,7 @@ endif()
|
|||||||
# Android options
|
# Android options
|
||||||
if(SFML_OS_ANDROID)
|
if(SFML_OS_ANDROID)
|
||||||
sfml_set_option(SFML_ANDROID_USE_SUSPEND_AWARE_CLOCK FALSE BOOL "TRUE to use an sf::Clock implementation which takes system sleep time into account (keeps advancing during suspension), FALSE to default to another available monotonic clock")
|
sfml_set_option(SFML_ANDROID_USE_SUSPEND_AWARE_CLOCK FALSE BOOL "TRUE to use an sf::Clock implementation which takes system sleep time into account (keeps advancing during suspension), FALSE to default to another available monotonic clock")
|
||||||
if (SFML_ANDROID_USE_SUSPEND_AWARE_CLOCK)
|
if(SFML_ANDROID_USE_SUSPEND_AWARE_CLOCK)
|
||||||
add_definitions(-DSFML_ANDROID_USE_SUSPEND_AWARE_CLOCK)
|
add_definitions(-DSFML_ANDROID_USE_SUSPEND_AWARE_CLOCK)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ if(SFML_OS_ANDROID)
|
|||||||
list(PREPEND CMAKE_FIND_ROOT_PATH "${PROJECT_SOURCE_DIR}")
|
list(PREPEND CMAKE_FIND_ROOT_PATH "${PROJECT_SOURCE_DIR}")
|
||||||
|
|
||||||
# make sure there's the android library available
|
# make sure there's the android library available
|
||||||
if (CMAKE_ANDROID_API LESS 26)
|
if(CMAKE_ANDROID_API LESS 26)
|
||||||
message(FATAL_ERROR "Android API level (${CMAKE_ANDROID_API}) must be equal or greater than 26.")
|
message(FATAL_ERROR "Android API level (${CMAKE_ANDROID_API}) must be equal or greater than 26.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ if(SFML_OS_ANDROID)
|
|||||||
# we install libs in a subdirectory named after the ABI
|
# we install libs in a subdirectory named after the ABI
|
||||||
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CMAKE_ANDROID_ARCH_ABI}")
|
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CMAKE_ANDROID_ARCH_ABI}")
|
||||||
# pass shared STL configuration (if any)
|
# pass shared STL configuration (if any)
|
||||||
if (CMAKE_ANDROID_STL_TYPE MATCHES "_shared")
|
if(CMAKE_ANDROID_STL_TYPE MATCHES "_shared")
|
||||||
add_definitions("-DSTL_LIBRARY=${CMAKE_ANDROID_STL_TYPE}")
|
add_definitions("-DSTL_LIBRARY=${CMAKE_ANDROID_STL_TYPE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -230,8 +230,8 @@ if(SFML_OS_MACOSX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# only the default x86_64 or arm64 are supported
|
# only the default x86_64 or arm64 are supported
|
||||||
foreach (arch IN LISTS CMAKE_OSX_ARCHITECTURES)
|
foreach(arch IN LISTS CMAKE_OSX_ARCHITECTURES)
|
||||||
if (NOT (arch STREQUAL "x86_64" OR arch STREQUAL "arm64"))
|
if(NOT (arch STREQUAL "x86_64" OR arch STREQUAL "arm64"))
|
||||||
message(FATAL_ERROR "Invalid arch ${arch}")
|
message(FATAL_ERROR "Invalid arch ${arch}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -256,7 +256,7 @@ if(SFML_BUILD_DOC)
|
|||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif()
|
endif()
|
||||||
if(SFML_BUILD_TEST_SUITE)
|
if(SFML_BUILD_TEST_SUITE)
|
||||||
if (SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
message( WARNING "Unit testing not supported on iOS")
|
message( WARNING "Unit testing not supported on iOS")
|
||||||
elseif(SFML_BUILD_WINDOW AND SFML_BUILD_GRAPHICS AND SFML_BUILD_NETWORK AND SFML_BUILD_AUDIO)
|
elseif(SFML_BUILD_WINDOW AND SFML_BUILD_GRAPHICS AND SFML_BUILD_NETWORK AND SFML_BUILD_AUDIO)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
@ -4,9 +4,9 @@ include(CMakeParseArguments)
|
|||||||
include(${CMAKE_CURRENT_LIST_DIR}/CompilerWarnings.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/CompilerWarnings.cmake)
|
||||||
|
|
||||||
# This little macro lets you set any Xcode specific property
|
# This little macro lets you set any Xcode specific property
|
||||||
macro (sfml_set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
|
macro(sfml_set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
|
||||||
set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
|
set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
|
||||||
endmacro ()
|
endmacro()
|
||||||
|
|
||||||
# set the appropriate standard library on each platform for the given target
|
# set the appropriate standard library on each platform for the given target
|
||||||
# example: sfml_set_stdlib(sfml-system)
|
# example: sfml_set_stdlib(sfml-system)
|
||||||
@ -20,8 +20,8 @@ function(sfml_set_stdlib target)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFML_OS_MACOSX)
|
if(SFML_OS_MACOSX)
|
||||||
if (${CMAKE_GENERATOR} MATCHES "Xcode")
|
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||||
sfml_set_xcode_property(${target} CLANG_CXX_LIBRARY "libc++")
|
sfml_set_xcode_property(${target} CLANG_CXX_LIBRARY "libc++")
|
||||||
elseif(SFML_COMPILER_CLANG)
|
elseif(SFML_COMPILER_CLANG)
|
||||||
target_compile_options(${target} PRIVATE "-stdlib=libc++")
|
target_compile_options(${target} PRIVATE "-stdlib=libc++")
|
||||||
@ -39,7 +39,7 @@ function(sfml_set_common_ios_properties target)
|
|||||||
sfml_set_xcode_property(${target} CODE_SIGN_IDENTITY "${SFML_CODE_SIGN_IDENTITY}")
|
sfml_set_xcode_property(${target} CODE_SIGN_IDENTITY "${SFML_CODE_SIGN_IDENTITY}")
|
||||||
|
|
||||||
get_target_property(target_type ${target} TYPE)
|
get_target_property(target_type ${target} TYPE)
|
||||||
if (target_type STREQUAL "EXECUTABLE")
|
if(target_type STREQUAL "EXECUTABLE")
|
||||||
set_target_properties(${target} PROPERTIES
|
set_target_properties(${target} PROPERTIES
|
||||||
MACOSX_BUNDLE TRUE # Bare executables are not usable on iOS, only bundle applications
|
MACOSX_BUNDLE TRUE # Bare executables are not usable on iOS, only bundle applications
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER "org.sfml-dev.${target}" # If missing, trying to launch an example in simulator will make Xcode < 9.3 crash
|
MACOSX_BUNDLE_GUI_IDENTIFIER "org.sfml-dev.${target}" # If missing, trying to launch an example in simulator will make Xcode < 9.3 crash
|
||||||
@ -57,13 +57,13 @@ 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})
|
||||||
if (NOT "${THIS_UNPARSED_ARGUMENTS}" STREQUAL "")
|
if(NOT "${THIS_UNPARSED_ARGUMENTS}" STREQUAL "")
|
||||||
message(FATAL_ERROR "Extra unparsed arguments when calling sfml_add_library: ${THIS_UNPARSED_ARGUMENTS}")
|
message(FATAL_ERROR "Extra unparsed arguments when calling sfml_add_library: ${THIS_UNPARSED_ARGUMENTS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create the target
|
# create the target
|
||||||
string(TOLOWER sfml-${module} 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})
|
||||||
@ -74,7 +74,7 @@ macro(sfml_add_library module)
|
|||||||
target_compile_features(${target} PUBLIC cxx_std_17)
|
target_compile_features(${target} PUBLIC cxx_std_17)
|
||||||
|
|
||||||
# Add required flags for GCC if coverage reporting is enabled
|
# Add required flags for GCC if coverage reporting is enabled
|
||||||
if (SFML_ENABLE_COVERAGE AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG))
|
if(SFML_ENABLE_COVERAGE AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG))
|
||||||
target_compile_options(${target} PUBLIC $<$<CONFIG:DEBUG>:-O0> $<$<CONFIG:DEBUG>:-g> $<$<CONFIG:DEBUG>:-fprofile-arcs> $<$<CONFIG:DEBUG>:-ftest-coverage>)
|
target_compile_options(${target} PUBLIC $<$<CONFIG:DEBUG>:-O0> $<$<CONFIG:DEBUG>:-g> $<$<CONFIG:DEBUG>:-fprofile-arcs> $<$<CONFIG:DEBUG>:-ftest-coverage>)
|
||||||
target_link_options(${target} PUBLIC $<$<CONFIG:DEBUG>:--coverage>)
|
target_link_options(${target} PUBLIC $<$<CONFIG:DEBUG>:--coverage>)
|
||||||
endif()
|
endif()
|
||||||
@ -116,7 +116,7 @@ macro(sfml_add_library module)
|
|||||||
target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${target}.rc")
|
target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${target}.rc")
|
||||||
source_group("" FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.rc")
|
source_group("" FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.rc")
|
||||||
|
|
||||||
if (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)
|
if(SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)
|
||||||
# on Windows + gcc/clang get rid of "lib" prefix for shared libraries,
|
# on Windows + gcc/clang get rid of "lib" prefix for shared libraries,
|
||||||
# and transform the ".dll.a" suffix into ".a" for import libraries
|
# and transform the ".dll.a" suffix into ".a" for import libraries
|
||||||
set_target_properties(${target} PROPERTIES PREFIX "")
|
set_target_properties(${target} PROPERTIES PREFIX "")
|
||||||
@ -131,7 +131,7 @@ macro(sfml_add_library module)
|
|||||||
set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
|
set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
|
||||||
set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
|
set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
|
||||||
|
|
||||||
if (SFML_USE_STATIC_STD_LIBS)
|
if(SFML_USE_STATIC_STD_LIBS)
|
||||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -198,14 +198,14 @@ macro(sfml_add_library module)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
sfml_set_common_ios_properties(${target})
|
sfml_set_common_ios_properties(${target})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# sfml-activity library is our bootstrap activity and must not depend on stlport_shared
|
# sfml-activity library is our bootstrap activity and must not depend on stlport_shared
|
||||||
# (otherwise Android will fail to load it)
|
# (otherwise Android will fail to load it)
|
||||||
if (SFML_OS_ANDROID)
|
if(SFML_OS_ANDROID)
|
||||||
if (${target} MATCHES "sfml-activity")
|
if(${target} MATCHES "sfml-activity")
|
||||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fpermissive)
|
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fpermissive)
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-landroid -llog")
|
set_target_properties(${target} PROPERTIES LINK_FLAGS "-landroid -llog")
|
||||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY_WITHOUT_STL})
|
set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY_WITHOUT_STL})
|
||||||
@ -226,7 +226,7 @@ macro(sfml_add_library module)
|
|||||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
if (SFML_BUILD_FRAMEWORKS)
|
if(SFML_BUILD_FRAMEWORKS)
|
||||||
target_include_directories(${target} INTERFACE $<INSTALL_INTERFACE:SFML.framework>)
|
target_include_directories(${target} INTERFACE $<INSTALL_INTERFACE:SFML.framework>)
|
||||||
else()
|
else()
|
||||||
target_include_directories(${target} INTERFACE $<INSTALL_INTERFACE:include>)
|
target_include_directories(${target} INTERFACE $<INSTALL_INTERFACE:include>)
|
||||||
@ -281,7 +281,7 @@ macro(sfml_add_example target)
|
|||||||
add_executable(${target} ${target_input})
|
add_executable(${target} ${target_input})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFML_USE_STATIC_STD_LIBS)
|
if(SFML_USE_STATIC_STD_LIBS)
|
||||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ macro(sfml_add_example target)
|
|||||||
target_link_libraries(${target} PRIVATE ${THIS_DEPENDS})
|
target_link_libraries(${target} PRIVATE ${THIS_DEPENDS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
sfml_set_common_ios_properties(${target})
|
sfml_set_common_ios_properties(${target})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -332,8 +332,8 @@ function(sfml_add_test target SOURCES DEPENDS)
|
|||||||
|
|
||||||
# If coverage is enabled for MSVC and we are linking statically, use /WHOLEARCHIVE
|
# If coverage is enabled for MSVC and we are linking statically, use /WHOLEARCHIVE
|
||||||
# to make sure the linker doesn't discard unused code sections before coverage can be measured
|
# to make sure the linker doesn't discard unused code sections before coverage can be measured
|
||||||
if (SFML_ENABLE_COVERAGE AND SFML_COMPILER_MSVC AND NOT BUILD_SHARED_LIBS)
|
if(SFML_ENABLE_COVERAGE AND SFML_COMPILER_MSVC AND NOT BUILD_SHARED_LIBS)
|
||||||
foreach (DEPENDENCY ${DEPENDS})
|
foreach(DEPENDENCY ${DEPENDS})
|
||||||
target_link_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/WHOLEARCHIVE:$<TARGET_LINKER_FILE:${DEPENDENCY}>>)
|
target_link_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/WHOLEARCHIVE:$<TARGET_LINKER_FILE:${DEPENDENCY}>>)
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
@ -352,29 +352,29 @@ function(sfml_add_external)
|
|||||||
list(GET ARGN 0 target)
|
list(GET ARGN 0 target)
|
||||||
list(REMOVE_AT ARGN 0)
|
list(REMOVE_AT ARGN 0)
|
||||||
|
|
||||||
if (TARGET ${target})
|
if(TARGET ${target})
|
||||||
message(FATAL_ERROR "Target '${target}' is already defined")
|
message(FATAL_ERROR "Target '${target}' is already defined")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_parse_arguments(THIS "" "" "INCLUDE;LINK" ${ARGN})
|
cmake_parse_arguments(THIS "" "" "INCLUDE;LINK" ${ARGN})
|
||||||
if (THIS_UNPARSED_ARGUMENTS)
|
if(THIS_UNPARSED_ARGUMENTS)
|
||||||
message(FATAL_ERROR "Unknown arguments when calling sfml_add_external: ${THIS_UNPARSED_ARGUMENTS}")
|
message(FATAL_ERROR "Unknown arguments when calling sfml_add_external: ${THIS_UNPARSED_ARGUMENTS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${target} INTERFACE)
|
add_library(${target} INTERFACE)
|
||||||
|
|
||||||
if (THIS_INCLUDE)
|
if(THIS_INCLUDE)
|
||||||
foreach(include_dir IN LISTS THIS_INCLUDE)
|
foreach(include_dir IN LISTS THIS_INCLUDE)
|
||||||
if (NOT include_dir)
|
if(NOT include_dir)
|
||||||
message(FATAL_ERROR "No path given for include dir ${THIS_INCLUDE}")
|
message(FATAL_ERROR "No path given for include dir ${THIS_INCLUDE}")
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(${target} SYSTEM INTERFACE "$<BUILD_INTERFACE:${include_dir}>")
|
target_include_directories(${target} SYSTEM INTERFACE "$<BUILD_INTERFACE:${include_dir}>")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (THIS_LINK)
|
if(THIS_LINK)
|
||||||
foreach(link_item IN LISTS THIS_LINK)
|
foreach(link_item IN LISTS THIS_LINK)
|
||||||
if (NOT link_item)
|
if(NOT link_item)
|
||||||
message(FATAL_ERROR "Missing item in ${THIS_LINK}")
|
message(FATAL_ERROR "Missing item in ${THIS_LINK}")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${target} INTERFACE "$<BUILD_INTERFACE:${link_item}>")
|
target_link_libraries(${target} INTERFACE "$<BUILD_INTERFACE:${link_item}>")
|
||||||
@ -393,16 +393,16 @@ function(sfml_find_package)
|
|||||||
list(GET ARGN 0 target)
|
list(GET ARGN 0 target)
|
||||||
list(REMOVE_AT ARGN 0)
|
list(REMOVE_AT ARGN 0)
|
||||||
|
|
||||||
if (TARGET ${target})
|
if(TARGET ${target})
|
||||||
message(FATAL_ERROR "Target '${target}' is already defined")
|
message(FATAL_ERROR "Target '${target}' is already defined")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_parse_arguments(THIS "" "" "INCLUDE;LINK" ${ARGN})
|
cmake_parse_arguments(THIS "" "" "INCLUDE;LINK" ${ARGN})
|
||||||
if (THIS_UNPARSED_ARGUMENTS)
|
if(THIS_UNPARSED_ARGUMENTS)
|
||||||
message(FATAL_ERROR "Unknown arguments when calling sfml_find_package: ${THIS_UNPARSED_ARGUMENTS}")
|
message(FATAL_ERROR "Unknown arguments when calling sfml_find_package: ${THIS_UNPARSED_ARGUMENTS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
find_host_package(${target} REQUIRED)
|
find_host_package(${target} REQUIRED)
|
||||||
else()
|
else()
|
||||||
find_package(${target} REQUIRED)
|
find_package(${target} REQUIRED)
|
||||||
@ -411,14 +411,14 @@ function(sfml_find_package)
|
|||||||
# Make sure to interpret the items in INCLUDE and LINK parameters. sfml_add_external()
|
# Make sure to interpret the items in INCLUDE and LINK parameters. sfml_add_external()
|
||||||
# does not interpret given items in order to also accept parameters that must not be interpreted
|
# does not interpret given items in order to also accept parameters that must not be interpreted
|
||||||
set(LINK_LIST "")
|
set(LINK_LIST "")
|
||||||
if (THIS_LINK)
|
if(THIS_LINK)
|
||||||
foreach(link_item IN LISTS THIS_LINK)
|
foreach(link_item IN LISTS THIS_LINK)
|
||||||
list(APPEND LINK_LIST "${${link_item}}")
|
list(APPEND LINK_LIST "${${link_item}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(INCLUDE_LIST "")
|
set(INCLUDE_LIST "")
|
||||||
if (THIS_INCLUDE)
|
if(THIS_INCLUDE)
|
||||||
foreach(include_dir IN LISTS THIS_INCLUDE)
|
foreach(include_dir IN LISTS THIS_INCLUDE)
|
||||||
list(APPEND INCLUDE_LIST "${${include_dir}}")
|
list(APPEND INCLUDE_LIST "${${include_dir}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -438,7 +438,7 @@ function(sfml_export_targets)
|
|||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
set(config_name "Shared")
|
set(config_name "Shared")
|
||||||
else()
|
else()
|
||||||
set(config_name "Static")
|
set(config_name "Static")
|
||||||
@ -448,7 +448,7 @@ function(sfml_export_targets)
|
|||||||
export(EXPORT SFMLConfigExport
|
export(EXPORT SFMLConfigExport
|
||||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/${targets_config_filename}")
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/${targets_config_filename}")
|
||||||
|
|
||||||
if (SFML_BUILD_FRAMEWORKS)
|
if(SFML_BUILD_FRAMEWORKS)
|
||||||
set(config_package_location "SFML.framework/Resources/CMake")
|
set(config_package_location "SFML.framework/Resources/CMake")
|
||||||
else()
|
else()
|
||||||
set(config_package_location ${CMAKE_INSTALL_LIBDIR}/cmake/SFML)
|
set(config_package_location ${CMAKE_INSTALL_LIBDIR}/cmake/SFML)
|
||||||
|
@ -12,7 +12,7 @@ find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
|
|||||||
|
|
||||||
find_library(OGG_LIBRARY NAMES ogg)
|
find_library(OGG_LIBRARY NAMES ogg)
|
||||||
find_library(VORBIS_LIBRARY NAMES vorbis)
|
find_library(VORBIS_LIBRARY NAMES vorbis)
|
||||||
if (NOT SFML_OS_IOS)
|
if(NOT SFML_OS_IOS)
|
||||||
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
|
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
|
||||||
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
|
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
|
||||||
set(VORBIS_LIBRARIES ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
|
set(VORBIS_LIBRARIES ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
# add_executable(myapp ...)
|
# add_executable(myapp ...)
|
||||||
# target_link_libraries(myapp PRIVATE 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")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -106,9 +106,9 @@ list(APPEND SFML_FIND_COMPONENTS ${FIND_SFML_ADDITIONAL_COMPONENTS})
|
|||||||
list(REMOVE_DUPLICATES SFML_FIND_COMPONENTS)
|
list(REMOVE_DUPLICATES SFML_FIND_COMPONENTS)
|
||||||
|
|
||||||
# Choose which target definitions must be imported
|
# Choose which target definitions must be imported
|
||||||
if (SFML_STATIC_LIBRARIES)
|
if(SFML_STATIC_LIBRARIES)
|
||||||
set(SFML_IS_FRAMEWORK_INSTALL "@SFML_BUILD_FRAMEWORKS@")
|
set(SFML_IS_FRAMEWORK_INSTALL "@SFML_BUILD_FRAMEWORKS@")
|
||||||
if (SFML_IS_FRAMEWORK_INSTALL)
|
if(SFML_IS_FRAMEWORK_INSTALL)
|
||||||
message(WARNING "Static frameworks are not supported by SFML. Clear SFML_DIR cache entry, \
|
message(WARNING "Static frameworks are not supported by SFML. Clear SFML_DIR cache entry, \
|
||||||
and either change SFML_STATIC_LIBRARIES or CMAKE_FIND_FRAMEWORK before calling find_package(SFML)")
|
and either change SFML_STATIC_LIBRARIES or CMAKE_FIND_FRAMEWORK before calling find_package(SFML)")
|
||||||
endif()
|
endif()
|
||||||
@ -119,19 +119,19 @@ endif()
|
|||||||
set(targets_config_file "${CMAKE_CURRENT_LIST_DIR}/SFML${config_name}Targets.cmake")
|
set(targets_config_file "${CMAKE_CURRENT_LIST_DIR}/SFML${config_name}Targets.cmake")
|
||||||
|
|
||||||
# Generate imported targets for SFML and its dependencies
|
# Generate imported targets for SFML and its dependencies
|
||||||
if (EXISTS "${targets_config_file}")
|
if(EXISTS "${targets_config_file}")
|
||||||
# Set SFML_FOUND to TRUE by default, may be overwritten by one of the includes below
|
# Set SFML_FOUND to TRUE by default, may be overwritten by one of the includes below
|
||||||
set(SFML_FOUND TRUE)
|
set(SFML_FOUND TRUE)
|
||||||
include("${targets_config_file}")
|
include("${targets_config_file}")
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/SFMLConfigDependencies.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/SFMLConfigDependencies.cmake")
|
||||||
|
|
||||||
if (SFML_FOUND)
|
if(SFML_FOUND)
|
||||||
set(SFML_VERSION_IS_RELEASE @VERSION_IS_RELEASE@)
|
set(SFML_VERSION_IS_RELEASE @VERSION_IS_RELEASE@)
|
||||||
|
|
||||||
foreach (component ${SFML_FIND_COMPONENTS})
|
foreach(component ${SFML_FIND_COMPONENTS})
|
||||||
string(TOUPPER "${component}" UPPER_COMPONENT)
|
string(TOUPPER "${component}" UPPER_COMPONENT)
|
||||||
set(SFML_${UPPER_COMPONENT}_FOUND FALSE)
|
set(SFML_${UPPER_COMPONENT}_FOUND FALSE)
|
||||||
if (TARGET SFML::${component})
|
if(TARGET SFML::${component})
|
||||||
set(SFML_${UPPER_COMPONENT}_FOUND TRUE)
|
set(SFML_${UPPER_COMPONENT}_FOUND TRUE)
|
||||||
elseif(SFML_FIND_REQUIRED_${component})
|
elseif(SFML_FIND_REQUIRED_${component})
|
||||||
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}.")
|
||||||
@ -144,7 +144,7 @@ else()
|
|||||||
set(SFML_FOUND FALSE)
|
set(SFML_FOUND FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT SFML_FOUND)
|
if(NOT SFML_FOUND)
|
||||||
if(SFML_FIND_REQUIRED)
|
if(SFML_FIND_REQUIRED)
|
||||||
# fatal error
|
# fatal error
|
||||||
message(FATAL_ERROR "${FIND_SFML_ERROR}")
|
message(FATAL_ERROR "${FIND_SFML_ERROR}")
|
||||||
@ -154,6 +154,6 @@ if (NOT SFML_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFML_FOUND AND NOT SFML_FIND_QUIETLY)
|
if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
|
||||||
message(STATUS "Found SFML @PROJECT_VERSION@ in ${CMAKE_CURRENT_LIST_DIR}")
|
message(STATUS "Found SFML @PROJECT_VERSION@ in ${CMAKE_CURRENT_LIST_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -8,7 +8,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
set(FIND_SFML_OS_FREEBSD 1)
|
set(FIND_SFML_OS_FREEBSD 1)
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
if (DEFINED IOS)
|
if(DEFINED IOS)
|
||||||
set(FIND_SFML_OS_IOS 1)
|
set(FIND_SFML_OS_IOS 1)
|
||||||
else()
|
else()
|
||||||
set(FIND_SFML_OS_MACOSX 1)
|
set(FIND_SFML_OS_MACOSX 1)
|
||||||
@ -21,7 +21,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
# macro that searches for a 3rd-party library
|
# macro that searches for a 3rd-party library
|
||||||
function(sfml_bind_dependency)
|
function(sfml_bind_dependency)
|
||||||
cmake_parse_arguments(THIS "" "TARGET;FRIENDLY_NAME" "SEARCH_NAMES" ${ARGN})
|
cmake_parse_arguments(THIS "" "TARGET;FRIENDLY_NAME" "SEARCH_NAMES" ${ARGN})
|
||||||
if (THIS_UNPARSED_ARGUMENTS)
|
if(THIS_UNPARSED_ARGUMENTS)
|
||||||
message(FATAL_ERROR "Unknown arguments when calling sfml_bind_dependency: ${THIS_UNPARSED_ARGUMENTS}")
|
message(FATAL_ERROR "Unknown arguments when calling sfml_bind_dependency: ${THIS_UNPARSED_ARGUMENTS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
sfml_bind_dependency(TARGET UDev FRIENDLY_NAME "UDev" SEARCH_NAMES "udev" "libudev")
|
sfml_bind_dependency(TARGET UDev FRIENDLY_NAME "UDev" SEARCH_NAMES "udev" "libudev")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (FIND_SFML_OS_WINDOWS)
|
if(FIND_SFML_OS_WINDOWS)
|
||||||
set_property(TARGET OpenGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "OpenGL32")
|
set_property(TARGET OpenGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "OpenGL32")
|
||||||
elseif(NOT FIND_SFML_OS_IOS)
|
elseif(NOT FIND_SFML_OS_IOS)
|
||||||
sfml_bind_dependency(TARGET OpenGL FRIENDLY_NAME "OpenGL" SEARCH_NAMES "OpenGL" "GL")
|
sfml_bind_dependency(TARGET OpenGL FRIENDLY_NAME "OpenGL" SEARCH_NAMES "OpenGL" "GL")
|
||||||
@ -66,7 +66,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
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)
|
||||||
sfml_bind_dependency(TARGET VORBIS FRIENDLY_NAME "VorbisFile" SEARCH_NAMES "vorbisfile")
|
sfml_bind_dependency(TARGET VORBIS FRIENDLY_NAME "VorbisFile" SEARCH_NAMES "vorbisfile")
|
||||||
sfml_bind_dependency(TARGET VORBIS FRIENDLY_NAME "VorbisEnc" SEARCH_NAMES "vorbisenc")
|
sfml_bind_dependency(TARGET VORBIS FRIENDLY_NAME "VorbisEnc" SEARCH_NAMES "vorbisenc")
|
||||||
endif()
|
endif()
|
||||||
@ -75,7 +75,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
sfml_bind_dependency(TARGET FLAC FRIENDLY_NAME "FLAC" SEARCH_NAMES "FLAC")
|
sfml_bind_dependency(TARGET FLAC FRIENDLY_NAME "FLAC" SEARCH_NAMES "FLAC")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (FIND_SFML_DEPENDENCIES_NOTFOUND)
|
if(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||||
set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
|
set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
|
||||||
set(SFML_FOUND FALSE)
|
set(SFML_FOUND FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -33,156 +33,156 @@
|
|||||||
|
|
||||||
# Macros:
|
# Macros:
|
||||||
#
|
#
|
||||||
# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE)
|
# set_xcode_property(TARGET XCODE_PROPERTY XCODE_VALUE)
|
||||||
# A convenience macro for setting xcode specific properties on targets
|
# A convenience macro for setting xcode specific properties on targets
|
||||||
# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1")
|
# example: set_xcode_property(myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1")
|
||||||
#
|
#
|
||||||
# find_host_package (PROGRAM ARGS)
|
# find_host_package(PROGRAM ARGS)
|
||||||
# A macro used to find executable programs on the host system, not within the iOS environment.
|
# A macro used to find executable programs on the host system, not within the iOS environment.
|
||||||
# Thanks to the android-cmake project for providing the command
|
# Thanks to the android-cmake project for providing the command
|
||||||
|
|
||||||
# Standard settings
|
# Standard settings
|
||||||
set (CMAKE_SYSTEM_NAME Darwin)
|
set(CMAKE_SYSTEM_NAME Darwin)
|
||||||
set (CMAKE_SYSTEM_VERSION 1)
|
set(CMAKE_SYSTEM_VERSION 1)
|
||||||
set (UNIX True)
|
set(UNIX True)
|
||||||
set (APPLE True)
|
set(APPLE True)
|
||||||
set (IOS True)
|
set(IOS True)
|
||||||
|
|
||||||
# Required as of cmake 2.8.10
|
# Required as of cmake 2.8.10
|
||||||
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
|
||||||
|
|
||||||
# Determine the cmake host system version so we know where to find the iOS SDKs
|
# Determine the cmake host system version so we know where to find the iOS SDKs
|
||||||
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
|
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
|
||||||
if (CMAKE_UNAME)
|
if(CMAKE_UNAME)
|
||||||
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
|
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
|
||||||
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
|
||||||
endif (CMAKE_UNAME)
|
endif()
|
||||||
|
|
||||||
set(CMAKE_C_COMPILER /usr/bin/clang CACHE FILEPATH "" FORCE)
|
set(CMAKE_C_COMPILER /usr/bin/clang CACHE FILEPATH "" FORCE)
|
||||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++ CACHE FILEPATH "" FORCE)
|
set(CMAKE_CXX_COMPILER /usr/bin/clang++ CACHE FILEPATH "" FORCE)
|
||||||
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
||||||
|
|
||||||
# Skip the platform compiler checks for cross compiling
|
# Skip the platform compiler checks for cross compiling
|
||||||
set (CMAKE_CXX_COMPILER_WORKS TRUE)
|
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||||
set (CMAKE_C_COMPILER_WORKS TRUE)
|
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||||
|
|
||||||
# All iOS/Darwin specific settings - some may be redundant
|
# All iOS/Darwin specific settings - some may be redundant
|
||||||
set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
|
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
|
||||||
set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
|
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
|
||||||
set (CMAKE_SHARED_MODULE_PREFIX "lib")
|
set(CMAKE_SHARED_MODULE_PREFIX "lib")
|
||||||
set (CMAKE_SHARED_MODULE_SUFFIX ".so")
|
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
|
||||||
set (CMAKE_MODULE_EXISTS 1)
|
set(CMAKE_MODULE_EXISTS 1)
|
||||||
set (CMAKE_DL_LIBS "")
|
set(CMAKE_DL_LIBS "")
|
||||||
|
|
||||||
set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
|
set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
|
||||||
set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
|
set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
|
||||||
set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
|
set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
|
||||||
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
|
set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
|
||||||
|
|
||||||
# Hidden visibilty is required for cxx on iOS
|
# Hidden visibilty is required for cxx on iOS
|
||||||
set (CMAKE_C_FLAGS_INIT "")
|
set(CMAKE_C_FLAGS_INIT "")
|
||||||
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden")
|
set(CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden")
|
||||||
|
|
||||||
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
|
set(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
|
||||||
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
|
set(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
|
||||||
|
|
||||||
set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
|
set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
|
||||||
set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
|
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
|
||||||
set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
|
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
|
||||||
set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
|
set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
|
||||||
set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
|
set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
|
||||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
|
||||||
|
|
||||||
# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
|
# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
|
||||||
# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
|
# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
|
||||||
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
|
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
|
||||||
# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex
|
# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex
|
||||||
if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||||
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
|
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
|
||||||
endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
endif()
|
||||||
|
|
||||||
# Setup iOS platform unless specified manually with IOS_PLATFORM
|
# Setup iOS platform unless specified manually with IOS_PLATFORM
|
||||||
if (NOT DEFINED IOS_PLATFORM)
|
if(NOT DEFINED IOS_PLATFORM)
|
||||||
set (IOS_PLATFORM "OS")
|
set(IOS_PLATFORM "OS")
|
||||||
endif (NOT DEFINED IOS_PLATFORM)
|
endif()
|
||||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform: OS or SIMULATOR")
|
set(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform: OS or SIMULATOR")
|
||||||
|
|
||||||
# Check the platform selection and setup for developer root
|
# Check the platform selection and setup for developer root
|
||||||
if (IOS_PLATFORM STREQUAL OS)
|
if(IOS_PLATFORM STREQUAL OS)
|
||||||
set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
set(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||||
|
|
||||||
# This causes the installers to properly locate the output libraries
|
# This causes the installers to properly locate the output libraries
|
||||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||||
elseif (IOS_PLATFORM STREQUAL SIMULATOR)
|
elseif(IOS_PLATFORM STREQUAL SIMULATOR)
|
||||||
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
set(IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||||
|
|
||||||
# This causes the installers to properly locate the output libraries
|
# This causes the installers to properly locate the output libraries
|
||||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||||
else ()
|
else()
|
||||||
message (FATAL_ERROR "Unsupported IOS_PLATFORM value '${IOS_PLATFORM}' selected. Please choose OS or SIMULATOR")
|
message(FATAL_ERROR "Unsupported IOS_PLATFORM value '${IOS_PLATFORM}' selected. Please choose OS or SIMULATOR")
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
# Setup iOS developer location unless specified manually with IOS_DEVELOPER_ROOT
|
# Setup iOS developer location unless specified manually with IOS_DEVELOPER_ROOT
|
||||||
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE XCODE_DEVELOPER_DIR)
|
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE XCODE_DEVELOPER_DIR)
|
||||||
set (IOS_DEVELOPER_ROOT "${XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer" CACHE PATH "Location of iOS Platform")
|
set(IOS_DEVELOPER_ROOT "${XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer" CACHE PATH "Location of iOS Platform")
|
||||||
|
|
||||||
# Find and use the most recent iOS sdk unless specified manually with IOS_SDK_ROOT
|
# Find and use the most recent iOS sdk unless specified manually with IOS_SDK_ROOT
|
||||||
if (NOT DEFINED IOS_SDK_ROOT)
|
if(NOT DEFINED IOS_SDK_ROOT)
|
||||||
file (GLOB _IOS_SDKS "${IOS_DEVELOPER_ROOT}/SDKs/*")
|
file(GLOB _IOS_SDKS "${IOS_DEVELOPER_ROOT}/SDKs/*")
|
||||||
if (_IOS_SDKS)
|
if(_IOS_SDKS)
|
||||||
list (SORT _IOS_SDKS)
|
list(SORT _IOS_SDKS)
|
||||||
list (REVERSE _IOS_SDKS)
|
list(REVERSE _IOS_SDKS)
|
||||||
list (GET _IOS_SDKS 0 IOS_SDK_ROOT)
|
list(GET _IOS_SDKS 0 IOS_SDK_ROOT)
|
||||||
else (_IOS_SDKS)
|
else()
|
||||||
message (FATAL_ERROR "No iOS SDK's found in default search path ${IOS_DEVELOPER_ROOT}. Manually set IOS_SDK_ROOT or install the iOS SDK.")
|
message(FATAL_ERROR "No iOS SDK's found in default search path ${IOS_DEVELOPER_ROOT}. Manually set IOS_SDK_ROOT or install the iOS SDK.")
|
||||||
endif (_IOS_SDKS)
|
endif()
|
||||||
message (STATUS "Toolchain using default iOS SDK: ${IOS_SDK_ROOT}")
|
message(STATUS "Toolchain using default iOS SDK: ${IOS_SDK_ROOT}")
|
||||||
endif (NOT DEFINED IOS_SDK_ROOT)
|
endif()
|
||||||
set (IOS_SDK_ROOT ${IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
set(IOS_SDK_ROOT ${IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
||||||
|
|
||||||
# Set the sysroot default to the most recent SDK
|
# Set the sysroot default to the most recent SDK
|
||||||
set (CMAKE_OSX_SYSROOT ${IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
set(CMAKE_OSX_SYSROOT ${IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
||||||
|
|
||||||
# set the architecture for iOS
|
# set the architecture for iOS
|
||||||
if (${IOS_PLATFORM} STREQUAL OS)
|
if(${IOS_PLATFORM} STREQUAL OS)
|
||||||
set (OSX_UNIVERSAL true)
|
set(OSX_UNIVERSAL true)
|
||||||
set (IOS_ARCH arm64)
|
set(IOS_ARCH arm64)
|
||||||
elseif (${IOS_PLATFORM} STREQUAL SIMULATOR)
|
elseif(${IOS_PLATFORM} STREQUAL SIMULATOR)
|
||||||
set (IOS_ARCH x86_64)
|
set(IOS_ARCH x86_64)
|
||||||
endif (${IOS_PLATFORM} STREQUAL OS)
|
endif()
|
||||||
|
|
||||||
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS" FORCE)
|
set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS" FORCE)
|
||||||
|
|
||||||
# Set the find root to the iOS developer roots and to user defined paths
|
# Set the find root to the iOS developer roots and to user defined paths
|
||||||
set (CMAKE_FIND_ROOT_PATH ${IOS_DEVELOPER_ROOT} ${IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root")
|
set(CMAKE_FIND_ROOT_PATH ${IOS_DEVELOPER_ROOT} ${IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root")
|
||||||
|
|
||||||
# default to searching for frameworks first
|
# default to searching for frameworks first
|
||||||
set (CMAKE_FIND_FRAMEWORK FIRST)
|
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||||
|
|
||||||
# set up the default search directories for frameworks
|
# set up the default search directories for frameworks
|
||||||
set (CMAKE_SYSTEM_FRAMEWORK_PATH
|
set(CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||||
${IOS_SDK_ROOT}/System/Library/Frameworks
|
${IOS_SDK_ROOT}/System/Library/Frameworks
|
||||||
${IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
${IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
||||||
${IOS_SDK_ROOT}/Developer/Library/Frameworks
|
${IOS_SDK_ROOT}/Developer/Library/Frameworks
|
||||||
)
|
)
|
||||||
|
|
||||||
# only search the iOS sdks, not the remainder of the host filesystem
|
# only search the iOS sdks, not the remainder of the host filesystem
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
|
||||||
|
|
||||||
# This macro lets you find executable programs on the host system
|
# This macro lets you find executable programs on the host system
|
||||||
macro (find_host_package)
|
macro(find_host_package)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
|
||||||
set (IOS FALSE)
|
set(IOS FALSE)
|
||||||
|
|
||||||
find_package(${ARGN})
|
find_package(${ARGN})
|
||||||
|
|
||||||
set (IOS TRUE)
|
set(IOS TRUE)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
endmacro (find_host_package)
|
endmacro(find_host_package)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# CLI based examples
|
# CLI based examples
|
||||||
if (NOT SFML_OS_IOS)
|
if(NOT SFML_OS_IOS)
|
||||||
if(SFML_BUILD_NETWORK)
|
if(SFML_BUILD_NETWORK)
|
||||||
add_subdirectory(ftp)
|
add_subdirectory(ftp)
|
||||||
add_subdirectory(sockets)
|
add_subdirectory(sockets)
|
||||||
@ -21,7 +21,7 @@ endif()
|
|||||||
if(SFML_BUILD_GRAPHICS)
|
if(SFML_BUILD_GRAPHICS)
|
||||||
add_subdirectory(opengl)
|
add_subdirectory(opengl)
|
||||||
|
|
||||||
if (NOT SFML_OS_IOS)
|
if(NOT SFML_OS_IOS)
|
||||||
add_subdirectory(joystick)
|
add_subdirectory(joystick)
|
||||||
add_subdirectory(shader)
|
add_subdirectory(shader)
|
||||||
add_subdirectory(island)
|
add_subdirectory(island)
|
||||||
|
@ -3,15 +3,15 @@ enable_language(OBJC OBJCXX)
|
|||||||
# Usage: compile_xib(INPUT path/to/file.xib OUTPUT path/to/file.nib)
|
# Usage: compile_xib(INPUT path/to/file.xib OUTPUT path/to/file.nib)
|
||||||
function(compile_xib)
|
function(compile_xib)
|
||||||
cmake_parse_arguments(THIS "" "INPUT;OUTPUT" "" ${ARGN})
|
cmake_parse_arguments(THIS "" "INPUT;OUTPUT" "" ${ARGN})
|
||||||
if (NOT THIS_INPUT)
|
if(NOT THIS_INPUT)
|
||||||
message(FATAL_ERROR "Missing required argument INPUT in call to compile_xib()")
|
message(FATAL_ERROR "Missing required argument INPUT in call to compile_xib()")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT THIS_OUTPUT)
|
if(NOT THIS_OUTPUT)
|
||||||
message(FATAL_ERROR "Missing required argument OUTPUT in call to compile_xib()")
|
message(FATAL_ERROR "Missing required argument OUTPUT in call to compile_xib()")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT DEFINED IBTOOL)
|
if(NOT DEFINED IBTOOL)
|
||||||
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
|
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
|
||||||
endif()
|
endif()
|
||||||
if(NOT IBTOOL)
|
if(NOT IBTOOL)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# all source files
|
# all source files
|
||||||
set(SRC OpenGL.cpp)
|
set(SRC OpenGL.cpp)
|
||||||
|
|
||||||
if (SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
resources/background.jpg
|
resources/background.jpg
|
||||||
resources/tuffy.ttf)
|
resources/tuffy.ttf)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# all source files
|
# all source files
|
||||||
set(SRC Tennis.cpp)
|
set(SRC Tennis.cpp)
|
||||||
if (SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
resources/ball.wav
|
resources/ball.wav
|
||||||
resources/tuffy.ttf)
|
resources/tuffy.ttf)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
|
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
|
||||||
|
|
||||||
# let CMake know about our additional libraries paths
|
# let CMake know about our additional libraries paths
|
||||||
if (SFML_OS_WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
list(APPEND CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
list(APPEND CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
||||||
if(SFML_COMPILER_GCC OR (SFML_COMPILER_CLANG AND MINGW))
|
if(SFML_COMPILER_GCC OR (SFML_COMPILER_CLANG AND MINGW))
|
||||||
if(ARCH_32BITS)
|
if(ARCH_32BITS)
|
||||||
|
@ -280,7 +280,7 @@ target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/ext
|
|||||||
# CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL for backward compability
|
# CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL for backward compability
|
||||||
# (unless the OpenGL_GL_PREFERENCE was explicitly set)
|
# (unless the OpenGL_GL_PREFERENCE was explicitly set)
|
||||||
# See CMP0072 for more details (cmake --help-policy CMP0072)
|
# See CMP0072 for more details (cmake --help-policy CMP0072)
|
||||||
if (NOT OpenGL_GL_PREFERENCE)
|
if(NOT OpenGL_GL_PREFERENCE)
|
||||||
set(OpenGL_GL_PREFERENCE "LEGACY")
|
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user