minor improvements to cmake's datatoc usage, now changes to datatoc.c re-make generat...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 11 Aug 2012 18:39:38 +0000 (18:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 11 Aug 2012 18:39:38 +0000 (18:39 +0000)
build_files/cmake/macros.cmake
source/blender/datatoc/datatoc.c

index 3d2d19c7685a8ac93e9654df045bd717a691fc8a..1340920eafa460d83de341bc384fe25a8a40841f 100644 (file)
@@ -739,10 +739,8 @@ macro(data_to_c
        add_custom_command(
                OUTPUT ${file_to}
                COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
-               COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc
-                       ${file_from}
-                       ${file_to}
-               DEPENDS ${file_from})
+               COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${file_from} ${file_to}
+               DEPENDS ${file_from} datatoc)
        unset(_file_to_path)
 endmacro()
 
@@ -751,22 +749,21 @@ macro(data_to_c_simple
       file_from
       list_to_add)
 
-       # only to avoid confusion
-       set(_file_to ${file_from}.c)
+       # remove ../'s
+       get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from}   REALPATH)
+       get_filename_component(_file_to   ${CMAKE_CURRENT_BINARY_DIR}/${file_from}.c REALPATH)
 
-       list(APPEND ${list_to_add} ${CMAKE_CURRENT_BINARY_DIR}/${_file_to})
+       list(APPEND ${list_to_add} ${_file_to})
 
        get_filename_component(_file_to_path ${_file_to} PATH)
 
        add_custom_command(
-               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
+               OUTPUT  ${_file_to}
                COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
-               COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc
-                       ${CMAKE_CURRENT_SOURCE_DIR}/${file_from}
-                       ${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
-               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file_from})
+               COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
+               DEPENDS ${_file_from} datatoc)
 
-       unset(_var_name)
+       unset(_file_from)
        unset(_file_to)
        unset(_file_to_path)
 endmacro()
index 7a4e51932a2fc67a731c39bda73ed875b7d17d0b..d074917a545dcce0b6dbbac164e7f30d0385a5c4 100644 (file)
@@ -104,9 +104,11 @@ int main(int argc, char **argv)
        fprintf(fpout, "int datatoc_%s_size = %s;\n", argv[1], sizest);
        fprintf(fpout, "char datatoc_%s[] = {\n", argv[1]);
        while (size--) {
+#ifdef VERBOSE
                if (size % 32 == 31) {
                        fprintf(fpout, "\n");
                }
+#endif
 
                /* fprintf (fpout, "\\x%02x", getc(fpin)); */
                fprintf(fpout, "%3d,", getc(fpin));