Revision: 57156
          http://sourceforge.net/p/brlcad/code/57156
Author:   starseeker
Date:     2013-08-27 00:50:11 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
Sigh.  The 'only generate it once' solution didn't work with the Ninja 
generator - do things the 'proper' way and provide sources for each executable 
target.

Modified Paths:
--------------
    brlcad/trunk/src/conv/step/CMakeLists.txt
    brlcad/trunk/src/conv/step/g-step/CMakeLists.txt
    brlcad/trunk/src/conv/step/step-g/CMakeLists.txt

Modified: brlcad/trunk/src/conv/step/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/conv/step/CMakeLists.txt   2013-08-27 00:32:43 UTC (rev 
57155)
+++ brlcad/trunk/src/conv/step/CMakeLists.txt   2013-08-27 00:50:11 UTC (rev 
57156)
@@ -25,55 +25,57 @@
   ${BRLCAD_SOURCE_DIR}/src/libbrep #Temporary until headers reworked
   )
 
-# This Schema determines which version of STEP the command will support
-# TODO - see if there is some way to automatically support multiple versions
-set(SCHEMA_FILE ${BRLCAD_SOURCE_DIR}/src/other/stepcode/data/ap203/ap203.exp)
-#set(SCHEMA_FILE 
${BRLCAD_SOURCE_DIR}/src/other/stepcode/data/ap203e2/ap203e2_mim_lf.exp)
+set(STEP_SCHEMA_FILE 
${BRLCAD_SOURCE_DIR}/src/other/stepcode/data/ap203/ap203.exp)
+#set(STEP_SCHEMA_FILE 
${BRLCAD_SOURCE_DIR}/src/other/stepcode/data/ap203e2/ap203e2_mim_lf.exp)
 
-# read the schema name from a line like 'SCHEMA AUTOMOTIVE_DESIGN;'
-file(STRINGS ${SCHEMA_FILE} SCHEMA_STATEMENT LIMIT_COUNT 1 REGEX "SCHEMA .*")
-string(REGEX REPLACE "^SCHEMA \(.*\)\;$" "\\1" SCHEMA_N ${SCHEMA_STATEMENT} )
-string(TOUPPER ${SCHEMA_N} SCHEMA_NAME) #fedex_plus always uses upper case for 
file names
+macro(GENERATE_SCHEMA_INPUTS SCHEMA_FILE TARGET_SUFFIX)
+  # This Schema determines which version of STEP the command will support
+  # TODO - see if there is some way to automatically support multiple versions
+  # read the schema name from a line like 'SCHEMA AUTOMOTIVE_DESIGN;'
+  file(STRINGS ${SCHEMA_FILE} SCHEMA_STATEMENT LIMIT_COUNT 1 REGEX "SCHEMA .*")
+  string(REGEX REPLACE "^SCHEMA \(.*\)\;$" "\\1" SCHEMA_N ${SCHEMA_STATEMENT} )
+  string(TOUPPER ${SCHEMA_N} SCHEMA_NAME) #fedex_plus always uses upper case 
for file names
 
-# Because SCHEMA_OUT_DIR is the working directory for fedex_plus, it must be
-# created at configure time and be present when fedex_plus is run
-set(SCHEMA_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_NAME})
-make_directory(${SCHEMA_OUT_DIR})
-include_directories(${SCHEMA_OUT_DIR})
-DISTCLEAN(${SCHEMA_OUT_DIR})
+  # Because SCHEMA_OUT_DIR is the working directory for fedex_plus, it must be
+  # created at configure time and be present when fedex_plus is run
+  set(SCHEMA_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_NAME})
+  make_directory(${SCHEMA_OUT_DIR})
+  include_directories(${SCHEMA_OUT_DIR})
+  DISTCLEAN(${SCHEMA_OUT_DIR})
 
