Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
prism/platforms/sdl/CMakeLists.txt
Joshua Goins e1c688bea7 Completely overhaul shader generation, again
Now it's even simpler, and it now generates multiple
shader languages at once! The copying mechanism is now
much simpler on non-mac platforms as well. HLSL is also now a supported shader target language.
2022-02-21 18:07:22 -05:00

66 lines
1.9 KiB
CMake

include(../../cmake/AddPlatformExecutable.cmake)
if(ENABLE_METAL)
find_library(METAL Metal)
set(EXTRA_LIBRARIES GFXMetal ${METAL} ${EXTRA_LIBRARIES})
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_metal.mm ${EXTRA_SRC})
endif()
if(ENABLE_VULKAN)
set(EXTRA_LIBRARIES GFXVulkan ${EXTRA_LIBRARIES})
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_vulkan.cpp ${EXTRA_SRC})
endif()
if(ENABLE_DX12)
set(EXTRA_LIBRARIES GFXDX12 ${EXTRA_LIBRARIES})
endif()
if(TARGET SDL2::SDL2)
set(EXTRA_LIBRARIES SDL2::SDL2 ${EXTRA_LIBRARIES})
endif()
if(TARGET SDL2::Main)
set(EXTRA_LIBRARIES SDL2::Main ${EXTRA_LIBRARIES})
endif()
if(TARGET SDL2::SDL2main)
set(EXTRA_LIBRARIES SDL2::SDL2main ${EXTRA_LIBRARIES})
endif()
add_platform(
SRC
${CMAKE_CURRENT_SOURCE_DIR}/file.cpp
${EXTRA_SRC}
MAIN_FILE
main.cpp.in
EXECUTABLE_PROPERTIES
MACOSX_BUNDLE ON
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
LINK_LIBRARIES
Core
GFXDummy
${EXTRA_LIBRARIES}
)
function(add_platform_commands target)
if(ENABLE_MACOS)
set(DUMMY_NAME ${target}-CopyShaders)
add_custom_target(${DUMMY_NAME} ALL DEPENDS ${CMAKE_BINARY_DIR}/${target}-dummy)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${target}-dummy
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target}>/../Resources/shaders
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/shaders $<TARGET_FILE_DIR:${target}>/../Resources/shaders
)
add_dependencies(${target} ${DUMMY_NAME})
endif()
if(NOT SKIP_DATA)
add_custom_target(${target}_copy_assets
COMMAND ${CMAKE_COMMAND} -E copy_directory /home/josh/Development/prism/example/data/ ${CMAKE_BINARY_DIR}/bin/data
)
add_dependencies(${target} ${target}_copy_assets)
endif()
endfunction()