2015-07-19 09:20:11 -07:00
|
|
|
# Macro to build the examples
|
|
|
|
# Usage: tgui_add_example(example-folder-name SUOURCES source.cpp)
|
|
|
|
macro(tgui_add_example target)
|
|
|
|
|
|
|
|
# parse the arguments
|
|
|
|
cmake_parse_arguments(THIS "" "" "SOURCES" ${ARGN})
|
|
|
|
|
2018-04-01 06:38:13 -07:00
|
|
|
if(TGUI_OS_WINDOWS)
|
2018-04-08 11:00:13 -07:00
|
|
|
set(GUI_APP WIN32)
|
|
|
|
elseif(TGUI_OS_IOS)
|
|
|
|
set(GUI_APP MACOSX_BUNDLE)
|
|
|
|
else()
|
|
|
|
set(GUI_APP "")
|
2015-07-19 09:20:11 -07:00
|
|
|
endif()
|
|
|
|
|
2018-04-08 11:00:13 -07:00
|
|
|
add_executable(${target} ${GUI_APP} ${THIS_SOURCES})
|
2018-05-10 05:07:09 -07:00
|
|
|
target_link_libraries(${target} PRIVATE tgui)
|
2015-07-19 09:20:11 -07:00
|
|
|
|
2018-04-01 08:50:16 -07:00
|
|
|
# Link to sfml-main (only when SFMLConfig.cmake is used, this is done through the tgui target if FindSFML.cmake is used)
|
2018-04-12 13:32:52 -07:00
|
|
|
if((TGUI_OS_WINDOWS OR TGUI_OS_IOS) AND NOT DEFINED SFML_LIBRARIES)
|
2018-04-01 07:40:07 -07:00
|
|
|
target_link_libraries(${target} PRIVATE sfml-main)
|
|
|
|
endif()
|
|
|
|
|
2018-05-10 05:07:09 -07:00
|
|
|
tgui_set_global_compile_flags(${target})
|
|
|
|
tgui_set_stdlib(${target})
|
|
|
|
|
2015-07-19 09:20:11 -07:00
|
|
|
# Add the install rule for the executable
|
|
|
|
install(TARGETS ${target}
|
2018-04-01 06:38:13 -07:00
|
|
|
RUNTIME DESTINATION ${TGUI_MISC_INSTALL_PREFIX}/examples/${target} COMPONENT examples
|
|
|
|
BUNDLE DESTINATION ${TGUI_MISC_INSTALL_PREFIX}/examples/${target} COMPONENT examples)
|
2015-07-19 09:20:11 -07:00
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# Build the examples
|
2018-04-08 11:00:13 -07:00
|
|
|
if(TGUI_OS_IOS)
|
|
|
|
add_subdirectory(iOS)
|
|
|
|
else()
|
|
|
|
add_subdirectory(many_different_widgets)
|
|
|
|
add_subdirectory(scalable_login_screen)
|
|
|
|
endif()
|
2015-07-19 09:20:11 -07:00
|
|
|
|
|
|
|
# install the examples
|
|
|
|
install(DIRECTORY "${CMAKE_SOURCE_DIR}/examples/"
|
2018-04-01 06:38:13 -07:00
|
|
|
DESTINATION "${TGUI_MISC_INSTALL_PREFIX}/examples/"
|
2015-07-19 09:20:11 -07:00
|
|
|
COMPONENT examples)
|