You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by th...@apache.org on 2011/10/20 06:54:05 UTC

svn commit: r1186617 - in /avro/trunk: CHANGES.txt lang/c++/CMakeLists.txt lang/c++/build.sh

Author: thiru
Date: Thu Oct 20 04:54:04 2011
New Revision: 1186617

URL: http://svn.apache.org/viewvc?rev=1186617&view=rev
Log:
AVRO-937. C++ CMake keeps generating code even when there is no change

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/c++/CMakeLists.txt
    avro/trunk/lang/c++/build.sh

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1186617&r1=1186616&r2=1186617&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu Oct 20 04:54:04 2011
@@ -150,6 +150,7 @@ Avro 1.6.0 (unreleased)
 
     AVRO-938. Some more warning when built on RHEL. (thiru)
 
+    AVRO-937. C++ CMake keeps generating code even when there is no change. (thiru)
   BUG FIXES
 
     AVRO-824. Java: Fix usage message of BinaryFragmentToJsonTool.

Modified: avro/trunk/lang/c++/CMakeLists.txt
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c%2B%2B/CMakeLists.txt?rev=1186617&r1=1186616&r2=1186617&view=diff
==============================================================================
--- avro/trunk/lang/c++/CMakeLists.txt (original)
+++ avro/trunk/lang/c++/CMakeLists.txt Thu Oct 20 04:54:04 2011
@@ -73,25 +73,18 @@ add_dependencies(avrocpp parser lexer)
 
 target_link_libraries (precompile avrocpp ${Boost_LIBRARIES})
 
-add_custom_command (OUTPUT bigrecord
-    COMMAND precompile ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/bigrecord
-        bigrecord
-    DEPENDS precompile)
-
-add_custom_target (testgen
-    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-cppcode.py
-        -n testgen -i bigrecord -o testgen.hh
-    DEPENDS bigrecord)
-
-add_custom_command (OUTPUT bigrecord2
-    COMMAND precompile ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/bigrecord2
-        bigrecord2
-    DEPENDS precompile)
-
-add_custom_target (testgen2
-    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-cppcode.py
-        -n testgen2 -i bigrecord2 -o testgen2.hh
-    DEPENDS bigrecord2)
+macro (gencpp file ns)
+    add_custom_command (OUTPUT ${ns}.hh
+        COMMAND precompile ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/${file}
+            ${file}
+        COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-cppcode.py
+            -n ${ns} -i ${file} -o ${ns}.hh
+        DEPENDS precompile ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/${file})
+    add_custom_target(${ns} DEPENDS ${ns}.hh)
+endmacro (gencpp)
+
+gencpp (bigrecord testgen)
+gencpp (bigrecord2 testgen2)
 
 add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/AvroYacc.cc
     COMMAND bison --defines=${CMAKE_CURRENT_BINARY_DIR}/AvroYacc.hh -o ${CMAKE_CURRENT_BINARY_DIR}/AvroYacc.cc
@@ -101,69 +94,32 @@ add_custom_command (OUTPUT ${CMAKE_CURRE
     COMMAND flex -oAvroLex.cc
         ${CMAKE_CURRENT_SOURCE_DIR}/parser/AvroLex.ll)
     
-add_custom_target (bigrecord_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/bigrecord
-        -o bigrecord.hh -n testgen
-    DEPENDS avrogencpp)
-
-add_custom_target (bigrecord2_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/bigrecord2
-        -o bigrecord2.hh -n testgen2
-    DEPENDS avrogencpp)
-
-add_custom_target (union_array_union_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/union_array_union
-        -o union_array_union.hh -n uau
-    DEPENDS avrogencpp)
-
-add_custom_target (union_map_union_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/union_map_union
-        -o union_map_union.hh -n umu
-    DEPENDS avrogencpp)
-
-add_custom_target (union_conflict_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/union_conflict
-        -o union_conflict.hh -n uc -U
-    DEPENDS avrogencpp)
-
-add_custom_target (recursive_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/recursive
-        -o recursive.hh -n rec
-    DEPENDS avrogencpp)
-
-add_custom_target (reuse_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/reuse
-        -o reuse.hh -n reu
-    DEPENDS avrogencpp)
-
-add_custom_target (circulardep_hh
-    COMMAND avrogencpp
-        -p -
-        -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/circulardep
-        -o circulardep.hh -n reu
-    DEPENDS avrogencpp)
+macro (gen file ns)
+    add_custom_command (OUTPUT ${file}.hh
+        COMMAND avrogencpp
+            -p -
+            -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/${file}
+            -o ${file}.hh -n ${ns} -U
+        DEPENDS avrogencpp ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/${file})
+    add_custom_target (${file}_hh DEPENDS ${file}.hh)
+endmacro (gen)
+
+gen (bigrecord testgen)
+gen (bigrecord2 testgen2)
+gen (union_array_union uau)
+gen (union_map_union umu)
+gen (union_conflict uc)
+gen (recursive rec)
+gen (reuse ru)
+gen (circulardep cd)
 
 macro (test name)
     add_executable (${name} test/${name}.cc)
     target_link_libraries (${name} avrocpp ${Boost_LIBRARIES})
 endmacro (test)
 
-test(buffertest)
-test(unittest)
+test (buffertest)
+test (unittest)
 
 add_executable (CodecTests test/CodecTests.cc)
 target_link_libraries (CodecTests avrocpp ${Boost_LIBRARIES})

Modified: avro/trunk/lang/c++/build.sh
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c%2B%2B/build.sh?rev=1186617&r1=1186616&r2=1186617&view=diff
==============================================================================
--- avro/trunk/lang/c++/build.sh (original)
+++ avro/trunk/lang/c++/build.sh Thu Oct 20 04:54:04 2011
@@ -76,15 +76,15 @@ function do_dist() {
 
 case "$target" in
     test)
-    (cd build && make && cd ..
-        ./build/buffertest
-        ./build/unittest
-        ./build/testgentest
-        ./build/CodecTests
-        ./build/StreamTests
-        ./build/SpecificTests
-        ./build/AvrogencppTests
-        ./build/DataFileTests)
+    (cd build && make && cd .. \
+        && ./build/buffertest \
+        && ./build/unittest \
+        && ./build/testgentest \
+        && ./build/CodecTests \
+        && ./build/StreamTests \
+        && ./build/SpecificTests \
+        && ./build/AvrogencppTests \
+        && ./build/DataFileTests)
 	;;
 
     dist)