diff --git a/.gitignore b/.gitignore index 7a334a5..f49eff3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build .DS_Store .vs out +example/*/dist diff --git a/cmake/example.cmake b/cmake/example.cmake index fcc1e1d..4dac11d 100644 --- a/cmake/example.cmake +++ b/cmake/example.cmake @@ -36,20 +36,18 @@ function(add_example) if(APPLE) if(EXAMPLE_TYPE STREQUAL "desktop") add_custom_target(${EXAMPLE_NAME}_run - COMMAND "${EXAMPLE_BINARY_DIR}/${EXAMPLE_APP_NAME}.app/Contents/MacOS/${EXAMPLE_APP_NAME}" - WORKING_DIRECTORY "${EXAMPLE_BINARY_DIR}" + COMMAND "${EXAMPLE_SOURCE_DIR}/dist/${EXAMPLE_APP_NAME}.app/Contents/MacOS/${EXAMPLE_APP_NAME}" COMMENT "Running ${EXAMPLE_NAME} example (bundle)") else() add_custom_target(${EXAMPLE_NAME}_run - COMMAND "${EXAMPLE_BINARY_DIR}/${EXAMPLE_APP_NAME}" --foo bar - WORKING_DIRECTORY "${EXAMPLE_BINARY_DIR}" + COMMAND "${EXAMPLE_SOURCE_DIR}/dist/${EXAMPLE_APP_NAME}" --foo bar COMMENT "Running ${EXAMPLE_NAME} example (executable)") endif() add_dependencies(${EXAMPLE_NAME}_run ${EXAMPLE_NAME}_build) elseif(WIN32) add_custom_target(${EXAMPLE_NAME}_run - COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}/$/${EXAMPLE_APP_NAME}.exe" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}/$" + COMMAND "${EXAMPLE_SOURCE_DIR}/dist/$/${EXAMPLE_APP_NAME}.exe" + WORKING_DIRECTORY "${EXAMPLE_SOURCE_DIR}/dist/$" COMMENT "Running ${EXAMPLE_NAME} example (Windows)") add_dependencies(${EXAMPLE_NAME}_run ${EXAMPLE_NAME}_build) endif() diff --git a/cmake/native.cmake b/cmake/native.cmake index 18eab55..da2528d 100644 --- a/cmake/native.cmake +++ b/cmake/native.cmake @@ -1,6 +1,8 @@ function(native_add_app) cmake_parse_arguments(NATIVE "" "TARGET;PLATFORM" "ASSETS" ${ARGN}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/dist") + if(APPLE) _native_add_app_apple(${ARGN}) elseif(WIN32) @@ -281,7 +283,7 @@ function(_native_add_assets_win32) add_custom_command( TARGET ${NATIVE_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${asset} ${CMAKE_CURRENT_BINARY_DIR}/$/${asset} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${asset} ${CMAKE_SOURCE_DIR}/dist/$/${asset} COMMENT "Copying asset: ${asset} \n" ) endforeach()