Revision: 55952
          http://sourceforge.net/p/brlcad/code/55952
Author:   starseeker
Date:     2013-07-03 20:02:09 +0000 (Wed, 03 Jul 2013)
Log Message:
-----------
Get rid of the ami.tcl and ampi.tcl wrappers - we can do the key bit necessary 
from CMake.  While we're at it, consolidate the index macros into one.

Modified Paths:
--------------
    brlcad/trunk/src/adrt/CMakeLists.txt
    brlcad/trunk/src/archer/CMakeLists.txt
    brlcad/trunk/src/mged/CMakeLists.txt
    brlcad/trunk/src/tclscripts/CMakeLists.txt
    brlcad/trunk/src/tclscripts/rtwizard/CMakeLists.txt

Removed Paths:
-------------
    brlcad/trunk/src/tclscripts/ami.tcl
    brlcad/trunk/src/tclscripts/ampi.tcl

Modified: brlcad/trunk/src/adrt/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/adrt/CMakeLists.txt        2013-07-03 18:59:19 UTC (rev 
55951)
+++ brlcad/trunk/src/adrt/CMakeLists.txt        2013-07-03 20:02:09 UTC (rev 
55952)
@@ -78,12 +78,9 @@
   BRLCAD_MANAGE_FILES("isst" ${BIN_DIR} EXEC)
   add_custom_target(isst ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/isst)
   add_dependencies(isst issttcltk bwish)
-  foreach(item ${pkgIndex_target_list})
+  foreach(item ${tclindex_target_list})
     add_dependencies(isst ${item})
