#320: generate demo files for embedding with bin2txt, deps fixes

This commit is contained in:
Vadim Grigoruk 2018-06-29 12:57:28 +03:00
parent d6909e3d2a
commit 2f5abd74d6
1 changed files with 12 additions and 14 deletions

View File

@ -321,7 +321,7 @@ if(NOT EMSCRIPTEN)
add_dependencies(bin2txt zlib) add_dependencies(bin2txt zlib)
target_link_libraries(bin2txt zlib) target_link_libraries(bin2txt zlib)
file(GLOB DEMO_CARTS "${CMAKE_SOURCE_DIR}/demos/*.tic" ) file(GLOB DEMO_CARTS ${CMAKE_SOURCE_DIR}/demos/*.tic )
list(APPEND DEMO_CARTS list(APPEND DEMO_CARTS
${CMAKE_SOURCE_DIR}/config.tic ${CMAKE_SOURCE_DIR}/config.tic
@ -331,22 +331,20 @@ if(NOT EMSCRIPTEN)
set(DEMO_CARTS_OUT) set(DEMO_CARTS_OUT)
foreach(cart_var ${DEMO_CARTS}) foreach(CART_FILE ${DEMO_CARTS})
get_filename_component(cart_name ${cart_var} NAME) get_filename_component(cart_name ${CART_FILE} NAME)
list(APPEND DEMO_CARTS_OUT "${CMAKE_SOURCE_DIR}/bin/assets/${cart_name}.dat") set(OUTNAME ${CMAKE_SOURCE_DIR}/bin/assets/${cart_name}.dat)
add_custom_command(OUTPUT "${CMAKE_SOURCE_DIR}/bin/assets/${cart_name}.dat" list(APPEND DEMO_CARTS_OUT ${OUTNAME})
COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bin2txt" "${cart_var}" "${CMAKE_SOURCE_DIR}/bin/assets/${cart_name}.dat" -z
DEPENDS bin2txt "${cart_var}" add_custom_command(OUTPUT ${OUTNAME}
COMMENT "encoding carts" COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bin2txt ${CART_FILE} ${OUTNAME} -z
VERBATIM DEPENDS bin2txt ${CART_FILE}
) )
endforeach(cart_var) endforeach(CART_FILE)
add_custom_target(encoded_carts DEPENDS ${DEMO_CARTS_OUT})
endif() endif()
@ -378,7 +376,7 @@ set(TIC80LIB_SRC
${TIC80LIB_DIR}/html.c ${TIC80LIB_DIR}/html.c
) )
add_library(tic80lib STATIC ${TIC80LIB_SRC}) add_library(tic80lib STATIC ${TIC80LIB_SRC} ${DEMO_CARTS_OUT})
if(WIN32) if(WIN32)
target_include_directories(tic80lib PRIVATE build/windows/include) target_include_directories(tic80lib PRIVATE build/windows/include)
@ -422,7 +420,7 @@ target_include_directories(tic80 PRIVATE 3rd-party/sdl-gpu/include)
target_include_directories(tic80 PRIVATE 3rd-party/SDL2_net-2.0.1) target_include_directories(tic80 PRIVATE 3rd-party/SDL2_net-2.0.1)
if(NOT EMSCRIPTEN) if(NOT EMSCRIPTEN)
add_dependencies(tic80 SDL2-static SDL2main encoded_carts) add_dependencies(tic80 SDL2-static SDL2main)
target_link_libraries(tic80 SDL2-static SDL2main) target_link_libraries(tic80 SDL2-static SDL2main)
endif() endif()