Handle data directories for games not named example, and also support out of tree builds
This commit is contained in:
parent
0a95ee2fa8
commit
d219f0c85b
4 changed files with 10 additions and 8 deletions
|
@ -42,7 +42,7 @@ function(add_platform_executable)
|
||||||
|
|
||||||
target_link_libraries(${add_platform_executable_TARGET}
|
target_link_libraries(${add_platform_executable_TARGET}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${PLATFORM_LINK_LIBRARIES}
|
ExtraLibrariesPlatform
|
||||||
)
|
)
|
||||||
|
|
||||||
if("${add_platform_executable_APP_NAME}")
|
if("${add_platform_executable_APP_NAME}")
|
||||||
|
@ -51,7 +51,7 @@ function(add_platform_executable)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(COMMAND add_platform_commands)
|
if(COMMAND add_platform_commands)
|
||||||
add_platform_commands(${add_platform_executable_TARGET})
|
add_platform_commands(${add_platform_executable_TARGET} ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_output_dir(${add_platform_executable_TARGET})
|
set_output_dir(${add_platform_executable_TARGET})
|
||||||
|
@ -66,7 +66,9 @@ function(add_platform)
|
||||||
|
|
||||||
set(PLATFORM_MAIN_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${add_platform_MAIN_FILE} CACHE INTERNAL "")
|
set(PLATFORM_MAIN_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${add_platform_MAIN_FILE} CACHE INTERNAL "")
|
||||||
set(PLATFORM_MAIN_FILE_NAME ${add_platform_MAIN_FILE} CACHE INTERNAL "")
|
set(PLATFORM_MAIN_FILE_NAME ${add_platform_MAIN_FILE} CACHE INTERNAL "")
|
||||||
set(PLATFORM_LINK_LIBRARIES ${add_platform_LINK_LIBRARIES} CACHE INTERNAL "")
|
|
||||||
set(PLATFORM_EXECUTABLE_PROPERTIES ${add_platform_EXECUTABLE_PROPERTIES} CACHE INTERNAL "")
|
set(PLATFORM_EXECUTABLE_PROPERTIES ${add_platform_EXECUTABLE_PROPERTIES} CACHE INTERNAL "")
|
||||||
set(PLATFORM_SOURCES ${add_platform_SRC} CACHE INTERNAL "")
|
set(PLATFORM_SOURCES ${add_platform_SRC} CACHE INTERNAL "")
|
||||||
|
|
||||||
|
add_library(ExtraLibrariesPlatform INTERFACE)
|
||||||
|
target_link_libraries(ExtraLibrariesPlatform INTERFACE ${add_platform_LINK_LIBRARIES})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -66,7 +66,7 @@ add_platform(
|
||||||
COMPILE_OPTIONS
|
COMPILE_OPTIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
function(add_platform_commands APP_NAME)
|
function(add_platform_commands APP_NAME data_directory)
|
||||||
# you should set these as cmake options as these reset on cmake reconfigure
|
# you should set these as cmake options as these reset on cmake reconfigure
|
||||||
#set(APP_BUNDLE_IDENTIFIER "your app bundle id here, such as com.redstrate.prismtest")
|
#set(APP_BUNDLE_IDENTIFIER "your app bundle id here, such as com.redstrate.prismtest")
|
||||||
#set(CODE_SIGN_IDENTITY "iPhone Developer")
|
#set(CODE_SIGN_IDENTITY "iPhone Developer")
|
||||||
|
|
|
@ -43,7 +43,7 @@ add_platform(
|
||||||
${EXTRA_LIBRARIES}
|
${EXTRA_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
function(add_platform_commands target)
|
function(add_platform_commands target data_directory)
|
||||||
if(ENABLE_MACOS)
|
if(ENABLE_MACOS)
|
||||||
set(DUMMY_NAME ${target}-CopyShaders)
|
set(DUMMY_NAME ${target}-CopyShaders)
|
||||||
|
|
||||||
|
@ -60,13 +60,13 @@ function(add_platform_commands target)
|
||||||
if(NOT SKIP_DATA)
|
if(NOT SKIP_DATA)
|
||||||
if(ENABLE_MACOS)
|
if(ENABLE_MACOS)
|
||||||
add_custom_target(${target}_copy_assets
|
add_custom_target(${target}_copy_assets
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ $<TARGET_FILE_DIR:${target}>/../Resources/data
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${data_directory} $<TARGET_FILE_DIR:${target}>/../Resources/data
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data)
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data)
|
||||||
|
|
||||||
add_custom_target(${target}_copy_assets
|
add_custom_target(${target}_copy_assets
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ ${CMAKE_BINARY_DIR}/bin/data
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${data_directory} ${CMAKE_BINARY_DIR}/bin/data
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
add_dependencies(${target} ${target}_copy_assets)
|
add_dependencies(${target} ${target}_copy_assets)
|
||||||
|
|
|
@ -55,7 +55,7 @@ add_platform(
|
||||||
COMPILE_OPTIONS
|
COMPILE_OPTIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
function(add_platform_commands APP_NAME)
|
function(add_platform_commands APP_NAME data_directory)
|
||||||
# set in cmake optionss
|
# set in cmake optionss
|
||||||
#set(APP_BUNDLE_IDENTIFIER "com.test.app")
|
#set(APP_BUNDLE_IDENTIFIER "com.test.app")
|
||||||
#set(CODE_SIGN_IDENTITY "iPhone Developer")
|
#set(CODE_SIGN_IDENTITY "iPhone Developer")
|
||||||
|
|
Reference in a new issue