hello_cube project now has its own asset bundle and runs without arguments

This commit is contained in:
2021-08-10 00:49:34 -07:00
parent 831cf2d1c5
commit 7965da421c
3 changed files with 22 additions and 11 deletions

View File

@@ -9,8 +9,7 @@
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ], "inheritEnvironments": [ "msvc_x64_x64" ]
"variables": []
}, },
{ {
"name": "x64-Release", "name": "x64-Release",
@@ -21,8 +20,7 @@
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ], "inheritEnvironments": [ "msvc_x64_x64" ]
"variables": []
} }
] ]
} }

View File

@@ -3,23 +3,36 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
SET(KRAKEN_CUBE_BUNDLE "${CMAKE_BINARY_DIR}/output/tests/kraken_cube.krbundle")
add_custom_command(
OUTPUT ${KRAKEN_CUBE_BUNDLE}
COMMAND kraken_convert -o ${KRAKEN_CUBE_BUNDLE} ${STANDARD_ASSET_BUNDLE}
DEPENDS kraken_convert kraken_sdk
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Creating Cube Test Assets"
)
add_custom_target(kraken_cube_assets ALL
DEPENDS ${KRAKEN_CUBE_BUNDLE}
VERBATIM
)
if (WIN32) if (WIN32)
add_executable(kraken_cube WIN32 main_win.cpp hello_cube.cpp) add_executable(kraken_cube WIN32 main_win.cpp hello_cube.cpp)
add_compile_definitions(UNICODE) add_compile_definitions(UNICODE)
set_property(TARGET kraken_cube PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "${STANDARD_ASSET_BUNDLE}")
else(WIN32) else(WIN32)
add_executable(kraken_cube main_macos.mm hello_cube.cpp) add_executable(kraken_cube main_macos.mm hello_cube.cpp)
set(CMAKE_CXX_COMPILER "clang++") set(CMAKE_CXX_COMPILER "clang++")
endif(WIN32) endif(WIN32)
add_dependencies(kraken_cube standard_assets) add_dependencies(kraken_cube kraken_cube_assets)
target_include_directories(kraken_cube PRIVATE ${CMAKE_SOURCE_DIR}/hydra/include ${CMAKE_SOURCE_DIR}/kraken/public) target_include_directories(kraken_cube PRIVATE ${CMAKE_SOURCE_DIR}/hydra/include ${CMAKE_SOURCE_DIR}/kraken/public)
TARGET_LINK_LIBRARIES( kraken_cube kraken ${EXTRA_LIBS} ) TARGET_LINK_LIBRARIES( kraken_cube kraken ${EXTRA_LIBS} )
# configure_file(${STANDARD_ASSET_BUNDLE} ${CMAKE_BINARY_DIR}/output/bin COPYONLY)
set_target_properties( kraken_cube PROPERTIES set_target_properties( kraken_cube PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/output/bin RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/output/tests
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/output/bin RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/output/tests
) )

View File

@@ -38,7 +38,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
KrLoadResourceInfo load_resource_info = {}; KrLoadResourceInfo load_resource_info = {};
load_resource_info.sType = KR_STRUCTURE_TYPE_LOAD_RESOURCE; load_resource_info.sType = KR_STRUCTURE_TYPE_LOAD_RESOURCE;
load_resource_info.resourceHandle = 1; load_resource_info.resourceHandle = 1;
load_resource_info.pResourcePath = lpCmdLine; // "kraken_standard_assets.krbundle"; load_resource_info.pResourcePath = "kraken_cube.krbundle";
res = KrLoadResource(&load_resource_info); res = KrLoadResource(&load_resource_info);
if (res != KR_SUCCESS) { if (res != KR_SUCCESS) {
//printf("Failed to load resource: %s\n", arg); //printf("Failed to load resource: %s\n", arg);