Compare commits

...

1 commit

Author SHA1 Message Date
Lukas Dürrenberger a328e24536 Add CMake options to install examples and documentation separately. 2015-03-28 23:36:23 +01:00
4 changed files with 47 additions and 29 deletions

View file

@ -63,9 +63,21 @@ else()
set(SFML_BUILD_EXAMPLES FALSE) set(SFML_BUILD_EXAMPLES FALSE)
endif() endif()
# add options for installing the examples
if(SFML_BUILD_EXAMPLES)
sfml_set_option(SFML_INSTALL_EXAMPLES FALSE BOOL "TRUE to install the SFML examples, FALSE to leave them in the build directory")
sfml_set_option(SFML_INSTALL_EXAMPLES_PREFIX ${INSTALL_MISC_DIR} PATH "Install path prefix, prepended onto example install directory")
endif()
# add an option for building the API documentation # 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") sfml_set_option(SFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
# add option for installing the API documentation
if(SFML_BUILD_DOC)
sfml_set_option(SFML_INSTALL_DOC FALSE BOOL "TRUE to install the SFML API documentation, FALSE to leave them in the build directory")
sfml_set_option(SFML_INSTALL_DOC_PREFIX ${INSTALL_MISC_DIR} PATH "Install path prefix, prepended onto the documentation install directory")
endif()
# 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")
@ -275,8 +287,8 @@ else()
COMPONENT devel) COMPONENT devel)
endif() endif()
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR}) install(FILES license.txt DESTINATION ./)
install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR}) install(FILES readme.txt DESTINATION ./)
if(NOT SFML_OS_ANDROID) if(NOT SFML_OS_ANDROID)
install(FILES cmake/Modules/FindSFML.cmake DESTINATION ${INSTALL_MISC_DIR}/cmake/Modules) install(FILES cmake/Modules/FindSFML.cmake DESTINATION ${INSTALL_MISC_DIR}/cmake/Modules)
endif() endif()

View file

@ -156,23 +156,25 @@ macro(sfml_add_example target)
if(THIS_DEPENDS) if(THIS_DEPENDS)
target_link_libraries(${target} ${THIS_DEPENDS}) target_link_libraries(${target} ${THIS_DEPENDS})
endif() endif()
if(SFML_INSTALL_EXAMPLES)
# add the install rule
install(TARGETS ${target}
RUNTIME DESTINATION ${SFML_INSTALL_EXAMPLES_PREFIX}/examples/${target} COMPONENT examples
BUNDLE DESTINATION ${SFML_INSTALL_EXAMPLES_PREFIX}/examples/${target} COMPONENT examples)
# add the install rule # install the example's source code
install(TARGETS ${target} install(FILES ${THIS_SOURCES}
RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples DESTINATION ${SFML_INSTALL_EXAMPLES_PREFIX}/examples/${target}
BUNDLE DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples)
# install the example's source code
install(FILES ${THIS_SOURCES}
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
COMPONENT examples)
# install the example's resources as well
set(EXAMPLE_RESOURCES "${CMAKE_SOURCE_DIR}/examples/${target}/resources")
if(EXISTS ${EXAMPLE_RESOURCES})
install(DIRECTORY ${EXAMPLE_RESOURCES}
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
COMPONENT examples) COMPONENT examples)
# install the example's resources as well
set(EXAMPLE_RESOURCES "${CMAKE_SOURCE_DIR}/examples/${target}/resources")
if(EXISTS ${EXAMPLE_RESOURCES})
install(DIRECTORY ${EXAMPLE_RESOURCES}
DESTINATION ${SFML_INSTALL_EXAMPLES_PREFIX}/examples/${target}
COMPONENT examples)
endif()
endif() endif()
endmacro() endmacro()

View file

@ -51,12 +51,14 @@ add_custom_target(doc ALL
COMMAND ${CMAKE_COMMAND} -E echo "Done." COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${DOXYGEN_INPUT_DIR}) WORKING_DIRECTORY ${DOXYGEN_INPUT_DIR})
# setup install rules if(SFML_INSTALL_DOC)
install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html # setup install rules
DESTINATION ${INSTALL_MISC_DIR}/doc install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html
COMPONENT doc) DESTINATION ${SFML_INSTALL_DOC_PREFIX}/doc
if(DOXYGEN_HHC_PROGRAM)
install(FILES ${DOXYGEN_OUTPUT_DIR}/sfml.chm
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc) COMPONENT doc)
endif() if(DOXYGEN_HHC_PROGRAM)
install(FILES ${DOXYGEN_OUTPUT_DIR}/sfml.chm
DESTINATION ${SFML_INSTALL_DOC_PREFIX}/doc
COMPONENT doc)
endif()
endif()

View file

@ -51,10 +51,12 @@ foreach(XIB ${XIBS})
# deactivated options: --warnings --notices # deactivated options: --warnings --notices
endforeach() endforeach()
# add install rule if(SFML_INSTALL_EXAMPLES)
install(TARGETS cocoa # add install rule
BUNDLE DESTINATION ${INSTALL_MISC_DIR}/examples/cocoa install(TARGETS cocoa
COMPONENT examples) BUNDLE DESTINATION ${SFML_INSTALL_EXAMPLES_PREFIX}/examples/cocoa
COMPONENT examples)
endif()
# #
# define the cocoa target # define the cocoa target