mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Simplify how examples are built
CMake doesn't require absolute paths so we can safely remove SRCROOT and let implicit relative pathing achieve the same result with less work on our part.
This commit is contained in:
parent
539483d329
commit
65fef85b30
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/X11)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/X11.cpp)
|
||||
set(SRC X11.cpp)
|
||||
|
||||
# define the X11 target
|
||||
sfml_add_example(X11Example GUI_APP
|
||||
|
@ -1,6 +1,3 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/cocoa)
|
||||
|
||||
# Usage: compile_xib(INPUT path/to/file.xib OUTPUT path/to/file.nib)
|
||||
function(compile_xib)
|
||||
cmake_parse_arguments(THIS "" "INPUT;OUTPUT" "" ${ARGN})
|
||||
@ -30,22 +27,22 @@ function(compile_xib)
|
||||
endfunction()
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/CocoaAppDelegate.h
|
||||
${SRCROOT}/CocoaAppDelegate.mm
|
||||
${SRCROOT}/NSString+stdstring.h
|
||||
${SRCROOT}/NSString+stdstring.mm
|
||||
${SRCROOT}/main.m)
|
||||
set(SRC CocoaAppDelegate.h
|
||||
CocoaAppDelegate.mm
|
||||
NSString+stdstring.h
|
||||
NSString+stdstring.mm
|
||||
main.m)
|
||||
|
||||
compile_xib(INPUT "${SRCROOT}/MainMenu.xib" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MainMenu.nib")
|
||||
compile_xib(INPUT "MainMenu.xib" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MainMenu.nib")
|
||||
|
||||
# all resource files
|
||||
set(RESOURCES ${SRCROOT}/resources/icon.icns
|
||||
${SRCROOT}/resources/tuffy.ttf
|
||||
${SRCROOT}/resources/logo.png
|
||||
${SRCROOT}/resources/blue.png
|
||||
${SRCROOT}/resources/green.png
|
||||
${SRCROOT}/resources/red.png
|
||||
${SRCROOT}/resources/Credits.rtf
|
||||
set(RESOURCES resources/icon.icns
|
||||
resources/tuffy.ttf
|
||||
resources/logo.png
|
||||
resources/blue.png
|
||||
resources/green.png
|
||||
resources/red.png
|
||||
resources/Credits.rtf
|
||||
${CMAKE_CURRENT_BINARY_DIR}/MainMenu.nib)
|
||||
set_source_files_properties(${RESOURCES} PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources)
|
||||
@ -57,5 +54,5 @@ sfml_add_example(cocoa
|
||||
DEPENDS SFML::System SFML::Window SFML::Graphics)
|
||||
set_target_properties(cocoa PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST ${SRCROOT}/resources/Cocoa-Info.plist)
|
||||
MACOSX_BUNDLE_INFO_PLIST resources/Cocoa-Info.plist)
|
||||
target_link_libraries(cocoa PRIVATE "-framework Cocoa" "-framework Foundation" SFML::Graphics)
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/ftp)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Ftp.cpp)
|
||||
set(SRC Ftp.cpp)
|
||||
|
||||
# define the ftp target
|
||||
sfml_add_example(ftp
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/island)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Island.cpp)
|
||||
set(SRC Island.cpp)
|
||||
|
||||
# define the island target
|
||||
sfml_add_example(island GUI_APP
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/joystick)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Joystick.cpp)
|
||||
set(SRC Joystick.cpp)
|
||||
|
||||
# define the joystick target
|
||||
sfml_add_example(joystick GUI_APP
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/opengl)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/OpenGL.cpp)
|
||||
set(SRC OpenGL.cpp)
|
||||
|
||||
if (SFML_OS_IOS)
|
||||
set(RESOURCES
|
||||
|
@ -1,10 +1,6 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/shader)
|
||||
|
||||
# all source files
|
||||
set(SRC
|
||||
${SRCROOT}/Effect.hpp
|
||||
${SRCROOT}/Shader.cpp)
|
||||
set(SRC Effect.hpp
|
||||
Shader.cpp)
|
||||
|
||||
# define the shader target
|
||||
sfml_add_example(shader GUI_APP
|
||||
|
@ -1,10 +1,7 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/sockets)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Sockets.cpp
|
||||
${SRCROOT}/TCP.cpp
|
||||
${SRCROOT}/UDP.cpp)
|
||||
set(SRC Sockets.cpp
|
||||
TCP.cpp
|
||||
UDP.cpp)
|
||||
|
||||
# define the sockets target
|
||||
sfml_add_example(sockets
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/sound)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Sound.cpp)
|
||||
set(SRC Sound.cpp)
|
||||
|
||||
# define the sound target
|
||||
sfml_add_example(sound
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/sound_capture)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/SoundCapture.cpp)
|
||||
set(SRC SoundCapture.cpp)
|
||||
|
||||
# define the sound-capture target
|
||||
sfml_add_example(sound-capture
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/tennis)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Tennis.cpp)
|
||||
set(SRC Tennis.cpp)
|
||||
if (SFML_OS_IOS)
|
||||
set(RESOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources/ball.wav
|
||||
|
@ -1,10 +1,7 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/voip)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/VoIP.cpp
|
||||
${SRCROOT}/Client.cpp
|
||||
${SRCROOT}/Server.cpp)
|
||||
set(SRC VoIP.cpp
|
||||
Client.cpp
|
||||
Server.cpp)
|
||||
|
||||
# define the voip target
|
||||
sfml_add_example(voip
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/vulkan)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Vulkan.cpp)
|
||||
set(SRC Vulkan.cpp)
|
||||
|
||||
# define the window target
|
||||
sfml_add_example(vulkan GUI_APP
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/win32)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Win32.cpp)
|
||||
set(SRC Win32.cpp)
|
||||
|
||||
# define the win32 target
|
||||
sfml_add_example(win32 GUI_APP
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/window)
|
||||
|
||||
# all source files
|
||||
set(SRC ${SRCROOT}/Window.cpp)
|
||||
set(SRC Window.cpp)
|
||||
|
||||
# define the window target
|
||||
sfml_add_example(window GUI_APP
|
||||
|
Loading…
Reference in New Issue
Block a user