-  endforeach(item ${pkgIndex_target_list})
-  foreach(item ${tclIndex_target_list})
-    add_dependencies(isst ${item})
-  endforeach(item ${tclIndex_target_list})
+  endforeach(item ${tclindex_target_list})
 endif(BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
 
 CMAKEFILES(isst_tcltk.c)

Modified: brlcad/trunk/src/archer/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/archer/CMakeLists.txt      2013-07-03 18:59:19 UTC (rev 
55951)
+++ brlcad/trunk/src/archer/CMakeLists.txt      2013-07-03 20:02:09 UTC (rev 
55952)
@@ -7,12 +7,9 @@
 # tclscripts.
 add_custom_target(archer ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/archer)
 add_dependencies(archer bwish rtwizard)
-foreach(item ${pkgIndex_target_list})
+foreach(item ${tclindex_target_list})
   add_dependencies(archer ${item})
-endforeach(item ${pkgIndex_target_list})
-foreach(item ${tclIndex_target_list})
-  add_dependencies(archer ${item})
-endforeach(item ${tclIndex_target_list})
+endforeach(item ${tclindex_target_list})
 
 # other archer dependencies
 if(BRLCAD_ENABLE_TK)

Modified: brlcad/trunk/src/mged/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/mged/CMakeLists.txt        2013-07-03 18:59:19 UTC (rev 
55951)
+++ brlcad/trunk/src/mged/CMakeLists.txt        2013-07-03 20:02:09 UTC (rev 
55952)
@@ -137,12 +137,9 @@
 
 # mged depends on the creation/installation of all the
 # tclscripts.
-foreach(item ${pkgIndex_target_list})
+foreach(item ${tclindex_target_list})
   ADD_DEPENDENCIES(mged ${item})
-endforeach(item ${pkgIndex_target_list})
-foreach(item ${tclIndex_target_list})
-  ADD_DEPENDENCIES(mged ${item})
-endforeach(item ${tclIndex_target_list})
+endforeach(item ${tclindex_target_list})
 
 BRLCAD_ADDEXEC(cad_boundp cad_boundp.c "libbu;${M_LIBRARY}")
 

Modified: brlcad/trunk/src/tclscripts/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/tclscripts/CMakeLists.txt  2013-07-03 18:59:19 UTC (rev 
55951)
+++ brlcad/trunk/src/tclscripts/CMakeLists.txt  2013-07-03 20:02:09 UTC (rev 
55952)
@@ -1,78 +1,66 @@
-###
-# Convenience macro for building pkgIndex.tcl
-###
-MACRO(pkgIndex_BUILD targetdir)
-  # normalize so we can use it as a name
-  string(REGEX REPLACE "/" "_" name ${targetdir})
+# The auto_mkindex and pkg_mkIndex commands are called from within Tcl, 
+# which means we need script files.
+file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/auto_mkindex.tcl" "
+foreach arg $argv {
+puts \"Generating tclIndex in $arg\"
+catch {auto_mkindex $arg *.tcl *.itcl *.itk *.sh} errout
+if {![file exists \"$arg/tclIndex\"]} {
+   puts \"$errout\"
+}
+}")
+file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/pkg_mkIndex.tcl" "
+foreach arg $argv {
+puts \"Generating pkgIndex.tcl in $arg\"
+catch {pkg_mkIndex -verbose $arg *.tcl *.itcl *.itk *.sh} errout
+if {![file exists \"$arg/pkgIndex.tcl\"]} {
+   puts \"$errout\"
+}
+}")
 
-  # divert output to diff paths depending on whether debug or release
-  if(CMAKE_CONFIGURATION_TYPES)
-    set(pkgIndex_outdir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${DATA_DIR}/${targetdir}")
-  else(CMAKE_CONFIGURATION_TYPES)
-    set(pkgIndex_outdir "${CMAKE_BINARY_DIR}/${DATA_DIR}/${targetdir}")
-  endif(CMAKE_CONFIGURATION_TYPES)
+# Wrap the logic needed for defining build targets that generate
+# tclIndex and pkgIndex.tcl files
 
-  # get file list so we can make pkgIndex.tcl depend on them
-  BRLCAD_GET_DIR_LIST_CONTENTS(DATA_TARGETS "${CMAKE_CURRENT_BINARY_DIR}" 
data_target_list)
-
-  # command that builds the index when the dependency is resolved
-  add_custom_command(
-    OUTPUT ${pkgIndex_outdir}/pkgIndex.tcl
-    COMMAND btclsh ${CMAKE_SOURCE_DIR}/src/tclscripts/ampi.tcl 
${pkgIndex_outdir}
-    DEPENDS btclsh ${data_target_list}
-    )
-
-  # put pkgIndex.tcl where it goes
-  install(FILES ${pkgIndex_outdir}/pkgIndex.tcl DESTINATION 
${DATA_DIR}/${targetdir})
-
-  # convenience target
-  add_custom_target(${name}_pkgIndex.tcl ALL DEPENDS 
${pkgIndex_outdir}/pkgIndex.tcl)
-
-  # Maintain a list of all pkgIndex targets for dependency purposes
-  set(pkgIndex_target_list ${pkgIndex_target_list} ${name}_pkgIndex.tcl)
-  list(REMOVE_DUPLICATES pkgIndex_target_list)
-  set(pkgIndex_target_list "${pkgIndex_target_list}" CACHE STRING "pkgIndex 
target list" FORCE)
-ENDMACRO(pkgIndex_BUILD name targetdir)
-mark_as_advanced(pkgIndex_target_list)
-
-
-###
-# Convenience macro for building tclIndex
-###
-MACRO(tclIndex_BUILD targetdir)
+macro(general_tcl_index_BUILD cmd outfile targetdir)
   # normalize so we can use it as a name
   string(REGEX REPLACE "/" "_" name ${targetdir})
 
   # divert output to diff paths depending on whether debug or release
   if(CMAKE_CONFIGURATION_TYPES)
-    set(tclIndex_outdir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${DATA_DIR}/${targetdir}")
+    set(tclindex_outdir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${DATA_DIR}/${targetdir}")
   else(CMAKE_CONFIGURATION_TYPES)
-    set(tclIndex_outdir "${CMAKE_BINARY_DIR}/${DATA_DIR}/${targetdir}")
+    set(tclindex_outdir "${CMAKE_BINARY_DIR}/${DATA_DIR}/${targetdir}")
   endif(CMAKE_CONFIGURATION_TYPES)
 
-  # get file list so we can make tclIndex depend on them
+  # get file list so we can make tclindex.tcl depend on them
   BRLCAD_GET_DIR_LIST_CONTENTS(DATA_TARGETS "${CMAKE_CURRENT_BINARY_DIR}" 
data_target_list)
 
   # command that builds the index when the dependency is resolved
   add_custom_command(
-    OUTPUT ${tclIndex_outdir}/tclIndex
-    COMMAND btclsh ${CMAKE_SOURCE_DIR}/src/tclscripts/ami.tcl 
${tclIndex_outdir}
+    OUTPUT ${tclindex_outdir}/${outfile}
+    COMMAND btclsh ${CMAKE_BINARY_DIR}/CMakeTmp/${cmd}.tcl ${tclindex_outdir}
     DEPENDS btclsh ${data_target_list}
     )
 
-  # put tclIndex where it goes
-  install(FILES ${tclIndex_outdir}/tclIndex DESTINATION 
${DATA_DIR}/${targetdir})
+  # put tclindex.tcl where it goes
+  install(FILES ${tclindex_outdir}/${outfile} DESTINATION 
${DATA_DIR}/${targetdir})
 
   # convenience target
-  add_custom_target(${name}_tclIndex ALL DEPENDS ${tclIndex_outdir}/tclIndex)
+  add_custom_target(${name}_${cmd}.tcl ALL DEPENDS 
${tclindex_outdir}/${outfile})
 
-  # Maintain a list of all tclIndex targets for dependency purposes
-  set(tclIndex_target_list ${tclIndex_target_list} ${name}_tclIndex)
-  list(REMOVE_DUPLICATES tclIndex_target_list)
-  set(tclIndex_target_list "${tclIndex_target_list}" CACHE STRING "tclIndex 
target list" FORCE)
-ENDMACRO(tclIndex_BUILD name targetdir)
-mark_as_advanced(tclIndex_target_list)
+  # Maintain a list of all tclindex targets for dependency purposes
+  set(tclindex_target_list ${tclindex_target_list} ${name}_${cmd}.tcl)
+  list(REMOVE_DUPLICATES tclindex_target_list)
+  set(tclindex_target_list "${tclindex_target_list}" CACHE STRING "tclindex 
target list" FORCE)
+endmacro(general_tcl_index_BUILD name targetdir)
+mark_as_advanced(tclindex_target_list)
 
+# Type specific generalizations of the general_tcl_index_BUILD macro
+macro(pkgIndex_BUILD targetdir)
+  general_tcl_index_BUILD(pkg_mkIndex pkgIndex.tcl "${targetdir}")
+endmacro()
+macro(tclIndex_BUILD targetdir)
+  general_tcl_index_BUILD(auto_mkindex tclIndex "${targetdir}")
+endmacro()
 
 # Now that the macros are defined, we can add tclscript subdirs
 add_subdirectory(archer)
@@ -89,8 +77,6 @@
 add_subdirectory(util)
 
 set(tclscripts_TCLSCRIPTS
-  ami.tcl
-  ampi.tcl
   cad_clrpick.tcl
   cad_dialog.tcl
   chkexterns.tcl

Deleted: brlcad/trunk/src/tclscripts/ami.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/ami.tcl 2013-07-03 18:59:19 UTC (rev 55951)
+++ brlcad/trunk/src/tclscripts/ami.tcl 2013-07-03 20:02:09 UTC (rev 55952)
@@ -1,83 +0,0 @@
-#!/bin/sh
-#                         A M I . T C L
-# BRL-CAD
-#
-# Copyright (c) 2004-2013 United States Government as represented by
-# the U.S. Army Research Laboratory.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# version 2.1 as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this file; see the file named COPYING for more
-# information.
-#
-###
-# This is a comment \
-    /bin/echo "This is not a shell script"
-# This is a comment \
-    exit
-
-set error 0
-
-if {![info exists argv]} {
-    puts "No directory argument provided for tclIndex."
-    return 0
-}
-
-
-# make the tclIndex
-foreach arg $argv {
-    # generate a tclIndex file in the arg dir
-    puts "Generating tclIndex in $arg"
-    catch {auto_mkindex $arg *.tcl *.itcl *.itk *.sh} errout
-
-    if {![file exists "$arg/tclIndex"]} {
-       puts "$errout"
-       puts "ERROR: tclIndex does not exist in $arg"
-       incr error
-       continue
-    }
-
-    set tclIndex ""
-    set header ""
-
-    # sort the tclIndex
-    set fd [open "$arg/tclIndex"]
-    while {[gets $fd data] >= 0} {
-       if {[string compare -length 3 $data "set"] == 0} {
-           lappend tclIndex $data
-       } else {
-           lappend header $data
-       }
-    }
-    close $fd
-
-    # write out the sorted tclIndex
-    set fd [open "$arg/tclIndex" {WRONLY TRUNC CREAT}]
-    foreach line $header {
-       puts $fd $line
-    }
-    foreach line [lsort $tclIndex] {
-       puts $fd $line
-    }
-    close $fd
-}
-
-
-exit $error
-
-# Local Variables:
-# mode: Tcl
-# tab-width: 8
-# c-basic-offset: 4
-# tcl-indent-level: 4
-# indent-tabs-mode: t
-# End:
-# ex: shiftwidth=4 tabstop=8

Deleted: brlcad/trunk/src/tclscripts/ampi.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/ampi.tcl        2013-07-03 18:59:19 UTC (rev 
55951)
+++ brlcad/trunk/src/tclscripts/ampi.tcl        2013-07-03 20:02:09 UTC (rev 
55952)
@@ -1,84 +0,0 @@
-#!/bin/sh
-#                        A M P I . T C L
-# BRL-CAD
-#
-# Copyright (c) 2004-2013 United States Government as represented by
-# the U.S. Army Research Laboratory.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# version 2.1 as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this file; see the file named COPYING for more
-# information.
-#
-###
-# This is a comment \
-    /bin/echo "This is not a shell script"
-# This is a comment \
-    exit
-
-set error 0
-
-if {![info exists argv]} {
-    puts "No directory argument provided for pkgIndex.tcl."
-    return 0
-}
-
-
-# make the pkgIndex.tcl
-foreach arg $argv {
-
-    # generate a pkgIndex.tcl file in the arg dir
-    puts "Generating pkgIndex.tcl in $arg"
-    catch {pkg_mkIndex -verbose $arg *.tcl *.itcl *.itk *.sh} errout
-
-    if {![file exists "$arg/pkgIndex.tcl"]} {
-       puts "$errout"
-       puts "ERROR: pkgIndex.tcl does not exist in $arg"
-       incr error
-       continue
-    }
-
-    set pkgIndex ""
-    set header ""
-
-    # sort the pkgIndex.tcl
-    set fd [open "$arg/pkgIndex.tcl"]
-    while {[gets $fd data] >= 0} {
-       if {[string compare -length 7 $data "package"] == 0} {
-           lappend pkgIndex $data
-       } else {
-           lappend header $data
-       }
-    }
-    close $fd
-
-    # write out the sorted pkgIndex.tcl
-    set fd [open "$arg/pkgIndex.tcl" {WRONLY TRUNC CREAT}]
-    foreach line $header {
-       puts $fd $line
-    }
-    foreach line [lsort $pkgIndex] {
-       puts $fd $line
-    }
-    close $fd
-}
-
-
-exit $error
-
-# Local Variables:
-# mode: Tcl
-# tab-width: 8
-# c-basic-offset: 4
-# tcl-indent-level: 4
-# indent-tabs-mode: t
-# End:
-# ex: shiftwidth=4 tabstop=8

Modified: brlcad/trunk/src/tclscripts/rtwizard/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/tclscripts/rtwizard/CMakeLists.txt 2013-07-03 18:59:19 UTC 
(rev 55951)
+++ brlcad/trunk/src/tclscripts/rtwizard/CMakeLists.txt 2013-07-03 20:02:09 UTC 
(rev 55952)
@@ -75,12 +75,9 @@
 if(TARGET tkpng)
   add_dependencies(rtwizard tkpng)
 endif(TARGET tkpng)
-foreach(item ${pkgIndex_target_list})
+foreach(item ${tclindex_target_list})
   add_dependencies(rtwizard ${item})
-endforeach(item ${pkgIndex_target_list})
-foreach(item ${tclIndex_target_list})
-  add_dependencies(rtwizard ${item})
-endforeach(item ${tclIndex_target_list})
+endforeach(item ${tclindex_target_list})
 
 CMAKEFILES(examples)
 

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


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to