-# These files are the standard fedex_plus outputs that need to be compiled.
-set(fedex_srcs
-  ${SCHEMA_OUT_DIR}/Sdai${SCHEMA_NAME}.cc
-  ${SCHEMA_OUT_DIR}/Sdai${SCHEMA_NAME}.init.cc
-  ${SCHEMA_OUT_DIR}/SdaiAll.cc
-  ${SCHEMA_OUT_DIR}/compstructs.cc
-  ${SCHEMA_OUT_DIR}/schema.cc
-  )
+  # These files are the standard fedex_plus outputs that need to be compiled.
+  set(fedex_srcs
+    ${SCHEMA_OUT_DIR}/Sdai${SCHEMA_NAME}.cc
+    ${SCHEMA_OUT_DIR}/Sdai${SCHEMA_NAME}.init.cc
+    ${SCHEMA_OUT_DIR}/SdaiAll.cc
+    ${SCHEMA_OUT_DIR}/compstructs.cc
+    ${SCHEMA_OUT_DIR}/schema.cc
+    )
 
-# For the subdirectory add_custom_command definitions, need the generated
-# headers as well.
-set(FEDEX_OUTPUT
-  ${fedex_srcs}
-  ${SCHEMA_OUT_DIR}/Sdai${SCHEMA_NAME}.h
-  ${SCHEMA_OUT_DIR}/Sdaiclasses.h
-  ${SCHEMA_OUT_DIR}/schema.h
-  )
+  # For the subdirectory add_custom_command definitions, need the generated
+  # headers as well.
+  set(FEDEX_OUTPUT
+    ${fedex_srcs}
+    ${SCHEMA_OUT_DIR}/Sdai${SCHEMA_NAME}.h
+    ${SCHEMA_OUT_DIR}/Sdaiclasses.h
+    ${SCHEMA_OUT_DIR}/schema.h
+    )
 
-# Define a common custom build target that ensures the fedex_plus outputs
-# are present.  Do this rather than relying on custom commands in the
-# subdirectories to avoid multiple build targets trying to run fedex_plus
-# simultaneously to generate identical inputs (unknown if that is problematic)
-# and to add extra robustness for parallel build target ordering.
-add_custom_command(OUTPUT ${SCHEMA_OUT_DIR}/step_fedex_${SCHEMA_NAME}.done
-  COMMAND ${FEDEX_PLUS_EXEC} ARGS ${SCHEMA_FILE}
-  COMMAND ${CMAKE_COMMAND} -E touch 
${SCHEMA_OUT_DIR}/step_fedex_${SCHEMA_NAME}.done
-  DEPENDS ${SCHEMA_FILE} ${FEDEX_PLUS_EXECUTABLE_TARGET}
-  WORKING_DIRECTORY ${SCHEMA_OUT_DIR}
-  COMMENT "Generating C++ code to express ${SCHEMA_NAME}..."
-  VERBATIM)
-add_custom_target(step-fedex-${SCHEMA_NAME}
-  DEPENDS ${SCHEMA_OUT_DIR}/step_fedex_${SCHEMA_NAME}.done)
+  # Define a common custom build target that ensures the fedex_plus outputs
+  # are present.  Do this rather than relying on custom commands in the
+  # subdirectories to avoid multiple build targets trying to run fedex_plus
+  # simultaneously to generate identical inputs (unknown if that is 
problematic)
+  # and to add extra robustness for parallel build target ordering.
+  add_custom_command(OUTPUT ${FEDEX_OUTPUT} 
${SCHEMA_OUT_DIR}/step_fedex_${SCHEMA_NAME}.done
+    COMMAND ${FEDEX_PLUS_EXEC} ARGS ${SCHEMA_FILE}
+    COMMAND ${CMAKE_COMMAND} -E touch 
${SCHEMA_OUT_DIR}/step_fedex_${SCHEMA_NAME}.done
+    DEPENDS ${SCHEMA_FILE} ${FEDEX_PLUS_EXECUTABLE_TARGET}
+    WORKING_DIRECTORY ${SCHEMA_OUT_DIR}
+    COMMENT "Generating C++ code to express ${SCHEMA_NAME}..."
+    VERBATIM)
+  add_custom_target(step-fedex-${SCHEMA_NAME}-${TARGET_SUFFIX}
+    DEPENDS ${SCHEMA_OUT_DIR}/step_fedex_${SCHEMA_NAME}.done)
+endmacro(GENERATE_SCHEMA_INPUTS SCHEMA_FILE)
 
 add_subdirectory(step-g)
 add_subdirectory(g-step)

