mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Hide examples, tests, and documentation from projects consuming SFML via add_subdirectory
This commit is contained in:
parent
8b7429b9c0
commit
0e8072e6cd
@ -53,22 +53,12 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# add an option for building the examples
|
|
||||||
if(NOT SFML_OS_ANDROID)
|
|
||||||
sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, FALSE to ignore them")
|
|
||||||
else()
|
|
||||||
set(SFML_BUILD_EXAMPLES FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# add options to select which modules to build
|
# add options to select which modules to build
|
||||||
sfml_set_option(SFML_BUILD_WINDOW TRUE BOOL "TRUE to build SFML's Window module. This setting is ignored, if the graphics module is built.")
|
sfml_set_option(SFML_BUILD_WINDOW TRUE BOOL "TRUE to build SFML's Window module. This setting is ignored, if the graphics module is built.")
|
||||||
sfml_set_option(SFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build SFML's Graphics module.")
|
sfml_set_option(SFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build SFML's Graphics module.")
|
||||||
sfml_set_option(SFML_BUILD_AUDIO TRUE BOOL "TRUE to build SFML's Audio module.")
|
sfml_set_option(SFML_BUILD_AUDIO TRUE BOOL "TRUE to build SFML's Audio module.")
|
||||||
sfml_set_option(SFML_BUILD_NETWORK TRUE BOOL "TRUE to build SFML's Network module.")
|
sfml_set_option(SFML_BUILD_NETWORK TRUE BOOL "TRUE to build SFML's Network module.")
|
||||||
|
|
||||||
# add an option for building the API documentation
|
|
||||||
sfml_set_option(SFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
|
||||||
|
|
||||||
if(SFML_BUILD_WINDOW)
|
if(SFML_BUILD_WINDOW)
|
||||||
# add an option for choosing the OpenGL implementation
|
# add an option for choosing the OpenGL implementation
|
||||||
sfml_set_option(SFML_OPENGL_ES ${OPENGL_ES} BOOL "TRUE to use an OpenGL ES implementation, FALSE to use a desktop OpenGL implementation")
|
sfml_set_option(SFML_OPENGL_ES ${OPENGL_ES} BOOL "TRUE to use an OpenGL ES implementation, FALSE to use a desktop OpenGL implementation")
|
||||||
@ -79,12 +69,6 @@ if(SFML_BUILD_WINDOW)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# add an option for building the test suite
|
|
||||||
sfml_set_option(SFML_BUILD_TEST_SUITE FALSE BOOL "TRUE to build the SFML test suite, FALSE to ignore it")
|
|
||||||
|
|
||||||
# add an option for enabling coverage reporting
|
|
||||||
sfml_set_option(SFML_ENABLE_COVERAGE FALSE BOOL "TRUE to enable coverage reporting, FALSE to ignore it")
|
|
||||||
|
|
||||||
# macOS specific options
|
# macOS specific options
|
||||||
if(SFML_OS_MACOSX)
|
if(SFML_OS_MACOSX)
|
||||||
# add an option to build frameworks instead of dylibs (release only)
|
# add an option to build frameworks instead of dylibs (release only)
|
||||||
@ -247,22 +231,6 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
|
|||||||
|
|
||||||
# add the subdirectories
|
# add the subdirectories
|
||||||
add_subdirectory(src/SFML)
|
add_subdirectory(src/SFML)
|
||||||
if(SFML_BUILD_EXAMPLES)
|
|
||||||
add_subdirectory(examples)
|
|
||||||
endif()
|
|
||||||
if(SFML_BUILD_DOC)
|
|
||||||
add_subdirectory(doc)
|
|
||||||
endif()
|
|
||||||
if(SFML_BUILD_TEST_SUITE)
|
|
||||||
if(SFML_OS_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)
|
|
||||||
enable_testing()
|
|
||||||
add_subdirectory(test)
|
|
||||||
else()
|
|
||||||
message(WARNING "Cannot build unit testing unless all modules are enabled")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# on Linux and BSD-like OS, install pkg-config files by default
|
# on Linux and BSD-like OS, install pkg-config files by default
|
||||||
set(SFML_INSTALL_PKGCONFIG_DEFAULT FALSE)
|
set(SFML_INSTALL_PKGCONFIG_DEFAULT FALSE)
|
||||||
@ -533,10 +501,47 @@ set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "!define MUI_WELCOMEFINISHPAGE_BITMAP \\\
|
|||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
# configure extras by default when building SFML directly, otherwise hide them
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||||
|
set(SFML_CONFIGURE_EXTRAS_DEFAULT TRUE)
|
||||||
|
else()
|
||||||
|
set(SFML_CONFIGURE_EXTRAS_DEFAULT FALSE)
|
||||||
|
endif()
|
||||||
|
sfml_set_option(SFML_CONFIGURE_EXTRAS ${SFML_CONFIGURE_EXTRAS_DEFAULT} BOOL "TRUE to configure extras, FALSE to ignore them")
|
||||||
|
|
||||||
|
if(NOT SFML_CONFIGURE_EXTRAS)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# add an option for building the API documentation
|
||||||
|
sfml_set_option(SFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||||
|
if(SFML_BUILD_DOC)
|
||||||
|
add_subdirectory(doc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# add an option for building the examples
|
||||||
|
sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, FALSE to ignore them")
|
||||||
|
if(SFML_BUILD_EXAMPLES AND NOT SFML_OS_ANDROID)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# add an option for building the test suite
|
||||||
|
sfml_set_option(SFML_BUILD_TEST_SUITE FALSE BOOL "TRUE to build the SFML test suite, FALSE to ignore it")
|
||||||
|
|
||||||
|
# add an option for enabling coverage reporting
|
||||||
|
sfml_set_option(SFML_ENABLE_COVERAGE FALSE BOOL "TRUE to enable coverage reporting, FALSE to ignore it")
|
||||||
|
|
||||||
|
if(SFML_BUILD_TEST_SUITE)
|
||||||
|
if(SFML_OS_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)
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(test)
|
||||||
|
else()
|
||||||
|
message(WARNING "Cannot build unit testing unless all modules are enabled")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 12, 13, or 14")
|
sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 12, 13, or 14")
|
||||||
add_custom_target(format
|
add_custom_target(format
|
||||||
COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake
|
COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake
|
||||||
|
Loading…
Reference in New Issue
Block a user