Add post build target to copy the whole data/ dir into build/bin/ dir

This commit is contained in:
David Capello 2014-12-02 11:15:06 -03:00
parent 08f846c83d
commit 807598d5c3
2 changed files with 25 additions and 12 deletions

View File

@ -52,11 +52,8 @@ the source code in a directory called `aseprite-source`):
commands, you have to compile the project executing make, nmake, commands, you have to compile the project executing make, nmake,
opening the solution, etc. opening the solution, etc.
4. When the project is compiled, you can copy the resulting executable 4. When the project is compiled, you can find the executable file
file (e.g. `build/bin/aseprite.exe`) to `aseprite-source` and inside `build/bin/aseprite.exe`.
execute it. If you have used a Visual Studio project, you can copy
the whole `data/` directory to `build/bin/` so you can run/debug
the program from Visual Studio IDE.
## Mac OS X details ## Mac OS X details

View File

@ -217,7 +217,24 @@ if(LIBALLEGRO4_LINK_FLAGS)
endif() endif()
###################################################################### ######################################################################
# ASEPRITE application # Copy data/ directory target
file(GLOB_RECURSE src_data_files
RELATIVE ${CMAKE_SOURCE_DIR}/data/ "${CMAKE_SOURCE_DIR}/data/*.*")
foreach(fn ${src_data_files})
string(MAKE_C_IDENTIFIER "copy_data_${fn}" copy_fn_target_name)
add_custom_target(${copy_fn_target_name})
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/data/${fn}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/data/${fn} ${CMAKE_BINARY_DIR}/bin/data/${fn}
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/data/${fn})
list(APPEND out_data_files ${CMAKE_BINARY_DIR}/bin/data/${fn})
endforeach()
add_custom_target(copy_data DEPENDS ${out_data_files})
######################################################################
# Aseprite application
if(WIN32) if(WIN32)
set(win32_resources main/resources_win32.rc) set(win32_resources main/resources_win32.rc)
@ -227,8 +244,12 @@ if(UNIX)
set(x11_resources main/xpm_icon.c) set(x11_resources main/xpm_icon.c)
endif(UNIX) endif(UNIX)
add_executable(aseprite WIN32 main/main.cpp ${win32_resources} ${x11_resources}) add_executable(aseprite WIN32
main/main.cpp
${win32_resources}
${x11_resources})
target_link_libraries(aseprite ${all_libs}) target_link_libraries(aseprite ${all_libs})
add_dependencies(aseprite copy_data)
install(TARGETS aseprite install(TARGETS aseprite
RUNTIME DESTINATION bin) RUNTIME DESTINATION bin)
@ -236,11 +257,6 @@ install(TARGETS aseprite
install(DIRECTORY ../data install(DIRECTORY ../data
DESTINATION share/aseprite) DESTINATION share/aseprite)
if(EXISTS ../docs/quickref.pdf)
install(FILES ../docs/quickref.pdf
DESTINATION share/aseprite/docs/quickref.pdf)
endif()
###################################################################### ######################################################################
# Tests # Tests