Modified: brlcad/trunk/src/conv/step/g-step/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/conv/step/g-step/CMakeLists.txt    2013-08-27 00:32:43 UTC 
(rev 57155)
+++ brlcad/trunk/src/conv/step/g-step/CMakeLists.txt    2013-08-27 00:50:11 UTC 
(rev 57156)
@@ -4,24 +4,7 @@
   ${CMAKE_CURRENT_SOURCE_DIR}
   )
 
-# The fedex-plus files are shared between step-g and g-step, but
-# CMake currently requires that the custom command generating
-# source files used in a target build be in the same CMakeLists.txt
-# file as the target definition.  Hence, we need to repeat the
-# add_custom command definition for each converter that needs the
-# fedex output, even though they're all using the same outputs.
-# The top-level fedex-plus STEP custom target is used to make sure
-# the files expected by this target definition are already in
-# place.  That fedex-plus target is added as a dependency to the
-# current build target. Consequently, the only purpose of this
-# custom command definition is to allow files that don't exist
-# at configure time to be part of the target sources list.
-add_custom_command(OUTPUT ${FEDEX_OUTPUT}
-  COMMAND ${FEDEX_PLUS_EXEC} ARGS ${SCHEMA_FILE}
-  DEPENDS ${SCHEMA_FILE} ${FEDEX_PLUS_EXECUTABLE_TARGET}
-  WORKING_DIRECTORY ${SCHEMA_OUT_DIR}
-  COMMENT "Generating C++ code to express ${SCHEMA_NAME}..."
-  VERBATIM)
+GENERATE_SCHEMA_INPUTS(${STEP_SCHEMA_FILE} gstep)
 
 set(gstep_SOURCES
   ${fedex_srcs}
@@ -47,7 +30,7 @@
 #add_definitions(-DAP203e2)
 
 BRLCAD_ADDEXEC(g-step "${gstep_SOURCES}" "${gstep_LIBS}" NO_STRICT)
-add_dependencies(g-step step-fedex-${SCHEMA_NAME})
+add_dependencies(g-step step-fedex-${SCHEMA_NAME}-gstep)
 
 if(MSVC)
   set(gstep_IMPORTS

Modified: brlcad/trunk/src/conv/step/step-g/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/conv/step/step-g/CMakeLists.txt    2013-08-27 00:32:43 UTC 
(rev 57155)
+++ brlcad/trunk/src/conv/step/step-g/CMakeLists.txt    2013-08-27 00:50:11 UTC 
(rev 57156)
@@ -4,24 +4,7 @@
   ${CMAKE_CURRENT_SOURCE_DIR}
   )
 
-# The fedex-plus files are shared between step-g and g-step, but
-# CMake currently requires that the custom command generating
-# source files used in a target build be in the same CMakeLists.txt
-# file as the target definition.  Hence, we need to repeat the
-# add_custom command definition for each converter that needs the
-# fedex output, even though they're all using the same outputs.
-# The top-level fedex-plus STEP custom target is used to make sure
-# the files expected by this target definition are already in
-# place.  That fedex-plus target is added as a dependency to the
-# current build target. Consequently, the only purpose of this
-# custom command definition is to allow files that don't exist
-# at configure time to be part of the target sources list.
-add_custom_command(OUTPUT ${FEDEX_OUTPUT}
-  COMMAND ${FEDEX_PLUS_EXEC} ARGS ${SCHEMA_FILE}
-  DEPENDS ${SCHEMA_FILE} ${FEDEX_PLUS_EXECUTABLE_TARGET}
-  WORKING_DIRECTORY ${SCHEMA_OUT_DIR}
-  COMMENT "Generating C++ code to express ${SCHEMA_NAME}..."
-  VERBATIM)
+GENERATE_SCHEMA_INPUTS(${STEP_SCHEMA_FILE} stepg)
 
 set(stepg_SOURCES
   ${fedex_srcs}
@@ -439,7 +422,7 @@
 #add_definitions(-DAP203e2)
 
 BRLCAD_ADDEXEC(step-g "${stepg_SOURCES}" "${stepg_LIBS}" NO_STRICT)
-add_dependencies(step-g step-fedex-${SCHEMA_NAME})
+add_dependencies(step-g step-fedex-${SCHEMA_NAME}-stepg)
 
 if(MSVC)
   set(stepg_IMPORTS

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to