From millerjv@crd.ge.com Mon Nov 5 13:54:04 2001 From: millerjv@crd.ge.com (Miller, James V (CRD)) Date: Mon, 5 Nov 2001 08:54:04 -0500 Subject: [Cmake] Win32 "Blended" processor vs Pentium Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C16601.547F8BD0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C16601.547F8BD0" ------_=_NextPart_001_01C16601.547F8BD0 Content-Type: text/plain; charset="iso-8859-1" Stephen Alyward mentioned the other day that he has seen as much as a 2X performance improvement if VC++ is set to create instructions for the Pentium processor as opposed to the "Blended" mode which is the current default. Has anyone else seen such performance increases switching from "blended" to "pentium"? Should CMake support changing this setting? Or perhaps should we just the default to be compile for Pentium? Are we worried about building applications for people with 486's? (I am currently getting pressure to pull machines with less than a Pentium II off our network :) Jim Miller _____________________________________ Visualization & Computer Vision GE Corporate Research & Development Bldg. KW, Room C218B P.O. Box 8, Schenectady NY 12301 millerjv@crd.ge.com < mailto:millerjv@crd.ge.com > (518) 387-4005, Dial Comm: 8*833-4005, Cell: (518) 505-7065, Fax: (518) 387-6981 ------_=_NextPart_001_01C16601.547F8BD0 Content-Type: text/html; charset="iso-8859-1"
Stephen Alyward mentioned the other day that he has seen as much as a 2X performance improvement if VC++ is set to create instructions for the Pentium processor as opposed to the "Blended" mode which is the current default.
 
Has anyone else seen such performance increases switching from "blended" to "pentium"?
 
Should CMake support changing this setting? Or perhaps should we just the default to be compile for Pentium?  Are we worried about building applications for people with 486's? (I am currently getting pressure to pull machines with less than a Pentium II off our network :)
 

Jim Miller
_____________________________________
Visualization & Computer Vision
GE Corporate Research & Development
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv@crd.ge.com <mailto:millerjv@crd.ge.com>

(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981


 
------_=_NextPart_001_01C16601.547F8BD0-- ------_=_NextPart_000_01C16601.547F8BD0 Content-Type: application/octet-stream; name="Miller, James V (CRD).vcf" Content-Disposition: attachment; filename="Miller, James V (CRD).vcf" BEGIN:VCARD VERSION:2.1 N:Miller;James FN:Miller, James V (CRD) ORG:CRD;ESL TITLE:Computer Scientist TEL;WORK;VOICE:*833-4005 TEL;WORK;VOICE:1 518 387-4005 ADR;WORK:;KW-C218B;P.O. Box 8;Schenectady;New York;12301;USA LABEL;WORK;ENCODING=QUOTED-PRINTABLE:KW-C218B=0D=0AP.O. Box 8=0D=0ASchenectady, New York 12301=0D=0AUSA EMAIL;PREF;INTERNET:millerjv@crd.ge.com REV:20010420T140329Z END:VCARD ------_=_NextPart_000_01C16601.547F8BD0-- From bill.hoffman@kitware.com Tue Nov 6 13:47:28 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Tue, 06 Nov 2001 09:47:28 -0400 Subject: [Cmake] AddCustomCommand Message-ID: <5.0.2.1.0.20011106094514.08088398@pop.nycap.rr.com> I changed the unix makefile generator so that it uses full paths to source files. This should allow out-of-source builds without gnu make. As a side effect of that change, the AddCustomCommand function now requires a full path to the output files. I have tested the VTK wrapping commands, but not the QT one. Could one of the QT users try it? Thanks. -Bill From p.pritchett@2d3.com Tue Nov 6 16:41:30 2001 From: p.pritchett@2d3.com (Phil Pritchett) Date: Tue, 6 Nov 2001 16:41:30 -0000 Subject: [Cmake] including external projects Message-ID: <609562B7721BD41187B400B0D0208560856BDE@FILESERV> I have now added the INCLUDE_EXTERNAL_MSPROJECT command to the cvs repository. Cheers, Phil > -----Original Message----- > From: Phil Pritchett > Sent: Monday, October 29, 2001 12:58 PM > To: Cmake Mailing List (E-mail) > Subject: [Cmake] including external projects > > > I was going to write a command that will allow CMake to > include external MS > projects in a workspace along with a list of dependencies. > Just wanted to > make sure that no one had done this already, or had any objections. > It will look something like : > INCLUDE_EXTERNAL_MSPROJECT(name location dep1 dep2 ...) > > Phil > > > > -----Original Message----- > > From: William A. Hoffman [mailto:bill.hoffman@kitware.com] > > Sent: Friday, October 26, 2001 2:48 PM > > To: Phil Pritchett > > Cc: Cmake Mailing List (E-mail); VXL Mailing List (E-mail) > > Subject: Re: [Cmake] file/project specific compile flags > > > > > > At 10:54 AM 10/26/2001 +0100, Phil Pritchett wrote: > > > > I was thinking. When we created the MSPROJECT_TEMPLATE stuff, there > > where no flags like CMAKE_CXX_FLAGS_DEBUG|RELEASE|RELMINSIZE. > > > > Perhaps the best thing to do is live with the 4 different > builds, but > > customize them for > > each site. The could even be set in a projects > CMakeLists.txt file. > > 4 builds should be enough. > > > > -Bill > > > > > > >o CMakeWindowSystemConfig.cmake is always taken from the > system CMake > > >Templates directory rather than the one specified by > > >MSPROJECT_TEMPLATE_DIRECTORY. is this the correct behaviour ? > > >o even though you can add build types to the various MS > > templates the search > > >and replace used to generated the project files is > hardcoded in, so I > > >couldn't add CMAKE_CXX_FLAGS_MYBUILD into the project templates. > > > > This e-mail, and any attachment, is confidential. If you have > received it in > error, please delete it from your system, do not use or disclose the > information in any way, and notify me immediately. > _______________________________________________ > Cmake mailing list > Cmake@public.kitware.com > http://public.kitware.com/mailman/listinfo/cmake > This e-mail, and any attachment, is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify me immediately. From bettingf@cs.man.ac.uk Tue Nov 6 20:31:03 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Tue, 6 Nov 2001 20:31:03 +0000 Subject: [Cmake] AddCustomCommand In-Reply-To: <5.0.2.1.0.20011106094514.08088398@pop.nycap.rr.com> References: <5.0.2.1.0.20011106094514.08088398@pop.nycap.rr.com> Message-ID: <01110620310307.29675@gwa12> Your changes seems to work correctly with QT too. I've also changed the QT wrap cpp so that it also clears the generated moc files when "make clean" is called. Franck On Tuesday 06 November 2001 13:47, Bill Hoffman wrote: > I changed the unix makefile generator so that it uses full paths to source > files. This should allow out-of-source builds without gnu make. As a side > effect of that change, the AddCustomCommand function now requires a full > path to the output files. I have tested the VTK wrapping commands, but not > the QT one. Could one of the QT users try it? Thanks. > > -Bill > From volpecr@crd.ge.com Tue Nov 6 22:39:51 2001 From: volpecr@crd.ge.com (Volpe, Christopher R (CRD)) Date: Tue, 6 Nov 2001 17:39:51 -0500 Subject: [Cmake] Generating browse info Message-ID: Ok, I suspect this has come up before, but I'm looking over the messages I've received since joining the mailing list, and I don't see anything that *directly* relates to this. What some co-workers of mine and I would like is a way to specify the generation of browse information (/FR compiler flag) for all the user's source code (i.e. non-generated source code, e.g. TCL wrapper files). Now, unfortunately, if I create a LocalUserOptions.cmake file in, say, the "Common" folder and do "SET(CMAKE_CXX_FLAGS /FR)", CMake will use that in both vtkCommon and vtkCommonTCL. I'd like to be able to do this such that the browse information is turned on ONLY in vtkCommon (and other non-wrapper project trees). Is there a way to do this with the existing CMake, and if not, is there any proposed functionality currently under discussion that would enable this? thanks, Chris > GE Corporate Research & Development > ___________________________________________________________________________________________________ > _______________________________________________ > Christopher R. Volpe Computer Scientist Visualization and Computer Vision Program / Electronic Systems Lab Bldg KW, Room C215 P.O. Box 8, Schenectady, NY 12301 (518) 387-7766, Dial Comm: 8*833-7766, Fax: (518) 387-6981 e-mail: volpecr@crd.ge.com web: http://www.crd.ge.com/~volpecr From sebastien@barre.nom.fr Thu Nov 8 15:31:56 2001 From: sebastien@barre.nom.fr (Sebastien BARRE) Date: Thu, 08 Nov 2001 10:31:56 -0500 Subject: [Cmake] bug in cmDSWWriter In-Reply-To: Message-ID: <5.1.0.14.2.20011108102646.01f97008@pop.fr.clara.net> cmDSWWriter does not seem to take into account custom targets that were added with the ALL flag: ADD_CUSTOM_TARGET(Name [ALL] command arg arg arg ...) The ALL option is optional. If it is specified it indicates that this target should be added to the build all target. You can reproduce it by locally changing: ADD_CUSTOM_TARGET(DoxygenDoc to ADD_CUSTOM_TARGET(DoxygenDoc ALL in CMake\Utilities\Doxygen\CMakeLists.txt run Cmake. In Cmake.dsw, look at: Project: "ALL_BUILD"=.\ALL_BUILD.dsp - Package Owner=<4> you won't see DoxygenDoc It might have something to do with code in cmDSWWriter.cxx located below that comment: // if this is the special ALL_BUILD utility, then // make it depend on every other non UTILITY project. // This is done by adding the names to the GetUtilities // vector on the makefile Am I missing something ? From jordan.howarth@cmis.csiro.au Fri Nov 9 10:27:02 2001 From: jordan.howarth@cmis.csiro.au (Jordan) Date: Fri, 9 Nov 2001 21:27:02 +1100 (EST) Subject: [Cmake] Mimicking directory structure in workspace fileview Message-ID: <15339.43353.551888.342533@pride.nsw.cmis.CSIRO.AU> Great tool!! My team has been developing in MSDEV for the last year and we are now considering cross-platform development. CMake appears to provided all the platform independence we require in the build process. One feature of the MSDEV workspace we have found invaluable is the ability to create folders within projects (not Workspace) so that the fileview structure in the workspace window is identical to the actual file structure on disk. If this is the actual file structure: School |-- CMakeLists.txt |-- Classroom | |-- CMakeLists.txt | `-- Teacher | |-- Student | | |-- student.cpp | | `-- student.h | |-- teacher.cpp | `-- teacher.h `-- Head |-- CMakeLists.txt `-- main.cpp and this is School/Classroom/CMakeLists.txt: ADD_LIBRARY(classroom STATIC teach room) AUX_SOURCE_DIRECTORY(Teacher teach) AUX_SOURCE_DIRECTORY(Teacher/Student room) then is there a CMake command that allows this same structure to appear in the workspace view. At present CMake produces a workspace containing the MSDEV "projects" Classroom and Head, with the corresponding .cpp files stored in a "Source Files" folder. BTW, is there an exhaustive tutorial or available assortment of CMakeLists.txt (other than in CMake.pdf) to show how all the CMake commands can be used, and thereby fast track new and enthusiastic users like myself. ;) Regards, J. -- Jordan Howarth mailto:jordan.howarth@cmis.csiro.au CSIRO p: (07) 3375 9632, (07) 3826 7314 Mathematical and Information Sciences f: (07) 3826 7304 -=| For every truth there are a thousand lies |=- From bettingf@cs.man.ac.uk Fri Nov 9 18:07:00 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Fri, 9 Nov 2001 18:07:00 +0000 Subject: [Cmake] Compilation of user interface files Message-ID: <01110918070000.24117@gwa12> Hi, I've added compilation of .ui files to cmake (files created with the designer tool included in Qt distributions). It uses the QT_WRAP_UI command to generate headers (.h) and source files (.cxx). The headers file should then be compiled into moc files using QT_WRAP_CPP. For instance if you have a list of files called project_ui_files containing .ui source files you have to write : QT_WRAP_UI( project project_h_files project_cxx_files project_ui_files ) QT_WRAP_CPP( project project_moc_files project_h_files ) in that order. I've tested it using linux and it works fine. Can anyone who is using designer test it with Windows ? Franck From sebastien.barre@kitware.com Fri Nov 9 21:09:12 2001 From: sebastien.barre@kitware.com (Sebastien BARRE) Date: Fri, 09 Nov 2001 16:09:12 -0500 Subject: [Cmake] Using ADD_CUSTOM_COMMAND: self-pack exes or dlls In-Reply-To: <01110918070000.24117@gwa12> Message-ID: <5.1.0.14.2.20011109153148.02ee4890@pop.fr.clara.net> --=====================_196331680==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed Hi CMake users, Ken has just modified the DSW writer so that it supports custom commands created using ADD_CUSTOM_COMMAND and attached to libs or exes through the SOURCE parameter. In that specific case the custom command is triggered as a post-build command by nmake. I've reimplemented this command code and thus slightly changed the command usage to: "ADD_CUSTOM_COMMAND(SOURCE source COMMAND command TARGET target " "[ARGS [args...]] [DEPENDS [depends...]] [OUTPUTS [outputs...]])\n" "Add a custom command."; I've successfully used it to automatically propagate a DLL to several directories everytime it is rebuilt. Here is a another (typical) example demonstrating how to self-pack an executable everytime it is rebuilt (i.e. same exe but decompressed on-the-fly). This example self-packs CMakeSetup.exe to 30% of its size with upx (548 Ko to 127 Ko for the 'Release' build). You need UPX, a 87 Ko free command-line self-packer (http://wildsau.idv.uni-linz.ac.at/mfx/upx.html). It can be used to self-pack DLL too. Add these lines to the end of CMake\Source\MFCDialog\CMakeLists.txt OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF) IF (SELF_PACK_EXECUTABLES) INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake) IF (SELF_PACKER_FOR_EXECUTABLE) IF (WIN32) ADD_CUSTOM_COMMAND( SOURCE CMakeSetup COMMAND ${SELF_PACKER_FOR_EXECUTABLE} ARGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${EXECUTABLE_OUTPUT_PATH}/$(INTDIR)/CMakeSetup.exe TARGET CMakeSetup) ENDIF (WIN32) ENDIF (SELF_PACKER_FOR_EXECUTABLE) ENDIF (SELF_PACK_EXECUTABLES) - The FindSelfPackers.cmake (see CVS) module looks for a self-packer (SELF_PACKER_FOR_EXECUTABLE and SELF_PACKER_FOR_SHARED_LIB) and the according flags). - The custom command is attached to the exe post-build steps by using the target name as the SOURCE parameter (of course, TARGET should also be set to this value). Of course it does not make a lot of sense if you self-pack your Debug executables. You might focus on packing the release build (for quick distribution purposes for example). Here is a hack: instead of launching the packer it launches a shell that tests for the $(INTDIR) var. But you need a unix-like shell (cygwin bash) as I was not able to figure out if command.exe is able to interpret a string instead of executing a batch or entering in interactive mode. Hence, if you use bash you can not use $(INTDIR) to specify the path to the executable to compress (as it use a '/'). But since we know the INTDIR value (here, './Release') it's not that important. It's a hack anyway :) OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF) IF (SELF_PACK_EXECUTABLES) INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake) IF (SELF_PACKER_FOR_EXECUTABLE) IF (WIN32) INCLUDE(${CMAKE_ROOT}/Modules/FindUnixCommands.cmake) IF (BASH) ADD_CUSTOM_COMMAND( SOURCE CMakeSetup COMMAND ${BASH} ARGS "-c" "if test 'x$(INTDIR)' == 'x.\\Release'; then ${SELF_PACKER_FOR_EXECUTABLE} ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${EXECUTABLE_OUTPUT_PATH}/Release/CMakeSetup.exe; fi" TARGET CMakeSetup) ENDIF (BASH) ENDIF (WIN32) ENDIF (SELF_PACKER_FOR_EXECUTABLE) ENDIF (SELF_PACK_EXECUTABLES) Just my 2 cents -- Sebastien Barre --=====================_196331680==_.ALT Content-Type: text/html; charset="us-ascii" Hi CMake users,

Ken has just modified the DSW writer so that it supports custom commands created using ADD_CUSTOM_COMMAND and attached to libs or exes through the SOURCE parameter. In that specific case the custom command is triggered as a post-build command by nmake.

I've reimplemented this command code and thus slightly changed the command usage to:

      "ADD_CUSTOM_COMMAND(SOURCE source COMMAND command TARGET target "
      "[ARGS [args...]] [DEPENDS [depends...]] [OUTPUTS [outputs...]])\n"
      "Add a custom command.";

I've successfully used it to automatically propagate a DLL to several directories everytime it is rebuilt.

Here is a another (typical) example demonstrating how to self-pack an executable everytime it is rebuilt (i.e. same exe but decompressed on-the-fly).

This example self-packs CMakeSetup.exe to 30% of its size with upx (548 Ko to 127 Ko for the 'Release' build). You need UPX, a 87 Ko free command-line self-packer (http://wildsau.idv.uni-linz.ac.at/mfx/upx.html). It can be used to self-pack DLL too.

Add these lines to the end of CMake\Source\MFCDialog\CMakeLists.txt

OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF)

IF (SELF_PACK_EXECUTABLES)
  INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake)
  IF (SELF_PACKER_FOR_EXECUTABLE)
    IF (WIN32)
      ADD_CUSTOM_COMMAND(
          SOURCE CMakeSetup
          COMMAND ${SELF_PACKER_FOR_EXECUTABLE}
          ARGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS}
               ${EXECUTABLE_OUTPUT_PATH}/$(INTDIR)/CMakeSetup.exe
          TARGET CMakeSetup)
    ENDIF (WIN32)
  ENDIF (SELF_PACKER_FOR_EXECUTABLE)
ENDIF (SELF_PACK_EXECUTABLES)

- The FindSelfPackers.cmake (see CVS) module looks for a self-packer (SELF_PACKER_FOR_EXECUTABLE and SELF_PACKER_FOR_SHARED_LIB) and the according flags).

- The custom command is attached to the exe post-build steps by using the target name as the SOURCE parameter (of course, TARGET should also be set to this value).

Of course it does not make a lot of sense if you self-pack your Debug executables. You might focus on packing the release build (for quick distribution purposes for example). Here is a hack: instead of launching the packer it launches a shell that tests for the $(INTDIR) var. But you need a unix-like shell (cygwin bash) as I was not able to figure out if command.exe is able to interpret a string instead of executing a batch or entering in interactive mode. Hence, if you use bash you can not use $(INTDIR) to specify the path to the executable to compress (as it use a '/'). But since we know the INTDIR value (here, './Release') it's not that important. It's a hack anyway :)

OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF)

IF (SELF_PACK_EXECUTABLES)
  INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake)
  IF (SELF_PACKER_FOR_EXECUTABLE)
    IF (WIN32)
      INCLUDE(${CMAKE_ROOT}/Modules/FindUnixCommands.cmake)
      IF (BASH)
        ADD_CUSTOM_COMMAND(
          SOURCE CMakeSetup
          COMMAND ${BASH}
          ARGS "-c" "if test 'x$(INTDIR)' == 'x.\\Release'; then ${SELF_PACKER_FOR_EXECUTABLE} ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${EXECUTABLE_OUTPUT_PATH}/Release/CMakeSetup.exe; fi"
          TARGET CMakeSetup)
      ENDIF (BASH)
    ENDIF (WIN32)
  ENDIF (SELF_PACKER_FOR_EXECUTABLE)
ENDIF (SELF_PACK_EXECUTABLES)

Just my 2 cents

--
Sebastien Barre --=====================_196331680==_.ALT-- From jordan.howarth@cmis.csiro.au Mon Nov 12 05:07:36 2001 From: jordan.howarth@cmis.csiro.au (Jordan Howarth) Date: Mon, 12 Nov 2001 15:07:36 +1000 Subject: [Cmake] license Message-ID: <15343.22808.929472.632001@rainy.stormgreen.org.au> Hi, I cannot find details that define the license required to use CMake or more importantly, the restrictions on its use in the production of a commercial product. Has this been clarified? J. From bill.hoffman@kitware.com Mon Nov 12 13:12:30 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 12 Nov 2001 09:12:30 -0400 Subject: [Cmake] license In-Reply-To: <15343.22808.929472.632001@rainy.stormgreen.org.au> Message-ID: <5.0.2.1.0.20011112091042.0815c570@pop.nycap.rr.com> The license can be found in the source code. It is a BSD style license, so you are free to use it in a commercial produce if you like. Here is a copy of the license: /*========================================================================= Copyright (c) 2001 Insight Consortium All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the Insight Consortium, nor the names of any consortium members, nor of any contributors, may be used to endorse or promote products derived from this software without specific prior written permission. * Modified source versions must be plainly marked as such, and must not be misrepresented as being the original software. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =========================================================================*/ At 03:07 PM 11/12/2001 +1000, Jordan Howarth wrote: >Hi, > >I cannot find details that define the license required to use CMake or more >importantly, the restrictions on its use in the production of a commercial >product. > >Has this been clarified? > >J. > > > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From bettingf@cs.man.ac.uk Mon Nov 12 16:31:35 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Mon, 12 Nov 2001 16:31:35 +0000 Subject: [Cmake] dependencies Message-ID: <01111216313500.01999@gwa12> Hi, I tried to add a dependency that was not automatically generated by cmake in a CMakeList.txt using the command: ADD_DEPENDENCIES(drawingimpl.cxx ${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) Apparently it doesn't change anything in the generated Makefile (at least on linux). Anyone has any idea why it does this, or how can I add a user defined dependency ? Cheers, Franck From bill.hoffman@kitware.com Mon Nov 12 17:21:52 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 12 Nov 2001 13:21:52 -0400 Subject: [Cmake] dependencies In-Reply-To: <01111216313500.01999@gwa12> Message-ID: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> The ADD_DEPENDENCIES command is only used to add dependencies between one executable and another. Regular build dependencies are handled automatically. If drawingimpl.cxx includes drawing.h the depend should be in cmake.depends. -Bill At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote: >Hi, > >I tried to add a dependency that was not automatically generated by cmake in >a CMakeList.txt using the command: > >ADD_DEPENDENCIES(drawingimpl.cxx >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) > >Apparently it doesn't change anything in the generated Makefile (at least on >linux). Anyone has any idea why it does this, or how can I add a user defined >dependency ? > >Cheers, >Franck >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From bettingf@cs.man.ac.uk Mon Nov 12 19:23:53 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Mon, 12 Nov 2001 19:23:53 +0000 Subject: [Cmake] dependencies In-Reply-To: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> References: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> Message-ID: <01111219235305.01999@gwa12> Hi Bill, In fact it's not as easy as that. The file drawingimpl.cxx include drawingimpl.h and drawingimpl.h includes drawing.h So drawing.h is not in the cmake.depends file, but drawingimpl.h is. Unfortunately, as there is no make rule for drawingimpl.h, there's no link to drawing.h in cmake.depends. Furthermore, if I include drawing.h in drawingimpl.h, I can only find drawing.h in cmake.depends if I use the syntax : #include Other syntaxes like #include "drawing.h" or #include don't work. In the case I use the first syntax, I have the line : drawing.h \ in cmake.depends. The "make" utility doesn't seem to be able to match that to the full path name as used in the rule for creating drawing.h in Makefile (certainly because drawing.h is not in the source directory but in the object directory because it is a generated file). I can change this rule to use only the name of the file, but I would like a proper solution with the full pathname as it might be a problem if it's used in a library, and also for consistency with the rest of the Makefile. Furthermore I don't know if this patchy solution would be crossplatform. Concerning ADD_DEPENDENCIES, I think it's strange to have to link executable. What we would certainly need is the possiblitity of linking generated files. And it's the way I've (mis)understood the command. Franck On Monday 12 November 2001 17:21, Bill Hoffman wrote: > The ADD_DEPENDENCIES command is only used to add dependencies between one > executable and another. Regular build dependencies are handled > automatically. > > If drawingimpl.cxx includes drawing.h the depend should be in > cmake.depends. > > -Bill > > At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote: > >Hi, > > > >I tried to add a dependency that was not automatically generated by cmake > > in a CMakeList.txt using the command: > > > >ADD_DEPENDENCIES(drawingimpl.cxx > >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) > > > >Apparently it doesn't change anything in the generated Makefile (at least > > on linux). Anyone has any idea why it does this, or how can I add a user > > defined dependency ? > > > >Cheers, > >Franck > >_______________________________________________ > >Cmake mailing list > >Cmake@public.kitware.com > >http://public.kitware.com/mailman/listinfo/cmake > > _______________________________________________ > Cmake mailing list > Cmake@public.kitware.com > http://public.kitware.com/mailman/listinfo/cmake From bill.hoffman@kitware.com Mon Nov 12 19:01:18 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 12 Nov 2001 15:01:18 -0400 Subject: [Cmake] dependencies In-Reply-To: <01111219235305.01999@gwa12> References: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> Message-ID: <5.0.2.1.0.20011112145142.07f65238@pop.nycap.rr.com> OK, I think I figured out what might work for you. In your command to generate the .h file use the following method: cmMakefile::AddCMakeDependFile to add the generated .h file to the list of things that the makefile depends on. This will cause the following rule: cmake.depends : path/to/your/file.h and since, you have a rule: path/to/your/file.h: moc > path/to/your/file.h It will cause it to be generated before the depend step is run. As for < vs. " for includes I am not sure what is wrong there. -Bill At 07:23 PM 11/12/2001 +0000, Franck Bettinger wrote: >Hi Bill, > >In fact it's not as easy as that. >The file drawingimpl.cxx include drawingimpl.h and drawingimpl.h includes >drawing.h >So drawing.h is not in the cmake.depends file, but drawingimpl.h is. >Unfortunately, as there is no make rule for drawingimpl.h, there's no link to >drawing.h in cmake.depends. > >Furthermore, if I include drawing.h in drawingimpl.h, I can only find >drawing.h in cmake.depends if I use the syntax : >#include > >Other syntaxes like >#include "drawing.h" >or >#include >don't work. > >In the case I use the first syntax, I have the line : >drawing.h \ >in cmake.depends. > >The "make" utility doesn't seem to be able to match that to the full path >name as used in the rule for creating drawing.h in Makefile (certainly >because drawing.h is not in the source directory but in the object directory >because it is a generated file). >I can change this rule to use only the name of the file, but I would like a >proper solution with the full pathname as it might be a problem if it's used >in a library, and also for consistency with the rest of the Makefile. >Furthermore I don't know if this patchy solution would be crossplatform. > >Concerning ADD_DEPENDENCIES, I think it's strange to have to link executable. >What we would certainly need is the possiblitity of linking generated files. >And it's the way I've (mis)understood the command. > >Franck > > >On Monday 12 November 2001 17:21, Bill Hoffman wrote: >> The ADD_DEPENDENCIES command is only used to add dependencies between one >> executable and another. Regular build dependencies are handled >> automatically. >> >> If drawingimpl.cxx includes drawing.h the depend should be in >> cmake.depends. >> >> -Bill >> >> At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote: >> >Hi, >> > >> >I tried to add a dependency that was not automatically generated by cmake >> > in a CMakeList.txt using the command: >> > >> >ADD_DEPENDENCIES(drawingimpl.cxx >> >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) >> > >> >Apparently it doesn't change anything in the generated Makefile (at least >> > on linux). Anyone has any idea why it does this, or how can I add a user >> > defined dependency ? >> > >> >Cheers, >> >Franck >> >_______________________________________________ >> >Cmake mailing list >> >Cmake@public.kitware.com >> >http://public.kitware.com/mailman/listinfo/cmake >> >> _______________________________________________ >> Cmake mailing list >> Cmake@public.kitware.com >> http://public.kitware.com/mailman/listinfo/cmake > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From brad.king@kitware.com Mon Nov 12 20:52:24 2001 From: brad.king@kitware.com (Brad King) Date: Mon, 12 Nov 2001 15:52:24 -0500 (EST) Subject: [Cmake] dependencies In-Reply-To: <5.0.2.1.0.20011112145142.07f65238@pop.nycap.rr.com> Message-ID: Franck, After Bill sent you the AddCMakeDependFile solution, we realized that it will cause problems with .DSP files in windows reloading during every build. It would probably work okay for unix, but the annoyance in windows means it should not be used. I have just checked in a change that should allow a "dependency hint" mechanism to solve your proplem. In your command, add to the cmSourceFile instance the full path to the header in its depends member. For example: cmSourceFile file; // ... setup source file ... // Add dependency hint to missing file. file.GetDepends().push_back(pathToDrawingDotH); This will cause the UNIX dependency generator to add the proper path even though the file doesn't exist. If the .h does exist when the dependency generator is run, the hint will not hurt anything, and the full set of dependencies should be generated. I have not tested this, other than a quick check that the change I checked in doesn't break anything else. There may yet be something we haven't considered. Please let us know what happens. -Brad From bettingf@cs.man.ac.uk Tue Nov 13 15:51:27 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Tue, 13 Nov 2001 15:51:27 +0000 Subject: [Cmake] dependencies In-Reply-To: References: Message-ID: <01111315512700.17737@gwa12> Hi Brad, On Monday 12 November 2001 20:52, Brad King wrote: > cmSourceFile file; > // ... setup source file ... > // Add dependency hint to missing file. > file.GetDepends().push_back(pathToDrawingDotH); The last line doesn't change anything in either the generated Makefile or the generated cmake.depends. Do I need to call another function to be able to see the changes ? Actually, I just call the function AddSource : m_Makefile->AddSource(file,m_SourceList.c_str()); Franck From brad.king@kitware.com Tue Nov 13 18:41:02 2001 From: brad.king@kitware.com (Brad King) Date: Tue, 13 Nov 2001 13:41:02 -0500 (EST) Subject: [Cmake] dependencies In-Reply-To: <01111315512700.17737@gwa12> Message-ID: > The last line doesn't change anything in either the generated Makefile > or the generated cmake.depends. Do I need to call another function to > be able to see the changes ? No. There must be something else wrong. If the latest version of your QT wrap commands are not checked in, please send them to me along with an example of what you are trying to build. I'll take a look to see if I can track down the problem. -Brad From bill.hoffman@kitware.com Wed Nov 14 14:02:26 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Wed, 14 Nov 2001 09:02:26 -0500 Subject: [Cmake] ccmake Message-ID: <5.0.2.1.0.20011114085753.03989b18@pop.nycap.rr.com> Berk Geveci at Kitware has implemented a curses interface to cmake. It still needs a few more features, (like help). However, it is functional. You run it just like the command line cmake. For example, mkdir Project-build cd Project-build ccmake ../Project The main idea is for use on UNIX where there is not always a GUI. -Bill From perera@cs.rpi.edu Fri Nov 16 21:40:29 2001 From: perera@cs.rpi.edu (Amitha Perera) Date: Fri, 16 Nov 2001 16:40:29 -0500 Subject: [Cmake] Library link line compression (again) Message-ID: <20011116164029.I76467@cs.rpi.edu> Hi all Would anyone object to adding an option to CMake to allow link line compression? In particular, I think that most projects have a tree like library dependency, and it is possible for CMake to automatically eliminate duplicate libraries without causing linking failures. The default mode would be what it is now, which generates a long link line (for vxl, at least). As the message below indicates, this is probably a useful process, and a good step in lieu of a full dependency analysis. Amitha. ----- Forwarded message from "Christopher D. Carothers" ----- To: Amitha Perera From: "Christopher D. Carothers" Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST) Subject: fyi: static linking needs huge swap space! Folks, to link a static version of online tracining under linux (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in addition to 256 MB of RAM. I watched "top" as the final link was being done and you could just see the vast amount of memory being allocated. I think the reason for this because the link line has duplicates of every lib. Amitha, is there anyway we can cut down on these duplicates and still avoid unresolved symbols. My office machine now has 2 GB of swap :-) Happy compiling! Chris ----- End forwarded message ----- From ian.m.scott@stud.man.ac.uk Mon Nov 19 09:59:04 2001 From: ian.m.scott@stud.man.ac.uk (Ian Scott) Date: Mon, 19 Nov 2001 09:59:04 -0000 Subject: [Cmake] Library link line compression (again) In-Reply-To: <20011116164029.I76467@cs.rpi.edu> Message-ID: <000001c170e0$d2bcd360$22ea5882@ian> Amitha, I had a go at doing this. I gave up because it didn't have any noticible effect on DevStudio's loading or linking speed. I've lost the code, but the algorithm should go something like this Add a function StripLinkLibrariesToTreeDependecy, called under the control of some cache variable from cmMakeFile::FinalPass Method cmMakeFile::StripLinkLibrariesToTreeDependecy Copy sequence of all linklibraries to LL start = Beginning of LL Starting from i = End of LL --i; Get Library L = *i j = i; While (j!= start) j--; if *j = *i remove *j shuffle all previous members (start, j-1) of LL up one ++start; Until i == start; Copy LL back to LinkLibaries. End Alternatively you could put the code in the FinalPass method of a new Command StripLinkLibrariesToTreeDependecy Ian. > -----Original Message----- > From: Amitha Perera [mailto:perera@cs.rpi.edu] > Sent: Friday, November 16, 2001 9:40 PM > To: cmake@public.kitware.com > Cc: chrisc@cs.rpi.edu > Subject: [Cmake] Library link line compression (again) > > > Hi all > > Would anyone object to adding an option to CMake to allow link line > compression? In particular, I think that most projects have a tree > like library dependency, and it is possible for CMake to automatically > eliminate duplicate libraries without causing linking failures. The > default mode would be what it is now, which generates a long link line > (for vxl, at least). > > As the message below indicates, this is probably a useful process, and > a good step in lieu of a full dependency analysis. > > Amitha. > > > ----- Forwarded message from "Christopher D. Carothers" > ----- > > To: Amitha Perera > From: "Christopher D. Carothers" > Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST) > Subject: fyi: static linking needs huge swap space! > > Folks, to link a static version of online tracining under linux > (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in > addition to 256 MB of RAM. I watched "top" as the final link was being > done and you could just see the vast amount of memory being allocated. > > I think the reason for this because the link line has duplicates > of every lib. Amitha, is there anyway we can cut down on > these duplicates > and still avoid unresolved symbols. > > My office machine now has 2 GB of swap :-) > > Happy compiling! > > Chris > > > ----- End forwarded message ----- > _______________________________________________ > Cmake mailing list > Cmake@public.kitware.com > http://public.kitware.com/mailman/listinfo/cmake > From bill.hoffman@kitware.com Mon Nov 19 16:03:06 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 19 Nov 2001 11:03:06 -0500 Subject: [Cmake] Library link line compression (again) In-Reply-To: <000001c170e0$d2bcd360$22ea5882@ian> References: <20011116164029.I76467@cs.rpi.edu> Message-ID: <5.0.2.1.0.20011119105700.035a9e30@pop.nycap.rr.com> This should be done in the CMakeLists.txt files. I don't think cmake should clean them up. What if someone needs two copies of a library on the link line? It does happen in some projects. This is a problem with vxl and its use of cmake, and not cmake itself. The include LibCMakeLink.txt is causing most of the grief. I thought that was going to be removed from VXL anyway? If not, it could be include guarded? IF(VAR) LINK_.... ELSE(VAR) SET(VAR 1) ENDIF(VAR) The other issue is that cmake automatically duplicates all the -l stuff to avoid missing symbols on static links. Perhaps there should be a flag to turn this off? I think it is done only on the unix side. -Bill At 09:59 AM 11/19/2001 +0000, Ian Scott wrote: >Amitha, > >I had a go at doing this. I gave up because it didn't have any noticible >effect on DevStudio's loading or linking speed. I've lost the code, but the >algorithm should go something like this > > > >Add a function StripLinkLibrariesToTreeDependecy, called under the control >of some cache variable from cmMakeFile::FinalPass > >Method cmMakeFile::StripLinkLibrariesToTreeDependecy > Copy sequence of all linklibraries to LL > start = Beginning of LL > Starting from i = End of LL > --i; > Get Library L = *i > j = i; > While (j!= start) > j--; > if *j = *i > remove *j > shuffle all previous members (start, j-1) of LL up one > ++start; > Until i == start; > Copy LL back to LinkLibaries. >End > >Alternatively you could put the code in the FinalPass method of a new >Command StripLinkLibrariesToTreeDependecy > >Ian. > >> -----Original Message----- >> From: Amitha Perera [mailto:perera@cs.rpi.edu] >> Sent: Friday, November 16, 2001 9:40 PM >> To: cmake@public.kitware.com >> Cc: chrisc@cs.rpi.edu >> Subject: [Cmake] Library link line compression (again) >> >> >> Hi all >> >> Would anyone object to adding an option to CMake to allow link line >> compression? In particular, I think that most projects have a tree >> like library dependency, and it is possible for CMake to automatically >> eliminate duplicate libraries without causing linking failures. The >> default mode would be what it is now, which generates a long link line >> (for vxl, at least). >> >> As the message below indicates, this is probably a useful process, and >> a good step in lieu of a full dependency analysis. >> >> Amitha. >> >> >> ----- Forwarded message from "Christopher D. Carothers" >> ----- >> >> To: Amitha Perera >> From: "Christopher D. Carothers" >> Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST) >> Subject: fyi: static linking needs huge swap space! >> >> Folks, to link a static version of online tracining under linux >> (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in >> addition to 256 MB of RAM. I watched "top" as the final link was being >> done and you could just see the vast amount of memory being allocated. >> >> I think the reason for this because the link line has duplicates >> of every lib. Amitha, is there anyway we can cut down on >> these duplicates >> and still avoid unresolved symbols. >> >> My office machine now has 2 GB of swap :-) >> >> Happy compiling! >> >> Chris >> >> >> ----- End forwarded message ----- >> _______________________________________________ >> Cmake mailing list >> Cmake@public.kitware.com >> http://public.kitware.com/mailman/listinfo/cmake >> > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From tarifa@rpi.edu Mon Nov 26 20:16:48 2001 From: tarifa@rpi.edu (Asad A. Abu-Tarif) Date: Mon, 26 Nov 2001 15:16:48 -0500 Subject: [Cmake] IF statement in CMake Message-ID: <004a01c176b7$473fa290$30777180@aisl.rpi.edu> Hi, I started using CMake to control the compilation of my registration package (that uses vtk heavily). In my package, I'm supporting several vtk versions. In my CMakeLists files, I added a value for VTK_VERSION using: SET (VTK_VERSION 3.2 CACHE VALUE "VTK version" ) Now, I would like to use a statement like: IF (VTK_VERSION < 3.2) do some things ELSE ....etc. It seems that IF doesn't accept the 'less than' expression. Is something like this doable in CMake?? Sorry if this is a repeated question. Regards, Asad __________________________________________________ / Asad A. Abu-Tarif \ | Computer Engineering. | | PhD Candidate, Rensselaer Polytechnic Institute (RPI). | | tarifa@rpi.edu | \___________________________________________________/ From bill.hoffman@kitware.com Wed Nov 28 11:45:19 2001 From: bill.hoffman@kitware.com (William A. Hoffman) Date: Wed, 28 Nov 2001 06:45:19 -0500 Subject: [Cmake] IF statement in CMake In-Reply-To: <004a01c176b7$473fa290$30777180@aisl.rpi.edu> Message-ID: <5.0.2.1.0.20011128064418.02b95a78@pop.nycap.rr.com> There is currently no < in the IF. You might be able to use the MATCH in the IF. The MATCH is a regular expression matcher. -Bill At 03:16 PM 11/26/2001 -0500, Asad A. Abu-Tarif wrote: >Hi, >I started using CMake to control the compilation of my >registration package (that uses vtk heavily). >In my package, I'm supporting several vtk versions. >In my CMakeLists files, I added a value for VTK_VERSION >using: >SET (VTK_VERSION 3.2 CACHE VALUE "VTK version" ) > >Now, I would like to use a statement like: >IF (VTK_VERSION < 3.2) > do some things >ELSE ....etc. > >It seems that IF doesn't accept the 'less than' expression. > >Is something like this doable in CMake?? > >Sorry if this is a repeated question. >Regards, >Asad > __________________________________________________ > / Asad A. Abu-Tarif >\ > | Computer Engineering. >| > | PhD Candidate, Rensselaer Polytechnic Institute (RPI). | > | tarifa@rpi.edu >| > \___________________________________________________/ > > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From millerjv@crd.ge.com Wed Nov 28 17:59:07 2001 From: millerjv@crd.ge.com (Miller, James V (CRD)) Date: Wed, 28 Nov 2001 12:59:07 -0500 Subject: [Cmake] How is CMAKE_USE_PTHREADS defined? Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C17836.5FF08590 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C17836.5FF08590" ------_=_NextPart_001_01C17836.5FF08590 Content-Type: text/plain; charset="iso-8859-1" How is the CMAKE_USE_PTHREADS defined by CMake? Does it only appear in the cache for Insight because itkConfigure.h.in has #cmakedefine CMAKE_USE_PTHREADS? If pthreads are used, STL needs an extra symbol defined _PTHREADS so that it will thread safe memory allocation. I added the definition in a CMakeLists.txt file (it may need to be UseITK.cmake or itkCMakeOptions.cmake instead) as a stop gap. But it would seem that CMake should automatically define this symbol if pthreads are being used on a project so that STL will be thread safe. Jim Miller _____________________________________ Visualization & Computer Vision GE Corporate Research & Development Bldg. KW, Room C218B P.O. Box 8, Schenectady NY 12301 millerjv@crd.ge.com < mailto:millerjv@crd.ge.com > (518) 387-4005, Dial Comm: 8*833-4005, Cell: (518) 505-7065, Fax: (518) 387-6981 ------_=_NextPart_001_01C17836.5FF08590 Content-Type: text/html; charset="iso-8859-1"
How is the CMAKE_USE_PTHREADS defined by CMake?  Does it only appear in the cache for Insight because itkConfigure.h.in has #cmakedefine CMAKE_USE_PTHREADS?
 
If pthreads are used, STL needs an extra symbol defined _PTHREADS so that it will thread safe memory allocation.  I added the definition in a CMakeLists.txt file (it may need to be UseITK.cmake or itkCMakeOptions.cmake instead) as a stop gap.  But it would seem that CMake should automatically define this symbol if pthreads are being used on a project so that STL will be thread safe.

Jim Miller
_____________________________________
Visualization & Computer Vision
GE Corporate Research & Development
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv@crd.ge.com <mailto:millerjv@crd.ge.com>

(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981


 
------_=_NextPart_001_01C17836.5FF08590-- ------_=_NextPart_000_01C17836.5FF08590 Content-Type: application/octet-stream; name="Miller, James V (CRD).vcf" Content-Disposition: attachment; filename="Miller, James V (CRD).vcf" BEGIN:VCARD VERSION:2.1 N:Miller;James FN:Miller, James V (CRD) ORG:CRD;ESL TITLE:Computer Scientist TEL;WORK;VOICE:*833-4005 TEL;WORK;VOICE:1 518 387-4005 ADR;WORK:;KW-C218B;P.O. Box 8;Schenectady;New York;12301;USA LABEL;WORK;ENCODING=QUOTED-PRINTABLE:KW-C218B=0D=0AP.O. Box 8=0D=0ASchenectady, New York 12301=0D=0AUSA EMAIL;PREF;INTERNET:millerjv@crd.ge.com REV:20010420T140329Z END:VCARD ------_=_NextPart_000_01C17836.5FF08590-- From ibanez@choroid.cs.unc.edu Thu Nov 29 07:12:13 2001 From: ibanez@choroid.cs.unc.edu (Luis Ibanez) Date: Thu, 29 Nov 2001 02:12:13 -0500 (EST) Subject: [Cmake] Generating code during the build: Fluid FLTK Message-ID: Hi, I'm adding a new command: cmFLTKWrapUICommand It is intended to support the code generation from FLTK .fl files. These files contain the specification of the GUI created interactively with "Fluid". A command like fluid -c -h myGUI.h -o myGUI.cxx myGUI.fl will generate the .h and .cxx files using information from the .fl file. The command is to be used with two SourceList: FLTK_WRAP_UI( FluidGUISourceList GeneratedCxxSourceList) the first source list should contain all the .fl file of the application. When run this command will generate the names for the .cxx and .h files and insert them in the second SourceList. The command was based on cmQTWrapUICommand, but a number of changes where done. In particular concerninng the use of AddCustomCommand(). There is however a problem with the creation of the customCommand in m_Makefile. The method verifies if the target in question already exists or not. In this case the targets are the .cxx and .h generated files. A for that reason this new command is inserting directly the .cxx and .h as targets of the built. In order to support these files as a Type of targets was added to cmTarget: "GENERATED_CODE". A residual problem is appearing with the custom rule for the .h file, its rule is missing in the Makefile (under Linux). It seems that somewhere in the process the fils with .h extension are ignored as targets... The Custom rule for .cxx is working ok. Any suggestions ? Thanks, Luis -- Luis Ibanez CB#: 7060 Research Assistan Professor phone: (919) 843 5436 Division of Neurosurgery fax: (919) 966 6627 University of North Carolina at Chapel Hill email: ibanez@cs.unc.edu Chapel Hill, NC 27599-7060 http://www.cs.unc.edu/~ibanez From bettingf@cs.man.ac.uk Thu Nov 29 08:06:43 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Thu, 29 Nov 2001 08:06:43 +0000 Subject: [Cmake] Generating code during the build: Fluid FLTK In-Reply-To: References: Message-ID: <01112908064300.24137@gwa12> Hi Luis, It appears that the .h file can not be found. As this file does not exist at the time of the target creation, I've added a rule in cmMakeDepend.cxx that also look if the file will not be generated. Unfortunately there was a problem with the matching of the path (since we only know the name of the file itself and not its path). I had to guess the path by looking at the include directories. So you have to add an INCLUDE_DIRECTORIES rule in your CMakeLists.txt that tells cmake where to look for. For instance, with the Qt ui wrapper and vxl, I use a rule like this : INCLUDE_DIRECTORIES( ${allvxl_BINARY_DIR} ) ... QT_WRAP_UI(drawing drawing_ui_headers drawing_ui_sources drawing_interfaces ) and I include the .h file using : #include so that cmMakeDepend.cxx can find that the file ${allvxl_BINARY_DIR}/programs/drawing/drawing.h is in the target list. Beware not to use a "/" at the end of your INCLUDE_DIRECTORIES path because the algorithm append it automatically and two "/" would cause the matching to fail. I hope it helps. Franck On Thursday 29 November 2001 07:12, Luis Ibanez wrote: > Hi, > > I'm adding a new command: cmFLTKWrapUICommand [...] > There is however a problem with the creation of > the customCommand in m_Makefile. The method > verifies if the target in question already > exists or not. In this case the targets > are the .cxx and .h generated files. A for that > reason this new command is inserting directly > the .cxx and .h as targets of the built. > > > In order to support these files as a Type of > targets was added to cmTarget: "GENERATED_CODE". > > A residual problem is appearing with the > custom rule for the .h file, its rule > is missing in the Makefile (under Linux). > It seems that somewhere in the process > the fils with .h extension are ignored as > targets... The Custom rule for .cxx is working > ok. > > > Any suggestions ? > > Thanks, > > Luis -- -- ========================================= Franck BETTINGER PhD student Imaging Science and Biomedical Engineering University of Manchester bettingf@cs.man.ac.uk ========================================== From ken.martin@kitware.com Fri Nov 30 20:50:50 2001 From: ken.martin@kitware.com (Ken Martin) Date: Fri, 30 Nov 2001 15:50:50 -0500 Subject: [Cmake] cmake-mode.el Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_002A_01C179B6.C9399F10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Here is a fairly bad emacs mode for cmake. Maybe someone smarter than I can figure out how to get the: IF (foo) INDENT MWE ENDIF (foo) to work. Thanks Ken -------------------------- Ken Martin, PhD Kitware Inc. 518 371-3971 x101 469 Clifton Corporate Pkwy. Clifton Park, NY 12065 ------=_NextPart_000_002A_01C179B6.C9399F10 Content-Type: application/octet-stream; name="make-regexp.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="make-regexp.el" ;;; make-regexp.el --- generate efficient regexps to match strings.=0A= =0A= ;; Copyright (C) 1994, 1995 Simon Marshall.=0A= =0A= ;; Author: Simon Marshall =0A= ;; Keywords: strings, regexps=0A= ;; Version: 1.02=0A= =0A= ;; LCD Archive Entry:=0A= ;; make-regexp|Simon Marshall|simon@gnu.ai.mit.edu|=0A= ;; Generate efficient regexps to match strings.|=0A= ;; 11-Jul-1995|1.02|~/functions/make-regexp.el.gz|=0A= =0A= ;; The archive is archive.cis.ohio-state.edu in = /pub/gnu/emacs/elisp-archive.=0A= =0A= ;;; This file is not part of GNU Emacs.=0A= =0A= ;;; This program is free software; you can redistribute it and/or modify=0A= ;;; it under the terms of the GNU General Public License as published by=0A= ;;; the Free Software Foundation; either version 2, or (at your option)=0A= ;;; any later version.=0A= =0A= ;;; This program is distributed in the hope that it will be useful,=0A= ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=0A= ;;; GNU General Public License for more details.=0A= =0A= ;;; You should have received a copy of the GNU General Public License=0A= ;;; along with GNU Emacs; see the file COPYING. If not, write to=0A= ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.=0A= =0A= ;;; Commentary:=0A= =0A= ;; Purpose:=0A= ;;=0A= ;; To make efficient regexps from lists of strings.=0A= =0A= ;; For example:=0A= ;;=0A= ;; (let ((strings '("cond" "if" "while" "let\\*?" "prog1" "prog2" "progn"=0A= ;; "catch" "throw" "save-restriction" "save-excursion"=0A= ;; "save-window-excursion" "save-match-data"=0A= ;; "unwind-protect" "condition-case" "track-mouse")))=0A= ;; (concat "(" (make-regexp strings t)))=0A= ;;=0A= ;; =3D> = "(\\(c\\(atch\\|ond\\(\\|ition-case\\)\\)\\|if\\|let\\*?\\|prog[12n]\\|sa= ve-\\(excursion\\|match-data\\|restriction\\|window-excursion\\)\\|t\\(hr= ow\\|rack-mouse\\)\\|unwind-protect\\|while\\)"=0A= ;;=0A= ;; To search for the above regexp takes about 70% of the time as for the = simple=0A= ;; (concat "(\\(" (mapconcat 'identity strings "\\|") "\\)") regexp.=0A= ;;=0A= ;; Obviously, the more the similarity between strings, the faster the = regexp:=0A= ;;=0A= ;; (make-regexp '("abort" "abs" "accept" "access" "array" "begin" "body" = "case"=0A= ;; "constant" "declare" "delay" "delta" "digits" "else" = "elsif"=0A= ;; "entry" "exception" "exit" "function" "generic" = "goto" "if"=0A= ;; "others" "limited" "loop" "mod" "new" "null" "out" = "subtype"=0A= ;; "package" "pragma" "private" "procedure" "raise" = "range"=0A= ;; "record" "rem" "renames" "return" "reverse" "select"=0A= ;; "separate" "task" "terminate" "then" "type" "when" = "while"=0A= ;; "with" "xor"))=0A= ;;=0A= ;; =3D> = "a\\(b\\(ort\\|s\\)\\|cce\\(pt\\|ss\\)\\|rray\\)\\|b\\(egin\\|ody\\)\\|c\= \(ase\\|onstant\\)\\|d\\(e\\(clare\\|l\\(ay\\|ta\\)\\)\\|igits\\)\\|e\\(l= s\\(e\\|if\\)\\|ntry\\|x\\(ception\\|it\\)\\)\\|function\\|g\\(eneric\\|o= to\\)\\|if\\|l\\(imited\\|oop\\)\\|mod\\|n\\(ew\\|ull\\)\\|o\\(thers\\|ut= \\)\\|p\\(ackage\\|r\\(agma\\|ivate\\|ocedure\\)\\)\\|r\\(a\\(ise\\|nge\\= )\\|e\\(cord\\|m\\|names\\|turn\\|verse\\)\\)\\|s\\(e\\(lect\\|parate\\)\= \|ubtype\\)\\|t\\(ask\\|erminate\\|hen\\|ype\\)\\|w\\(h\\(en\\|ile\\)\\|i= th\\)\\|xor"=0A= ;;=0A= ;; To search for the above regexp takes less than 60% of the time of the = simple=0A= ;; mapconcat equivalent.=0A= ;;=0A= ;; But even small regexps may be worth it:=0A= ;;=0A= ;; (make-regexp '("and" "at" "do" "end" "for" "in" "is" "not" "of" "or" = "use"))=0A= ;; =3D> "a\\(nd\\|t\\)\\|do\\|end\\|for\\|i[ns]\\|not\\|o[fr]\\|use"=0A= ;;=0A= ;; as this is 10% faster than the mapconcat equivalent.=0A= =0A= ;; Installation:=0A= ;; =0A= ;; (autoload 'make-regexp "make-regexp"=0A= ;; "Return a regexp to match a string item in STRINGS.")=0A= ;;=0A= ;; (autoload 'make-regexps "make-regexp"=0A= ;; "Return a regexp to REGEXPS.")=0A= ;;=0A= ;; Since these functions were written to produce efficient regexps, not = regexps=0A= ;; efficiently, it is probably not a good idea to in-line too many calls = in=0A= ;; your code, unless you use the following neat trick with = `eval-when-compile':=0A= ;;=0A= ;; (defvar definition-regexp=0A= ;; (let ((regexp (eval-when-compile=0A= ;; (make-regexp '("defun" "defsubst" "defmacro" = "defalias"=0A= ;; "defvar" "defconst" "defadvice") = t))))=0A= ;; (concat "^(" regexp)))=0A= ;;=0A= ;; The `byte-compile' code will be as if you had defined the variable = thus:=0A= ;;=0A= ;; (defvar definition-regexp=0A= ;; = "^(\\(def\\(a\\(dvice\\|lias\\)\\|const\\|macro\\|subst\\|un\\|var\\)\\)"= )=0A= =0A= ;; Feedback:=0A= ;;=0A= ;; Originally written for font-lock, from an idea from Stig's hl319.=0A= ;; Please don't tell me that it doesn't produce optimal regexps; I know = that=0A= ;; already. But (ideas or) code to improve things (are) is welcome. = Please=0A= ;; test your code and tell me the speed up in searching an appropriate = buffer.=0A= ;;=0A= ;; Please send me bug reports, bug fixes, and extensions, etc.=0A= ;; Simon Marshall =0A= =0A= ;; History:=0A= ;;=0A= ;; 1.00--1.01:=0A= ;; - Made `make-regexp' take `lax' to force top-level parentheses.=0A= ;; - Fixed `make-regexps' for MATCH bug and new `font-lock-keywords'.=0A= ;; - Added `unfontify' to user timing functions.=0A= ;; 1.01--1.02:=0A= ;; - Made `make-regexp' `let' a big `max-lisp-eval-depth'.=0A= =0C=0A= ;; The basic idea is to find the shortest common non-"" prefix each = time, and=0A= ;; squirrel it out. If there is no such prefix, we divide the list into = two so=0A= ;; that (at least) one half will have at least a one-character common = prefix.=0A= =0A= ;; In addition, we (a) delay the addition of () parenthesis as long as = possible=0A= ;; (until we're sure we need them), and (b) try to squirrel out = one-character=0A= ;; sequences (so we can use [] rather than ()).=0A= =0A= (defun make-regexp (strings &optional paren lax)=0A= "Return a regexp to match a string item in STRINGS.=0A= If optional PAREN non-nil, output regexp parentheses around returned = regexp.=0A= If optional LAX non-nil, don't output parentheses if it doesn't require = them.=0A= Merges keywords to avoid backtracking in Emacs' regexp matcher."=0A= (let* ((max-lisp-eval-depth (* 1024 1024))=0A= (strings (let ((l strings)) ; Paranoia---make strings unique!=0A= (while l (setq l (setcdr l (delete (car l) (cdr l)))))=0A= (sort strings 'string-lessp)))=0A= (open-paren (if paren "\\(" "")) (close-paren (if paren "\\)" ""))=0A= (open-lax (if lax "" open-paren)) (close-lax (if lax "" close-paren))=0A= (completion-ignore-case nil))=0A= (cond=0A= ;; If there's only one string, just return it.=0A= ((=3D (length strings) 1)=0A= (concat open-lax (car strings) close-lax))=0A= ;; If there's an empty string, pull it out.=0A= ((string=3D (car strings) "")=0A= (if (and (=3D (length strings) 2) (=3D (length (nth 1 strings)) 1))=0A= (concat open-lax (nth 1 strings) "?" close-lax)=0A= (concat open-paren "\\|" (make-regexp (cdr strings)) close-paren)))=0A= ;; If there are only one-character strings, make a [] list instead.=0A= ((=3D (length strings) (apply '+ (mapcar 'length strings)))=0A= (concat open-lax "[" (mapconcat 'identity strings "") "]" = close-lax))=0A= (t=0A= ;; We have a list of strings. Is there a common prefix?=0A= (let ((prefix (try-completion "" (mapcar 'list strings))))=0A= (if (> (length prefix) 0)=0A= ;; Common prefix! Squirrel it out and recurse with the suffixes.=0A= (let* ((len (length prefix))=0A= (sufs (mapcar '(lambda (str) (substring str len)) strings)))=0A= (concat open-paren prefix (make-regexp sufs t t) close-paren))=0A= ;; No common prefix. Is there a one-character sequence?=0A= (let ((letters (let ((completion-regexp-list '("^.$")))=0A= (all-completions "" (mapcar 'list strings)))))=0A= (if (> (length letters) 1)=0A= ;; Do the one-character sequences, then recurse on the rest.=0A= (let ((rest (let ((completion-regexp-list '("^..+$")))=0A= (all-completions "" (mapcar 'list strings)))))=0A= (concat open-paren=0A= (make-regexp letters) "\\|" (make-regexp rest)=0A= close-paren))=0A= ;; No one-character sequence, so divide the list into two by=0A= ;; dividing into those that start with a particular letter, and=0A= ;; those that do not.=0A= (let* ((char (substring (car strings) 0 1))=0A= (half1 (all-completions char (mapcar 'list strings)))=0A= (half2 (nthcdr (length half1) strings)))=0A= (concat open-paren=0A= (make-regexp half1) "\\|" (make-regexp half2)=0A= close-paren))))))))))=0A= =0C=0A= ;; This stuff is realy for font-lock...=0A= =0A= ;; Ahhh, the wonders of lisp...=0A= (defun regexp-span (regexp &optional start)=0A= "Return the span or depth of REGEXP.=0A= This means the number of \"\\\\(...\\\\)\" pairs in REGEXP, optionally = from START."=0A= (let ((match (string-match (regexp-quote "\\(") regexp (or start 0))))=0A= (if (not match) 0 (1+ (regexp-span regexp (match-end 0))))))=0A= =0A= ;; The basic idea is to concat the regexps together, keeping count of = the span=0A= ;; of the regexps so that we can get the correct match for hilighting.=0A= (defun make-regexps (&rest regexps)=0A= "Return a regexp to match REGEXPS=0A= Each item of REGEXPS should be of the form:=0A= =0A= STRING ; A STRING to be used literally.=0A= (STRING MATCH FACE DATA) ; Match STRING at depth MATCH = with FACE=0A= ; and highlight according to = DATA.=0A= (STRINGS FACE DATA) ; STRINGS is a list of strings = FACE is=0A= ; to highlight according to DATA.=0A= =0A= Returns a list of the form:=0A= =0A= (REGEXP (MATCH FACE DATA) ...)=0A= =0A= For example:=0A= =0A= (make-regexps \"^(\"=0A= '((\"defun\" \"defalias\" \"defsubst\" \"defadvice\") = keyword)=0A= \"[ \t]*\"=0A= '(\"\\\\([a-zA-Z-]+\\\\)?\" 1 function-name nil t))=0A= =0A= =3D>=0A= =0A= (\"^(\\\\(def\\\\(a\\\\(dvice\\\\|lias\\\\)\\\\|subst\\\\|un\\\\)\\\\)[ = ]*\\\\([a-zA-Z-]+\\\\)?\"=0A= (1 keyword) (4 function-name nil t))=0A= =0A= Uses `make-regexp' to make efficient regexps."=0A= (let ((regexp "") (data ()))=0A= (while regexps=0A= (cond ((stringp (car regexps))=0A= (setq regexp (concat regexp (car regexps))))=0A= ((stringp (nth 0 (car regexps)))=0A= (setq data (cons (cons (+ (regexp-span regexp)=0A= (nth 1 (car regexps)))=0A= (nthcdr 2 (car regexps)))=0A= data)=0A= regexp (concat regexp (nth 0 (car regexps)))))=0A= (t=0A= (setq data (cons (cons (1+ (regexp-span regexp))=0A= (cdr (car regexps)))=0A= data)=0A= regexp (concat regexp (make-regexp (nth 0 (car regexps))=0A= t)))))=0A= (setq regexps (cdr regexps)))=0A= (cons regexp (nreverse data))))=0A= =0C=0A= ;; Crude-rude timing...=0A= =0A= (defsubst time-seconds (&optional time)=0A= "Return the TIME in seconds, or the current time if not given.=0A= TIME should be the same format as produced by `current-time'."=0A= (let ((time (or time (current-time))))=0A= (+ (* (nth 0 time) 65536.0) (nth 1 time) (/ (nth 2 time) = 1000000.0))))=0A= =0A= (defsubst time-since (time)=0A= "Return the time in seconds since TIME.=0A= TIME should be the value of `current-time' or `time-seconds'."=0A= (- (time-seconds) (if (floatp time) time (time-seconds time))))=0A= =0A= (defun time-function (func &rest args)=0A= "Return the time in seconds taken to execute FUNC with ARGS.=0A= Returned is actually the cons pair (func-value . time)."=0A= (garbage-collect)=0A= (let ((start (time-seconds)))=0A= (cons (apply func args) (time-since start))))=0A= =0A= (defun time-regexps (regexps &optional buffer unfontify)=0A= "Return corresponding list of times to fontify using REGEXPS.=0A= Fontify using BUFFER, if non-nil, and UNFONTIFY first, if non-nil."=0A= (save-excursion=0A= (and buffer (set-buffer buffer))=0A= (let ((beg (point-min)) (end (point-max)))=0A= (and unfontify (font-lock-unfontify-region beg end))=0A= (mapcar (function (lambda (regexp)=0A= (let ((font-lock-keywords (list regexp)))=0A= (cons (cdr (time-function 'font-lock-hack-keywords beg end))=0A= regexp))))=0A= regexps))))=0A= =0A= (defun sort-font-lock-regexps (regexps &optional buffer unfontify)=0A= "Return sorted times to fontify syntactically and using REGEXPS.=0A= UNFONTIFY first, if non-nil."=0A= (let ((regexp-time (time-regexps regexps buffer unfontify)))=0A= (cons (list (apply '+ (mapcar 'car regexp-time)) 'regexps)=0A= (nreverse (sort regexp-time 'car-less-than-car)))))=0A= =0A= (defun time-fontification (&optional buffer unfontify)=0A= "Return time to fontify syntactically.=0A= UNFONTIFY first, if non-nil."=0A= (save-excursion=0A= (and buffer (set-buffer buffer))=0A= (let ((beg (point-min)) (end (point-max)))=0A= (and unfontify (font-lock-unfontify-region beg end))=0A= (cdr (time-function 'font-lock-fontify-region beg end)))))=0A= =0A= (defun sort-font-lock-fontification (regexps &optional buffer unfontify)=0A= "Return sorted times to fontify syntactically and using REGEXPS.=0A= UNFONTIFY first, if non-nil."=0A= (let ((syntactic-time (time-fontification buffer unfontify))=0A= (regexp-time (time-regexps regexps buffer)))=0A= (nreverse=0A= (sort (append (list (list syntactic-time 'syntactic)=0A= (list (apply '+ (mapcar 'car regexp-time)) 'regexps))=0A= regexp-time)=0A= 'car-less-than-car))))=0A= =0A= ;;; make-regexp.el ends here=0A= ------=_NextPart_000_002A_01C179B6.C9399F10-- From ken.martin@kitware.com Fri Nov 30 21:01:46 2001 From: ken.martin@kitware.com (Ken Martin) Date: Fri, 30 Nov 2001 16:01:46 -0500 Subject: [Cmake] And here is the mode not just the regexp Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_002F_01C179B8.4FA7E0B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit -------------------------- Ken Martin, PhD Kitware Inc. 518 371-3971 x101 469 Clifton Corporate Pkwy. Clifton Park, NY 12065 ------=_NextPart_000_002F_01C179B8.4FA7E0B0 Content-Type: application/octet-stream; name="cmake-mode.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cmake-mode.el" ;;; tcl-mode.el --- a major-mode for editing cmake/tk scripts=0A= =0A= ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.=0A= =0A= ;; Author: Gregor Schmid =0A= ;; Keywords: languages, processes, tools=0A= =0A= ;; This file is part of GNU Emacs.=0A= =0A= ;; GNU Emacs is free software; you can redistribute it and/or modify=0A= ;; it under the terms of the GNU General Public License as published by=0A= ;; the Free Software Foundation; either version 2, or (at your option)=0A= ;; any later version.=0A= =0A= ;; GNU Emacs is distributed in the hope that it will be useful,=0A= ;; but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=0A= ;; GNU General Public License for more details.=0A= =0A= ;; You should have received a copy of the GNU General Public License=0A= ;; along with GNU Emacs; see the file COPYING. If not, write to the=0A= ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,=0A= ;; Boston, MA 02111-1307, USA.=0A= =0A= ;;; Commentary:=0A= =0A= ;; Special Thanks to Simon Marshall for=0A= ;; font-lock patches.=0A= =0A= ;; This file was written with emacs using Jamie Lokier's folding mode=0A= ;; That's what the funny ;;willow marks are there for=0A= =0A= ;;willow Usage=0A= =0A= ;; Cmake3-mode supports c-mode style formatting and sending of=0A= ;; lines/regions/files to a cmake interpreter. An interpreter (see=0A= ;; variable `cmake-default-application') will be started if you try to=0A= ;; send some code and none is running. You can use the process-buffer=0A= ;; (named after the application you chose) as if it were an=0A= ;; interactive shell. See the documentation for `comint.el' for=0A= ;; details.=0A= =0A= ;;bongo=0A= ;;willow Key-bindings=0A= =0A= ;; To see all the keybindings for folding mode, look at = `cmake-setup-keymap'=0A= ;; or start `cmake-mode' and type `\C-h m'.=0A= ;; The keybindings may seem strange, since I prefer to use them with=0A= ;; cmake-prefix-key set to nil, but since those keybindings are already = used=0A= ;; the default for `cmake-prefix-key' is `\C-c', which is the = conventional=0A= ;; prefix for major-mode commands.=0A= =0A= ;; You can customise the keybindings either by setting `cmake-prefix-key'=0A= ;; or by putting the following in your .emacs=0A= ;; (setq cmake-mode-map (make-sparse-keymap))=0A= ;; and=0A= ;; (define-key cmake-mode-map )=0A= ;; for all the functions you need.=0A= =0A= ;;bongo=0A= ;;willow Variables=0A= =0A= ;; You may want to customize the following variables:=0A= ;; cmake-indent-level=0A= ;; cmake-always-show=0A= ;; cmake-mode-map=0A= ;; cmake-prefix-key=0A= ;; cmake-mode-hook=0A= =0A= ;;bongo=0A= =0A= ;;; Code:=0A= =0A= ;; We need that !=0A= (require 'comint)=0A= =0A= ;;willow variables=0A= =0A= (defgroup cmake nil=0A= "Major mode for editing cmake/tk code."=0A= :prefix "cmake-"=0A= :group 'languages)=0A= =0A= (defvar cmake-mode-map nil=0A= "Keymap used with cmake mode.")=0A= =0A= (defvar cmake-prefix-key "\C-c"=0A= "Prefix for all cmake-mode commands.")=0A= =0A= (defcustom cmake-mode-hook nil=0A= "Hooks called when cmake mode fires up."=0A= :type 'hook=0A= :group 'cmake)=0A= =0A= (defvar cmake-region-start (make-marker)=0A= "Start of special region for cmake communication.")=0A= =0A= (defvar cmake-region-end (make-marker)=0A= "End of special region for cmake communication.")=0A= =0A= (defcustom cmake-indent-level 4=0A= "Amount by which cmake subexpressions are indented."=0A= :type 'integer=0A= :group 'cmake)=0A= =0A= (defcustom cmake-default-eval "eval"=0A= "Default command used when sending regions."=0A= :type 'string=0A= :group 'cmake)=0A= =0A= (defvar cmake-mode-menu (make-sparse-keymap "Cmake3-Mode")=0A= "Keymap for cmake-mode's menu.")=0A= =0A= (defvar cmake-font-lock-keywords=0A= (eval-when-compile=0A= (list=0A= ;;=0A= ;; Function name declarations.=0A= '("\\<\\(icmake_class\\|class\\|method\\|proc\\|body\\)\\>[ = \t]*\\(\\sw+\\)?"=0A= (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))=0A= ;;=0A= ;; Keywords.=0A= (concat "\\<\\("=0A= "A\\(BSTRACT_FILES\\|DD_\\(CUSTOM_COMMAND\\|DE\\(FINITIONS\\|PENDENCIES\\= )\\|EXECUTABLE\\|LIBRARY\\|TEST\\)\\|UX_SOURCE_DIRECTORY\\)\\|BUILD_\\(CO= MMAND\\|NAME\\)\\|C\\(ABLE_\\(CLASS_SET\\|WRAP_TCL\\)\\|ONFIGURE_\\(FILE\= \|GCCXML\\)\\)\\|E\\(LSE\\|N\\(ABLE_TESTING\\|D\\(FOREACH\\|IF\\)\\)\\)\\= |F\\(IND_\\(FILE\\|LIBRARY\\|P\\(ATH\\|ROGRAM\\)\\)\\|LTK_WRAP_UI\\|OREAC= H\\)\\|GET_FILENAME_COMPONENT\\|I\\(F\\|N\\(CLUDE\\(\\|_\\(DIRECTORIES\\|= EXTERNAL_MSPROJECT\\|REGULAR_EXPRESSION\\)\\)\\|STALL_\\(FILES\\|PROGRAMS= \\|TARGETS\\)\\)\\)\\|L\\(I\\(BRARY\\|NK_\\(DIRECTORIES\\|LIBRARIES\\)\\)= \\|OAD_CACHE\\)\\|M\\(A\\(KE_DIRECTORY\\|RK_AS_ADVANCED\\)\\|ESSAGE\\)\\|= O\\(PTION\\|UTPUT_REQUIRED_FILES\\)\\|PROJECT\\|QT_WRAP_\\(CPP\\|UI\\)\\|= S\\(ET\\|ITE_NAME\\|OURCE_\\(FILES\\(\\|_REMOVE\\)\\|GROUP\\)\\|UBDIR\\(S= \\|_DEPENDS\\)\\)\\|TARGET_LINK_LIBRARIES\\|U\\(SE_MANGLED_MESA\\|TILITY_= SOURCE\\)\\|V\\(ARIABLE_REQUIRES\\|TK_WRAP_\\(JAVA\\|PYTHON\\|TCL\\)\\)\\= |WRAP_EXCLUDE_FILES"=0A= "\\)\\>")=0A= ;;=0A= ;; Types.=0A= ; (make-regexp '("global" "upvar" "variable" "inherit" "public"=0A= ; "private" "protected" "common"))=0A= (cons (concat "\\<\\("=0A= "common\\|global\\|inherit\\|p\\(r\\(ivate\\|otected\\)\\|ublic\\)"=0A= "\\|upvar\\|variable"=0A= "\\)\\>")=0A= 'font-lock-type-face)=0A= ))=0A= "Default expressions to highlight in CMAKE3 modes.")=0A= =0A= (defvar cmake-imenu-generic-expression=0A= '(=0A= (nil "^\\s-*\\(proc\\|body\\)\\s-+\\(\\(\\s_\\|\\sw\\)+\\)" 2)=0A= ("Classes" "^\\s-*class\\s-+\\(\\(\\s_\\|\\sw\\)+\\)" 1))=0A= =0A= "Imenu generic expression for cmake-mode. See = `imenu-generic-expression'.")=0A= =0A= =0A= ;;bongo=0A= ;;willow cmake-mode=0A= =0A= ;;;###autoload=0A= (defun cmake-mode ()=0A= "Major mode for editing cmake scripts.=0A= The following keys are bound:=0A= \\{cmake-mode-map}=0A= "=0A= (interactive)=0A= (let ((switches nil)=0A= s)=0A= (kill-all-local-variables)=0A= (setq major-mode 'cmake-mode)=0A= (setq mode-name "CMAKE3")=0A= (set (make-local-variable 'indent-line-function) 'cmake-indent-line)=0A= (set (make-local-variable 'comment-start) "# ")=0A= (set (make-local-variable 'comment-start-skip) "# *")=0A= (set (make-local-variable 'font-lock-defaults)=0A= '(cmake-font-lock-keywords nil nil ((?_ . "w") (?: . "w"))))=0A= (set (make-local-variable 'imenu-generic-expression)=0A= cmake-imenu-generic-expression)=0A= (setq imenu-case-fold-search nil)=0A= (make-local-variable 'cmake-default-eval)=0A= (or cmake-mode-map=0A= (cmake-setup-keymap))=0A= (use-local-map cmake-mode-map)=0A= (set-syntax-table (copy-syntax-table))=0A= (modify-syntax-entry ?# "<")=0A= (modify-syntax-entry ?\n ">")=0A= (run-hooks 'cmake-mode-hook)))=0A= =0A= ;;bongo=0A= ;;willow cmake-setup-keymap=0A= =0A= (defun cmake-setup-keymap ()=0A= "Set up keymap for cmake mode.=0A= If the variable `cmake-prefix-key' is nil, the bindings go directly=0A= to `cmake-mode-map', otherwise they are prefixed with = `cmake-prefix-key'."=0A= (setq cmake-mode-map (make-sparse-keymap))=0A= (define-key cmake-mode-map [menu-bar cmake-mode]=0A= (cons "Cmake3-Mode" cmake-mode-menu))=0A= (let ((map (if cmake-prefix-key=0A= (make-sparse-keymap)=0A= cmake-mode-map)))=0A= ;; indentation=0A= (define-key cmake-mode-map [?\)] 'cmake-electric-brace)=0A= ;; communication=0A= (define-key map "\C-\M-s" 'cmake-set-cmake-region-start)=0A= (define-key map "\C-\M-e" 'cmake-set-cmake-region-end)=0A= (define-key map "\C-\M-r" 'cmake-send-cmake-region)=0A= (if cmake-prefix-key=0A= (define-key cmake-mode-map cmake-prefix-key map))=0A= ))=0A= =0A= ;;bongo=0A= ;;willow indentation=0A= =0A= (defun cmake-electric-brace (arg)=0A= "Insert `)' and indent line for cmake."=0A= (interactive "P")=0A= (insert-char ?\) (prefix-numeric-value arg))=0A= (cmake-indent-line)=0A= (blink-matching-open))=0A= =0A= ;;willow cmake-indent-line=0A= =0A= (defun cmake-indent-line ()=0A= "Indent current line as cmake code.=0A= Return the amount the indentation changed by."=0A= (let ((indent (cmake-calculate-indentation nil))=0A= beg shift-amt=0A= (case-fold-search nil)=0A= (pos (- (point-max) (point))))=0A= (beginning-of-line)=0A= (setq beg (point))=0A= (skip-chars-forward " \t")=0A= (save-excursion=0A= (while (eq (following-char) ?\))=0A= (setq indent (max (- indent cmake-indent-level) 0))=0A= (forward-char 1)=0A= (if (looking-at "\\([ \t]*\\)\)")=0A= (progn=0A= (delete-region (match-beginning 1) (match-end 1))=0A= (insert-char ? (1- cmake-indent-level))))))=0A= (setq shift-amt (- indent (current-column)))=0A= (if (zerop shift-amt)=0A= (if (> (- (point-max) pos) (point))=0A= (goto-char (- (point-max) pos)))=0A= (delete-region beg (point))=0A= (indent-to indent)=0A= ;; If initial point was within line's indentation,=0A= ;; position after the indentation. Else stay at same point in = text.=0A= (if (> (- (point-max) pos) (point))=0A= (goto-char (- (point-max) pos))))=0A= shift-amt))=0A= =0A= ;;bongo=0A= ;;willow cmake-calculate-indentation=0A= =0A= (defun cmake-calculate-indentation (&optional parse-start)=0A= "Return appropriate indentation for current line as cmake code.=0A= In usual case returns an integer: the column to indent to."=0A= (let ((pos (point)))=0A= (save-excursion=0A= (if parse-start=0A= (setq pos (goto-char parse-start)))=0A= (beginning-of-line)=0A= (if (bobp)=0A= (current-indentation)=0A= (forward-char -1)=0A= (if (eq (preceding-char) ?\\)=0A= (+ (current-indentation)=0A= (progn=0A= (beginning-of-line)=0A= (if (bobp)=0A= (* 2 cmake-indent-level)=0A= (forward-char -1)=0A= (if (not (eq (preceding-char) ?\\))=0A= (* 2 cmake-indent-level)=0A= 0))))=0A= (forward-char 1)=0A= (if (re-search-backward=0A= "\\(^[^ \t\n\r#]\\)\\|\\(\([^\)]*[#\n]\\)\\|\\(\)\\s *\n\\)"=0A= nil t)=0A= (+ (- (current-indentation)=0A= (if (save-excursion=0A= (beginning-of-line)=0A= (and (not (bobp))=0A= (progn=0A= (forward-char -1)=0A= (eq (preceding-char) ?\\))))=0A= (* 2 cmake-indent-level)=0A= 0))=0A= (if (eq (following-char) ?\()=0A= cmake-indent-level=0A= 0))=0A= (goto-char pos)=0A= (beginning-of-line)=0A= (forward-line -1)=0A= (current-indentation)))))))=0A= =0A= ;;bongo=0A= =0A= ;;bongo=0A= ;;willow searching=0A= =0A= =0A= (provide 'cmake-mode)=0A= =0A= =0C=0A= ;;willow Emacs local variables=0A= =0A= ;; Local Variables:=0A= ;; folded-file: t=0A= ;; End:=0A= =0A= ;;bongo=0A= =0A= ;;; cmake-mode.el ends here=0A= ------=_NextPart_000_002F_01C179B8.4FA7E0B0-- From millerjv@crd.ge.com Mon Nov 5 13:54:04 2001 From: millerjv@crd.ge.com (Miller, James V (CRD)) Date: Mon, 5 Nov 2001 08:54:04 -0500 Subject: [Cmake] Win32 "Blended" processor vs Pentium Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C16601.547F8BD0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C16601.547F8BD0" ------_=_NextPart_001_01C16601.547F8BD0 Content-Type: text/plain; charset="iso-8859-1" Stephen Alyward mentioned the other day that he has seen as much as a 2X performance improvement if VC++ is set to create instructions for the Pentium processor as opposed to the "Blended" mode which is the current default. Has anyone else seen such performance increases switching from "blended" to "pentium"? Should CMake support changing this setting? Or perhaps should we just the default to be compile for Pentium? Are we worried about building applications for people with 486's? (I am currently getting pressure to pull machines with less than a Pentium II off our network :) Jim Miller _____________________________________ Visualization & Computer Vision GE Corporate Research & Development Bldg. KW, Room C218B P.O. Box 8, Schenectady NY 12301 millerjv@crd.ge.com < mailto:millerjv@crd.ge.com > (518) 387-4005, Dial Comm: 8*833-4005, Cell: (518) 505-7065, Fax: (518) 387-6981 ------_=_NextPart_001_01C16601.547F8BD0 Content-Type: text/html; charset="iso-8859-1"
Stephen Alyward mentioned the other day that he has seen as much as a 2X performance improvement if VC++ is set to create instructions for the Pentium processor as opposed to the "Blended" mode which is the current default.
 
Has anyone else seen such performance increases switching from "blended" to "pentium"?
 
Should CMake support changing this setting? Or perhaps should we just the default to be compile for Pentium?  Are we worried about building applications for people with 486's? (I am currently getting pressure to pull machines with less than a Pentium II off our network :)
 

Jim Miller
_____________________________________
Visualization & Computer Vision
GE Corporate Research & Development
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv@crd.ge.com <mailto:millerjv@crd.ge.com>

(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981


 
------_=_NextPart_001_01C16601.547F8BD0-- ------_=_NextPart_000_01C16601.547F8BD0 Content-Type: application/octet-stream; name="Miller, James V (CRD).vcf" Content-Disposition: attachment; filename="Miller, James V (CRD).vcf" BEGIN:VCARD VERSION:2.1 N:Miller;James FN:Miller, James V (CRD) ORG:CRD;ESL TITLE:Computer Scientist TEL;WORK;VOICE:*833-4005 TEL;WORK;VOICE:1 518 387-4005 ADR;WORK:;KW-C218B;P.O. Box 8;Schenectady;New York;12301;USA LABEL;WORK;ENCODING=QUOTED-PRINTABLE:KW-C218B=0D=0AP.O. Box 8=0D=0ASchenectady, New York 12301=0D=0AUSA EMAIL;PREF;INTERNET:millerjv@crd.ge.com REV:20010420T140329Z END:VCARD ------_=_NextPart_000_01C16601.547F8BD0-- From bill.hoffman@kitware.com Tue Nov 6 13:47:28 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Tue, 06 Nov 2001 09:47:28 -0400 Subject: [Cmake] AddCustomCommand Message-ID: <5.0.2.1.0.20011106094514.08088398@pop.nycap.rr.com> I changed the unix makefile generator so that it uses full paths to source files. This should allow out-of-source builds without gnu make. As a side effect of that change, the AddCustomCommand function now requires a full path to the output files. I have tested the VTK wrapping commands, but not the QT one. Could one of the QT users try it? Thanks. -Bill From p.pritchett@2d3.com Tue Nov 6 16:41:30 2001 From: p.pritchett@2d3.com (Phil Pritchett) Date: Tue, 6 Nov 2001 16:41:30 -0000 Subject: [Cmake] including external projects Message-ID: <609562B7721BD41187B400B0D0208560856BDE@FILESERV> I have now added the INCLUDE_EXTERNAL_MSPROJECT command to the cvs repository. Cheers, Phil > -----Original Message----- > From: Phil Pritchett > Sent: Monday, October 29, 2001 12:58 PM > To: Cmake Mailing List (E-mail) > Subject: [Cmake] including external projects > > > I was going to write a command that will allow CMake to > include external MS > projects in a workspace along with a list of dependencies. > Just wanted to > make sure that no one had done this already, or had any objections. > It will look something like : > INCLUDE_EXTERNAL_MSPROJECT(name location dep1 dep2 ...) > > Phil > > > > -----Original Message----- > > From: William A. Hoffman [mailto:bill.hoffman@kitware.com] > > Sent: Friday, October 26, 2001 2:48 PM > > To: Phil Pritchett > > Cc: Cmake Mailing List (E-mail); VXL Mailing List (E-mail) > > Subject: Re: [Cmake] file/project specific compile flags > > > > > > At 10:54 AM 10/26/2001 +0100, Phil Pritchett wrote: > > > > I was thinking. When we created the MSPROJECT_TEMPLATE stuff, there > > where no flags like CMAKE_CXX_FLAGS_DEBUG|RELEASE|RELMINSIZE. > > > > Perhaps the best thing to do is live with the 4 different > builds, but > > customize them for > > each site. The could even be set in a projects > CMakeLists.txt file. > > 4 builds should be enough. > > > > -Bill > > > > > > >o CMakeWindowSystemConfig.cmake is always taken from the > system CMake > > >Templates directory rather than the one specified by > > >MSPROJECT_TEMPLATE_DIRECTORY. is this the correct behaviour ? > > >o even though you can add build types to the various MS > > templates the search > > >and replace used to generated the project files is > hardcoded in, so I > > >couldn't add CMAKE_CXX_FLAGS_MYBUILD into the project templates. > > > > This e-mail, and any attachment, is confidential. If you have > received it in > error, please delete it from your system, do not use or disclose the > information in any way, and notify me immediately. > _______________________________________________ > Cmake mailing list > Cmake@public.kitware.com > http://public.kitware.com/mailman/listinfo/cmake > This e-mail, and any attachment, is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify me immediately. From bettingf@cs.man.ac.uk Tue Nov 6 20:31:03 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Tue, 6 Nov 2001 20:31:03 +0000 Subject: [Cmake] AddCustomCommand In-Reply-To: <5.0.2.1.0.20011106094514.08088398@pop.nycap.rr.com> References: <5.0.2.1.0.20011106094514.08088398@pop.nycap.rr.com> Message-ID: <01110620310307.29675@gwa12> Your changes seems to work correctly with QT too. I've also changed the QT wrap cpp so that it also clears the generated moc files when "make clean" is called. Franck On Tuesday 06 November 2001 13:47, Bill Hoffman wrote: > I changed the unix makefile generator so that it uses full paths to source > files. This should allow out-of-source builds without gnu make. As a side > effect of that change, the AddCustomCommand function now requires a full > path to the output files. I have tested the VTK wrapping commands, but not > the QT one. Could one of the QT users try it? Thanks. > > -Bill > From volpecr@crd.ge.com Tue Nov 6 22:39:51 2001 From: volpecr@crd.ge.com (Volpe, Christopher R (CRD)) Date: Tue, 6 Nov 2001 17:39:51 -0500 Subject: [Cmake] Generating browse info Message-ID: Ok, I suspect this has come up before, but I'm looking over the messages I've received since joining the mailing list, and I don't see anything that *directly* relates to this. What some co-workers of mine and I would like is a way to specify the generation of browse information (/FR compiler flag) for all the user's source code (i.e. non-generated source code, e.g. TCL wrapper files). Now, unfortunately, if I create a LocalUserOptions.cmake file in, say, the "Common" folder and do "SET(CMAKE_CXX_FLAGS /FR)", CMake will use that in both vtkCommon and vtkCommonTCL. I'd like to be able to do this such that the browse information is turned on ONLY in vtkCommon (and other non-wrapper project trees). Is there a way to do this with the existing CMake, and if not, is there any proposed functionality currently under discussion that would enable this? thanks, Chris > GE Corporate Research & Development > ___________________________________________________________________________________________________ > _______________________________________________ > Christopher R. Volpe Computer Scientist Visualization and Computer Vision Program / Electronic Systems Lab Bldg KW, Room C215 P.O. Box 8, Schenectady, NY 12301 (518) 387-7766, Dial Comm: 8*833-7766, Fax: (518) 387-6981 e-mail: volpecr@crd.ge.com web: http://www.crd.ge.com/~volpecr From sebastien@barre.nom.fr Thu Nov 8 15:31:56 2001 From: sebastien@barre.nom.fr (Sebastien BARRE) Date: Thu, 08 Nov 2001 10:31:56 -0500 Subject: [Cmake] bug in cmDSWWriter In-Reply-To: Message-ID: <5.1.0.14.2.20011108102646.01f97008@pop.fr.clara.net> cmDSWWriter does not seem to take into account custom targets that were added with the ALL flag: ADD_CUSTOM_TARGET(Name [ALL] command arg arg arg ...) The ALL option is optional. If it is specified it indicates that this target should be added to the build all target. You can reproduce it by locally changing: ADD_CUSTOM_TARGET(DoxygenDoc to ADD_CUSTOM_TARGET(DoxygenDoc ALL in CMake\Utilities\Doxygen\CMakeLists.txt run Cmake. In Cmake.dsw, look at: Project: "ALL_BUILD"=.\ALL_BUILD.dsp - Package Owner=<4> you won't see DoxygenDoc It might have something to do with code in cmDSWWriter.cxx located below that comment: // if this is the special ALL_BUILD utility, then // make it depend on every other non UTILITY project. // This is done by adding the names to the GetUtilities // vector on the makefile Am I missing something ? From jordan.howarth@cmis.csiro.au Fri Nov 9 10:27:02 2001 From: jordan.howarth@cmis.csiro.au (Jordan) Date: Fri, 9 Nov 2001 21:27:02 +1100 (EST) Subject: [Cmake] Mimicking directory structure in workspace fileview Message-ID: <15339.43353.551888.342533@pride.nsw.cmis.CSIRO.AU> Great tool!! My team has been developing in MSDEV for the last year and we are now considering cross-platform development. CMake appears to provided all the platform independence we require in the build process. One feature of the MSDEV workspace we have found invaluable is the ability to create folders within projects (not Workspace) so that the fileview structure in the workspace window is identical to the actual file structure on disk. If this is the actual file structure: School |-- CMakeLists.txt |-- Classroom | |-- CMakeLists.txt | `-- Teacher | |-- Student | | |-- student.cpp | | `-- student.h | |-- teacher.cpp | `-- teacher.h `-- Head |-- CMakeLists.txt `-- main.cpp and this is School/Classroom/CMakeLists.txt: ADD_LIBRARY(classroom STATIC teach room) AUX_SOURCE_DIRECTORY(Teacher teach) AUX_SOURCE_DIRECTORY(Teacher/Student room) then is there a CMake command that allows this same structure to appear in the workspace view. At present CMake produces a workspace containing the MSDEV "projects" Classroom and Head, with the corresponding .cpp files stored in a "Source Files" folder. BTW, is there an exhaustive tutorial or available assortment of CMakeLists.txt (other than in CMake.pdf) to show how all the CMake commands can be used, and thereby fast track new and enthusiastic users like myself. ;) Regards, J. -- Jordan Howarth mailto:jordan.howarth@cmis.csiro.au CSIRO p: (07) 3375 9632, (07) 3826 7314 Mathematical and Information Sciences f: (07) 3826 7304 -=| For every truth there are a thousand lies |=- From bettingf@cs.man.ac.uk Fri Nov 9 18:07:00 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Fri, 9 Nov 2001 18:07:00 +0000 Subject: [Cmake] Compilation of user interface files Message-ID: <01110918070000.24117@gwa12> Hi, I've added compilation of .ui files to cmake (files created with the designer tool included in Qt distributions). It uses the QT_WRAP_UI command to generate headers (.h) and source files (.cxx). The headers file should then be compiled into moc files using QT_WRAP_CPP. For instance if you have a list of files called project_ui_files containing .ui source files you have to write : QT_WRAP_UI( project project_h_files project_cxx_files project_ui_files ) QT_WRAP_CPP( project project_moc_files project_h_files ) in that order. I've tested it using linux and it works fine. Can anyone who is using designer test it with Windows ? Franck From sebastien.barre@kitware.com Fri Nov 9 21:09:12 2001 From: sebastien.barre@kitware.com (Sebastien BARRE) Date: Fri, 09 Nov 2001 16:09:12 -0500 Subject: [Cmake] Using ADD_CUSTOM_COMMAND: self-pack exes or dlls In-Reply-To: <01110918070000.24117@gwa12> Message-ID: <5.1.0.14.2.20011109153148.02ee4890@pop.fr.clara.net> --=====================_196331680==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed Hi CMake users, Ken has just modified the DSW writer so that it supports custom commands created using ADD_CUSTOM_COMMAND and attached to libs or exes through the SOURCE parameter. In that specific case the custom command is triggered as a post-build command by nmake. I've reimplemented this command code and thus slightly changed the command usage to: "ADD_CUSTOM_COMMAND(SOURCE source COMMAND command TARGET target " "[ARGS [args...]] [DEPENDS [depends...]] [OUTPUTS [outputs...]])\n" "Add a custom command."; I've successfully used it to automatically propagate a DLL to several directories everytime it is rebuilt. Here is a another (typical) example demonstrating how to self-pack an executable everytime it is rebuilt (i.e. same exe but decompressed on-the-fly). This example self-packs CMakeSetup.exe to 30% of its size with upx (548 Ko to 127 Ko for the 'Release' build). You need UPX, a 87 Ko free command-line self-packer (http://wildsau.idv.uni-linz.ac.at/mfx/upx.html). It can be used to self-pack DLL too. Add these lines to the end of CMake\Source\MFCDialog\CMakeLists.txt OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF) IF (SELF_PACK_EXECUTABLES) INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake) IF (SELF_PACKER_FOR_EXECUTABLE) IF (WIN32) ADD_CUSTOM_COMMAND( SOURCE CMakeSetup COMMAND ${SELF_PACKER_FOR_EXECUTABLE} ARGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${EXECUTABLE_OUTPUT_PATH}/$(INTDIR)/CMakeSetup.exe TARGET CMakeSetup) ENDIF (WIN32) ENDIF (SELF_PACKER_FOR_EXECUTABLE) ENDIF (SELF_PACK_EXECUTABLES) - The FindSelfPackers.cmake (see CVS) module looks for a self-packer (SELF_PACKER_FOR_EXECUTABLE and SELF_PACKER_FOR_SHARED_LIB) and the according flags). - The custom command is attached to the exe post-build steps by using the target name as the SOURCE parameter (of course, TARGET should also be set to this value). Of course it does not make a lot of sense if you self-pack your Debug executables. You might focus on packing the release build (for quick distribution purposes for example). Here is a hack: instead of launching the packer it launches a shell that tests for the $(INTDIR) var. But you need a unix-like shell (cygwin bash) as I was not able to figure out if command.exe is able to interpret a string instead of executing a batch or entering in interactive mode. Hence, if you use bash you can not use $(INTDIR) to specify the path to the executable to compress (as it use a '/'). But since we know the INTDIR value (here, './Release') it's not that important. It's a hack anyway :) OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF) IF (SELF_PACK_EXECUTABLES) INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake) IF (SELF_PACKER_FOR_EXECUTABLE) IF (WIN32) INCLUDE(${CMAKE_ROOT}/Modules/FindUnixCommands.cmake) IF (BASH) ADD_CUSTOM_COMMAND( SOURCE CMakeSetup COMMAND ${BASH} ARGS "-c" "if test 'x$(INTDIR)' == 'x.\\Release'; then ${SELF_PACKER_FOR_EXECUTABLE} ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${EXECUTABLE_OUTPUT_PATH}/Release/CMakeSetup.exe; fi" TARGET CMakeSetup) ENDIF (BASH) ENDIF (WIN32) ENDIF (SELF_PACKER_FOR_EXECUTABLE) ENDIF (SELF_PACK_EXECUTABLES) Just my 2 cents -- Sebastien Barre --=====================_196331680==_.ALT Content-Type: text/html; charset="us-ascii" Hi CMake users,

Ken has just modified the DSW writer so that it supports custom commands created using ADD_CUSTOM_COMMAND and attached to libs or exes through the SOURCE parameter. In that specific case the custom command is triggered as a post-build command by nmake.

I've reimplemented this command code and thus slightly changed the command usage to:

      "ADD_CUSTOM_COMMAND(SOURCE source COMMAND command TARGET target "
      "[ARGS [args...]] [DEPENDS [depends...]] [OUTPUTS [outputs...]])\n"
      "Add a custom command.";

I've successfully used it to automatically propagate a DLL to several directories everytime it is rebuilt.

Here is a another (typical) example demonstrating how to self-pack an executable everytime it is rebuilt (i.e. same exe but decompressed on-the-fly).

This example self-packs CMakeSetup.exe to 30% of its size with upx (548 Ko to 127 Ko for the 'Release' build). You need UPX, a 87 Ko free command-line self-packer (http://wildsau.idv.uni-linz.ac.at/mfx/upx.html). It can be used to self-pack DLL too.

Add these lines to the end of CMake\Source\MFCDialog\CMakeLists.txt

OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF)

IF (SELF_PACK_EXECUTABLES)
  INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake)
  IF (SELF_PACKER_FOR_EXECUTABLE)
    IF (WIN32)
      ADD_CUSTOM_COMMAND(
          SOURCE CMakeSetup
          COMMAND ${SELF_PACKER_FOR_EXECUTABLE}
          ARGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS}
               ${EXECUTABLE_OUTPUT_PATH}/$(INTDIR)/CMakeSetup.exe
          TARGET CMakeSetup)
    ENDIF (WIN32)
  ENDIF (SELF_PACKER_FOR_EXECUTABLE)
ENDIF (SELF_PACK_EXECUTABLES)

- The FindSelfPackers.cmake (see CVS) module looks for a self-packer (SELF_PACKER_FOR_EXECUTABLE and SELF_PACKER_FOR_SHARED_LIB) and the according flags).

- The custom command is attached to the exe post-build steps by using the target name as the SOURCE parameter (of course, TARGET should also be set to this value).

Of course it does not make a lot of sense if you self-pack your Debug executables. You might focus on packing the release build (for quick distribution purposes for example). Here is a hack: instead of launching the packer it launches a shell that tests for the $(INTDIR) var. But you need a unix-like shell (cygwin bash) as I was not able to figure out if command.exe is able to interpret a string instead of executing a batch or entering in interactive mode. Hence, if you use bash you can not use $(INTDIR) to specify the path to the executable to compress (as it use a '/'). But since we know the INTDIR value (here, './Release') it's not that important. It's a hack anyway :)

OPTION(SELF_PACK_EXECUTABLES "Self-pack executables." OFF)

IF (SELF_PACK_EXECUTABLES)
  INCLUDE(${CMAKE_ROOT}/Modules/FindSelfPackers.cmake)
  IF (SELF_PACKER_FOR_EXECUTABLE)
    IF (WIN32)
      INCLUDE(${CMAKE_ROOT}/Modules/FindUnixCommands.cmake)
      IF (BASH)
        ADD_CUSTOM_COMMAND(
          SOURCE CMakeSetup
          COMMAND ${BASH}
          ARGS "-c" "if test 'x$(INTDIR)' == 'x.\\Release'; then ${SELF_PACKER_FOR_EXECUTABLE} ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} ${EXECUTABLE_OUTPUT_PATH}/Release/CMakeSetup.exe; fi"
          TARGET CMakeSetup)
      ENDIF (BASH)
    ENDIF (WIN32)
  ENDIF (SELF_PACKER_FOR_EXECUTABLE)
ENDIF (SELF_PACK_EXECUTABLES)

Just my 2 cents

--
Sebastien Barre --=====================_196331680==_.ALT-- From jordan.howarth@cmis.csiro.au Mon Nov 12 05:07:36 2001 From: jordan.howarth@cmis.csiro.au (Jordan Howarth) Date: Mon, 12 Nov 2001 15:07:36 +1000 Subject: [Cmake] license Message-ID: <15343.22808.929472.632001@rainy.stormgreen.org.au> Hi, I cannot find details that define the license required to use CMake or more importantly, the restrictions on its use in the production of a commercial product. Has this been clarified? J. From bill.hoffman@kitware.com Mon Nov 12 13:12:30 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 12 Nov 2001 09:12:30 -0400 Subject: [Cmake] license In-Reply-To: <15343.22808.929472.632001@rainy.stormgreen.org.au> Message-ID: <5.0.2.1.0.20011112091042.0815c570@pop.nycap.rr.com> The license can be found in the source code. It is a BSD style license, so you are free to use it in a commercial produce if you like. Here is a copy of the license: /*========================================================================= Copyright (c) 2001 Insight Consortium All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the Insight Consortium, nor the names of any consortium members, nor of any contributors, may be used to endorse or promote products derived from this software without specific prior written permission. * Modified source versions must be plainly marked as such, and must not be misrepresented as being the original software. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =========================================================================*/ At 03:07 PM 11/12/2001 +1000, Jordan Howarth wrote: >Hi, > >I cannot find details that define the license required to use CMake or more >importantly, the restrictions on its use in the production of a commercial >product. > >Has this been clarified? > >J. > > > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From bettingf@cs.man.ac.uk Mon Nov 12 16:31:35 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Mon, 12 Nov 2001 16:31:35 +0000 Subject: [Cmake] dependencies Message-ID: <01111216313500.01999@gwa12> Hi, I tried to add a dependency that was not automatically generated by cmake in a CMakeList.txt using the command: ADD_DEPENDENCIES(drawingimpl.cxx ${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) Apparently it doesn't change anything in the generated Makefile (at least on linux). Anyone has any idea why it does this, or how can I add a user defined dependency ? Cheers, Franck From bill.hoffman@kitware.com Mon Nov 12 17:21:52 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 12 Nov 2001 13:21:52 -0400 Subject: [Cmake] dependencies In-Reply-To: <01111216313500.01999@gwa12> Message-ID: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> The ADD_DEPENDENCIES command is only used to add dependencies between one executable and another. Regular build dependencies are handled automatically. If drawingimpl.cxx includes drawing.h the depend should be in cmake.depends. -Bill At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote: >Hi, > >I tried to add a dependency that was not automatically generated by cmake in >a CMakeList.txt using the command: > >ADD_DEPENDENCIES(drawingimpl.cxx >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) > >Apparently it doesn't change anything in the generated Makefile (at least on >linux). Anyone has any idea why it does this, or how can I add a user defined >dependency ? > >Cheers, >Franck >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From bettingf@cs.man.ac.uk Mon Nov 12 19:23:53 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Mon, 12 Nov 2001 19:23:53 +0000 Subject: [Cmake] dependencies In-Reply-To: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> References: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> Message-ID: <01111219235305.01999@gwa12> Hi Bill, In fact it's not as easy as that. The file drawingimpl.cxx include drawingimpl.h and drawingimpl.h includes drawing.h So drawing.h is not in the cmake.depends file, but drawingimpl.h is. Unfortunately, as there is no make rule for drawingimpl.h, there's no link to drawing.h in cmake.depends. Furthermore, if I include drawing.h in drawingimpl.h, I can only find drawing.h in cmake.depends if I use the syntax : #include Other syntaxes like #include "drawing.h" or #include don't work. In the case I use the first syntax, I have the line : drawing.h \ in cmake.depends. The "make" utility doesn't seem to be able to match that to the full path name as used in the rule for creating drawing.h in Makefile (certainly because drawing.h is not in the source directory but in the object directory because it is a generated file). I can change this rule to use only the name of the file, but I would like a proper solution with the full pathname as it might be a problem if it's used in a library, and also for consistency with the rest of the Makefile. Furthermore I don't know if this patchy solution would be crossplatform. Concerning ADD_DEPENDENCIES, I think it's strange to have to link executable. What we would certainly need is the possiblitity of linking generated files. And it's the way I've (mis)understood the command. Franck On Monday 12 November 2001 17:21, Bill Hoffman wrote: > The ADD_DEPENDENCIES command is only used to add dependencies between one > executable and another. Regular build dependencies are handled > automatically. > > If drawingimpl.cxx includes drawing.h the depend should be in > cmake.depends. > > -Bill > > At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote: > >Hi, > > > >I tried to add a dependency that was not automatically generated by cmake > > in a CMakeList.txt using the command: > > > >ADD_DEPENDENCIES(drawingimpl.cxx > >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) > > > >Apparently it doesn't change anything in the generated Makefile (at least > > on linux). Anyone has any idea why it does this, or how can I add a user > > defined dependency ? > > > >Cheers, > >Franck > >_______________________________________________ > >Cmake mailing list > >Cmake@public.kitware.com > >http://public.kitware.com/mailman/listinfo/cmake > > _______________________________________________ > Cmake mailing list > Cmake@public.kitware.com > http://public.kitware.com/mailman/listinfo/cmake From bill.hoffman@kitware.com Mon Nov 12 19:01:18 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 12 Nov 2001 15:01:18 -0400 Subject: [Cmake] dependencies In-Reply-To: <01111219235305.01999@gwa12> References: <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> <5.0.2.1.0.20011112132037.08187d20@pop.nycap.rr.com> Message-ID: <5.0.2.1.0.20011112145142.07f65238@pop.nycap.rr.com> OK, I think I figured out what might work for you. In your command to generate the .h file use the following method: cmMakefile::AddCMakeDependFile to add the generated .h file to the list of things that the makefile depends on. This will cause the following rule: cmake.depends : path/to/your/file.h and since, you have a rule: path/to/your/file.h: moc > path/to/your/file.h It will cause it to be generated before the depend step is run. As for < vs. " for includes I am not sure what is wrong there. -Bill At 07:23 PM 11/12/2001 +0000, Franck Bettinger wrote: >Hi Bill, > >In fact it's not as easy as that. >The file drawingimpl.cxx include drawingimpl.h and drawingimpl.h includes >drawing.h >So drawing.h is not in the cmake.depends file, but drawingimpl.h is. >Unfortunately, as there is no make rule for drawingimpl.h, there's no link to >drawing.h in cmake.depends. > >Furthermore, if I include drawing.h in drawingimpl.h, I can only find >drawing.h in cmake.depends if I use the syntax : >#include > >Other syntaxes like >#include "drawing.h" >or >#include >don't work. > >In the case I use the first syntax, I have the line : >drawing.h \ >in cmake.depends. > >The "make" utility doesn't seem to be able to match that to the full path >name as used in the rule for creating drawing.h in Makefile (certainly >because drawing.h is not in the source directory but in the object directory >because it is a generated file). >I can change this rule to use only the name of the file, but I would like a >proper solution with the full pathname as it might be a problem if it's used >in a library, and also for consistency with the rest of the Makefile. >Furthermore I don't know if this patchy solution would be crossplatform. > >Concerning ADD_DEPENDENCIES, I think it's strange to have to link executable. >What we would certainly need is the possiblitity of linking generated files. >And it's the way I've (mis)understood the command. > >Franck > > >On Monday 12 November 2001 17:21, Bill Hoffman wrote: >> The ADD_DEPENDENCIES command is only used to add dependencies between one >> executable and another. Regular build dependencies are handled >> automatically. >> >> If drawingimpl.cxx includes drawing.h the depend should be in >> cmake.depends. >> >> -Bill >> >> At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote: >> >Hi, >> > >> >I tried to add a dependency that was not automatically generated by cmake >> > in a CMakeList.txt using the command: >> > >> >ADD_DEPENDENCIES(drawingimpl.cxx >> >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h) >> > >> >Apparently it doesn't change anything in the generated Makefile (at least >> > on linux). Anyone has any idea why it does this, or how can I add a user >> > defined dependency ? >> > >> >Cheers, >> >Franck >> >_______________________________________________ >> >Cmake mailing list >> >Cmake@public.kitware.com >> >http://public.kitware.com/mailman/listinfo/cmake >> >> _______________________________________________ >> Cmake mailing list >> Cmake@public.kitware.com >> http://public.kitware.com/mailman/listinfo/cmake > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From brad.king@kitware.com Mon Nov 12 20:52:24 2001 From: brad.king@kitware.com (Brad King) Date: Mon, 12 Nov 2001 15:52:24 -0500 (EST) Subject: [Cmake] dependencies In-Reply-To: <5.0.2.1.0.20011112145142.07f65238@pop.nycap.rr.com> Message-ID: Franck, After Bill sent you the AddCMakeDependFile solution, we realized that it will cause problems with .DSP files in windows reloading during every build. It would probably work okay for unix, but the annoyance in windows means it should not be used. I have just checked in a change that should allow a "dependency hint" mechanism to solve your proplem. In your command, add to the cmSourceFile instance the full path to the header in its depends member. For example: cmSourceFile file; // ... setup source file ... // Add dependency hint to missing file. file.GetDepends().push_back(pathToDrawingDotH); This will cause the UNIX dependency generator to add the proper path even though the file doesn't exist. If the .h does exist when the dependency generator is run, the hint will not hurt anything, and the full set of dependencies should be generated. I have not tested this, other than a quick check that the change I checked in doesn't break anything else. There may yet be something we haven't considered. Please let us know what happens. -Brad From bettingf@cs.man.ac.uk Tue Nov 13 15:51:27 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Tue, 13 Nov 2001 15:51:27 +0000 Subject: [Cmake] dependencies In-Reply-To: References: Message-ID: <01111315512700.17737@gwa12> Hi Brad, On Monday 12 November 2001 20:52, Brad King wrote: > cmSourceFile file; > // ... setup source file ... > // Add dependency hint to missing file. > file.GetDepends().push_back(pathToDrawingDotH); The last line doesn't change anything in either the generated Makefile or the generated cmake.depends. Do I need to call another function to be able to see the changes ? Actually, I just call the function AddSource : m_Makefile->AddSource(file,m_SourceList.c_str()); Franck From brad.king@kitware.com Tue Nov 13 18:41:02 2001 From: brad.king@kitware.com (Brad King) Date: Tue, 13 Nov 2001 13:41:02 -0500 (EST) Subject: [Cmake] dependencies In-Reply-To: <01111315512700.17737@gwa12> Message-ID: > The last line doesn't change anything in either the generated Makefile > or the generated cmake.depends. Do I need to call another function to > be able to see the changes ? No. There must be something else wrong. If the latest version of your QT wrap commands are not checked in, please send them to me along with an example of what you are trying to build. I'll take a look to see if I can track down the problem. -Brad From bill.hoffman@kitware.com Wed Nov 14 14:02:26 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Wed, 14 Nov 2001 09:02:26 -0500 Subject: [Cmake] ccmake Message-ID: <5.0.2.1.0.20011114085753.03989b18@pop.nycap.rr.com> Berk Geveci at Kitware has implemented a curses interface to cmake. It still needs a few more features, (like help). However, it is functional. You run it just like the command line cmake. For example, mkdir Project-build cd Project-build ccmake ../Project The main idea is for use on UNIX where there is not always a GUI. -Bill From perera@cs.rpi.edu Fri Nov 16 21:40:29 2001 From: perera@cs.rpi.edu (Amitha Perera) Date: Fri, 16 Nov 2001 16:40:29 -0500 Subject: [Cmake] Library link line compression (again) Message-ID: <20011116164029.I76467@cs.rpi.edu> Hi all Would anyone object to adding an option to CMake to allow link line compression? In particular, I think that most projects have a tree like library dependency, and it is possible for CMake to automatically eliminate duplicate libraries without causing linking failures. The default mode would be what it is now, which generates a long link line (for vxl, at least). As the message below indicates, this is probably a useful process, and a good step in lieu of a full dependency analysis. Amitha. ----- Forwarded message from "Christopher D. Carothers" ----- To: Amitha Perera From: "Christopher D. Carothers" Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST) Subject: fyi: static linking needs huge swap space! Folks, to link a static version of online tracining under linux (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in addition to 256 MB of RAM. I watched "top" as the final link was being done and you could just see the vast amount of memory being allocated. I think the reason for this because the link line has duplicates of every lib. Amitha, is there anyway we can cut down on these duplicates and still avoid unresolved symbols. My office machine now has 2 GB of swap :-) Happy compiling! Chris ----- End forwarded message ----- From ian.m.scott@stud.man.ac.uk Mon Nov 19 09:59:04 2001 From: ian.m.scott@stud.man.ac.uk (Ian Scott) Date: Mon, 19 Nov 2001 09:59:04 -0000 Subject: [Cmake] Library link line compression (again) In-Reply-To: <20011116164029.I76467@cs.rpi.edu> Message-ID: <000001c170e0$d2bcd360$22ea5882@ian> Amitha, I had a go at doing this. I gave up because it didn't have any noticible effect on DevStudio's loading or linking speed. I've lost the code, but the algorithm should go something like this Add a function StripLinkLibrariesToTreeDependecy, called under the control of some cache variable from cmMakeFile::FinalPass Method cmMakeFile::StripLinkLibrariesToTreeDependecy Copy sequence of all linklibraries to LL start = Beginning of LL Starting from i = End of LL --i; Get Library L = *i j = i; While (j!= start) j--; if *j = *i remove *j shuffle all previous members (start, j-1) of LL up one ++start; Until i == start; Copy LL back to LinkLibaries. End Alternatively you could put the code in the FinalPass method of a new Command StripLinkLibrariesToTreeDependecy Ian. > -----Original Message----- > From: Amitha Perera [mailto:perera@cs.rpi.edu] > Sent: Friday, November 16, 2001 9:40 PM > To: cmake@public.kitware.com > Cc: chrisc@cs.rpi.edu > Subject: [Cmake] Library link line compression (again) > > > Hi all > > Would anyone object to adding an option to CMake to allow link line > compression? In particular, I think that most projects have a tree > like library dependency, and it is possible for CMake to automatically > eliminate duplicate libraries without causing linking failures. The > default mode would be what it is now, which generates a long link line > (for vxl, at least). > > As the message below indicates, this is probably a useful process, and > a good step in lieu of a full dependency analysis. > > Amitha. > > > ----- Forwarded message from "Christopher D. Carothers" > ----- > > To: Amitha Perera > From: "Christopher D. Carothers" > Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST) > Subject: fyi: static linking needs huge swap space! > > Folks, to link a static version of online tracining under linux > (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in > addition to 256 MB of RAM. I watched "top" as the final link was being > done and you could just see the vast amount of memory being allocated. > > I think the reason for this because the link line has duplicates > of every lib. Amitha, is there anyway we can cut down on > these duplicates > and still avoid unresolved symbols. > > My office machine now has 2 GB of swap :-) > > Happy compiling! > > Chris > > > ----- End forwarded message ----- > _______________________________________________ > Cmake mailing list > Cmake@public.kitware.com > http://public.kitware.com/mailman/listinfo/cmake > From bill.hoffman@kitware.com Mon Nov 19 16:03:06 2001 From: bill.hoffman@kitware.com (Bill Hoffman) Date: Mon, 19 Nov 2001 11:03:06 -0500 Subject: [Cmake] Library link line compression (again) In-Reply-To: <000001c170e0$d2bcd360$22ea5882@ian> References: <20011116164029.I76467@cs.rpi.edu> Message-ID: <5.0.2.1.0.20011119105700.035a9e30@pop.nycap.rr.com> This should be done in the CMakeLists.txt files. I don't think cmake should clean them up. What if someone needs two copies of a library on the link line? It does happen in some projects. This is a problem with vxl and its use of cmake, and not cmake itself. The include LibCMakeLink.txt is causing most of the grief. I thought that was going to be removed from VXL anyway? If not, it could be include guarded? IF(VAR) LINK_.... ELSE(VAR) SET(VAR 1) ENDIF(VAR) The other issue is that cmake automatically duplicates all the -l stuff to avoid missing symbols on static links. Perhaps there should be a flag to turn this off? I think it is done only on the unix side. -Bill At 09:59 AM 11/19/2001 +0000, Ian Scott wrote: >Amitha, > >I had a go at doing this. I gave up because it didn't have any noticible >effect on DevStudio's loading or linking speed. I've lost the code, but the >algorithm should go something like this > > > >Add a function StripLinkLibrariesToTreeDependecy, called under the control >of some cache variable from cmMakeFile::FinalPass > >Method cmMakeFile::StripLinkLibrariesToTreeDependecy > Copy sequence of all linklibraries to LL > start = Beginning of LL > Starting from i = End of LL > --i; > Get Library L = *i > j = i; > While (j!= start) > j--; > if *j = *i > remove *j > shuffle all previous members (start, j-1) of LL up one > ++start; > Until i == start; > Copy LL back to LinkLibaries. >End > >Alternatively you could put the code in the FinalPass method of a new >Command StripLinkLibrariesToTreeDependecy > >Ian. > >> -----Original Message----- >> From: Amitha Perera [mailto:perera@cs.rpi.edu] >> Sent: Friday, November 16, 2001 9:40 PM >> To: cmake@public.kitware.com >> Cc: chrisc@cs.rpi.edu >> Subject: [Cmake] Library link line compression (again) >> >> >> Hi all >> >> Would anyone object to adding an option to CMake to allow link line >> compression? In particular, I think that most projects have a tree >> like library dependency, and it is possible for CMake to automatically >> eliminate duplicate libraries without causing linking failures. The >> default mode would be what it is now, which generates a long link line >> (for vxl, at least). >> >> As the message below indicates, this is probably a useful process, and >> a good step in lieu of a full dependency analysis. >> >> Amitha. >> >> >> ----- Forwarded message from "Christopher D. Carothers" >> ----- >> >> To: Amitha Perera >> From: "Christopher D. Carothers" >> Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST) >> Subject: fyi: static linking needs huge swap space! >> >> Folks, to link a static version of online tracining under linux >> (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in >> addition to 256 MB of RAM. I watched "top" as the final link was being >> done and you could just see the vast amount of memory being allocated. >> >> I think the reason for this because the link line has duplicates >> of every lib. Amitha, is there anyway we can cut down on >> these duplicates >> and still avoid unresolved symbols. >> >> My office machine now has 2 GB of swap :-) >> >> Happy compiling! >> >> Chris >> >> >> ----- End forwarded message ----- >> _______________________________________________ >> Cmake mailing list >> Cmake@public.kitware.com >> http://public.kitware.com/mailman/listinfo/cmake >> > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From tarifa@rpi.edu Mon Nov 26 20:16:48 2001 From: tarifa@rpi.edu (Asad A. Abu-Tarif) Date: Mon, 26 Nov 2001 15:16:48 -0500 Subject: [Cmake] IF statement in CMake Message-ID: <004a01c176b7$473fa290$30777180@aisl.rpi.edu> Hi, I started using CMake to control the compilation of my registration package (that uses vtk heavily). In my package, I'm supporting several vtk versions. In my CMakeLists files, I added a value for VTK_VERSION using: SET (VTK_VERSION 3.2 CACHE VALUE "VTK version" ) Now, I would like to use a statement like: IF (VTK_VERSION < 3.2) do some things ELSE ....etc. It seems that IF doesn't accept the 'less than' expression. Is something like this doable in CMake?? Sorry if this is a repeated question. Regards, Asad __________________________________________________ / Asad A. Abu-Tarif \ | Computer Engineering. | | PhD Candidate, Rensselaer Polytechnic Institute (RPI). | | tarifa@rpi.edu | \___________________________________________________/ From bill.hoffman@kitware.com Wed Nov 28 11:45:19 2001 From: bill.hoffman@kitware.com (William A. Hoffman) Date: Wed, 28 Nov 2001 06:45:19 -0500 Subject: [Cmake] IF statement in CMake In-Reply-To: <004a01c176b7$473fa290$30777180@aisl.rpi.edu> Message-ID: <5.0.2.1.0.20011128064418.02b95a78@pop.nycap.rr.com> There is currently no < in the IF. You might be able to use the MATCH in the IF. The MATCH is a regular expression matcher. -Bill At 03:16 PM 11/26/2001 -0500, Asad A. Abu-Tarif wrote: >Hi, >I started using CMake to control the compilation of my >registration package (that uses vtk heavily). >In my package, I'm supporting several vtk versions. >In my CMakeLists files, I added a value for VTK_VERSION >using: >SET (VTK_VERSION 3.2 CACHE VALUE "VTK version" ) > >Now, I would like to use a statement like: >IF (VTK_VERSION < 3.2) > do some things >ELSE ....etc. > >It seems that IF doesn't accept the 'less than' expression. > >Is something like this doable in CMake?? > >Sorry if this is a repeated question. >Regards, >Asad > __________________________________________________ > / Asad A. Abu-Tarif >\ > | Computer Engineering. >| > | PhD Candidate, Rensselaer Polytechnic Institute (RPI). | > | tarifa@rpi.edu >| > \___________________________________________________/ > > >_______________________________________________ >Cmake mailing list >Cmake@public.kitware.com >http://public.kitware.com/mailman/listinfo/cmake From millerjv@crd.ge.com Wed Nov 28 17:59:07 2001 From: millerjv@crd.ge.com (Miller, James V (CRD)) Date: Wed, 28 Nov 2001 12:59:07 -0500 Subject: [Cmake] How is CMAKE_USE_PTHREADS defined? Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C17836.5FF08590 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C17836.5FF08590" ------_=_NextPart_001_01C17836.5FF08590 Content-Type: text/plain; charset="iso-8859-1" How is the CMAKE_USE_PTHREADS defined by CMake? Does it only appear in the cache for Insight because itkConfigure.h.in has #cmakedefine CMAKE_USE_PTHREADS? If pthreads are used, STL needs an extra symbol defined _PTHREADS so that it will thread safe memory allocation. I added the definition in a CMakeLists.txt file (it may need to be UseITK.cmake or itkCMakeOptions.cmake instead) as a stop gap. But it would seem that CMake should automatically define this symbol if pthreads are being used on a project so that STL will be thread safe. Jim Miller _____________________________________ Visualization & Computer Vision GE Corporate Research & Development Bldg. KW, Room C218B P.O. Box 8, Schenectady NY 12301 millerjv@crd.ge.com < mailto:millerjv@crd.ge.com > (518) 387-4005, Dial Comm: 8*833-4005, Cell: (518) 505-7065, Fax: (518) 387-6981 ------_=_NextPart_001_01C17836.5FF08590 Content-Type: text/html; charset="iso-8859-1"
How is the CMAKE_USE_PTHREADS defined by CMake?  Does it only appear in the cache for Insight because itkConfigure.h.in has #cmakedefine CMAKE_USE_PTHREADS?
 
If pthreads are used, STL needs an extra symbol defined _PTHREADS so that it will thread safe memory allocation.  I added the definition in a CMakeLists.txt file (it may need to be UseITK.cmake or itkCMakeOptions.cmake instead) as a stop gap.  But it would seem that CMake should automatically define this symbol if pthreads are being used on a project so that STL will be thread safe.

Jim Miller
_____________________________________
Visualization & Computer Vision
GE Corporate Research & Development
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv@crd.ge.com <mailto:millerjv@crd.ge.com>

(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981


 
------_=_NextPart_001_01C17836.5FF08590-- ------_=_NextPart_000_01C17836.5FF08590 Content-Type: application/octet-stream; name="Miller, James V (CRD).vcf" Content-Disposition: attachment; filename="Miller, James V (CRD).vcf" BEGIN:VCARD VERSION:2.1 N:Miller;James FN:Miller, James V (CRD) ORG:CRD;ESL TITLE:Computer Scientist TEL;WORK;VOICE:*833-4005 TEL;WORK;VOICE:1 518 387-4005 ADR;WORK:;KW-C218B;P.O. Box 8;Schenectady;New York;12301;USA LABEL;WORK;ENCODING=QUOTED-PRINTABLE:KW-C218B=0D=0AP.O. Box 8=0D=0ASchenectady, New York 12301=0D=0AUSA EMAIL;PREF;INTERNET:millerjv@crd.ge.com REV:20010420T140329Z END:VCARD ------_=_NextPart_000_01C17836.5FF08590-- From ibanez@choroid.cs.unc.edu Thu Nov 29 07:12:13 2001 From: ibanez@choroid.cs.unc.edu (Luis Ibanez) Date: Thu, 29 Nov 2001 02:12:13 -0500 (EST) Subject: [Cmake] Generating code during the build: Fluid FLTK Message-ID: Hi, I'm adding a new command: cmFLTKWrapUICommand It is intended to support the code generation from FLTK .fl files. These files contain the specification of the GUI created interactively with "Fluid". A command like fluid -c -h myGUI.h -o myGUI.cxx myGUI.fl will generate the .h and .cxx files using information from the .fl file. The command is to be used with two SourceList: FLTK_WRAP_UI( FluidGUISourceList GeneratedCxxSourceList) the first source list should contain all the .fl file of the application. When run this command will generate the names for the .cxx and .h files and insert them in the second SourceList. The command was based on cmQTWrapUICommand, but a number of changes where done. In particular concerninng the use of AddCustomCommand(). There is however a problem with the creation of the customCommand in m_Makefile. The method verifies if the target in question already exists or not. In this case the targets are the .cxx and .h generated files. A for that reason this new command is inserting directly the .cxx and .h as targets of the built. In order to support these files as a Type of targets was added to cmTarget: "GENERATED_CODE". A residual problem is appearing with the custom rule for the .h file, its rule is missing in the Makefile (under Linux). It seems that somewhere in the process the fils with .h extension are ignored as targets... The Custom rule for .cxx is working ok. Any suggestions ? Thanks, Luis -- Luis Ibanez CB#: 7060 Research Assistan Professor phone: (919) 843 5436 Division of Neurosurgery fax: (919) 966 6627 University of North Carolina at Chapel Hill email: ibanez@cs.unc.edu Chapel Hill, NC 27599-7060 http://www.cs.unc.edu/~ibanez From bettingf@cs.man.ac.uk Thu Nov 29 08:06:43 2001 From: bettingf@cs.man.ac.uk (Franck Bettinger) Date: Thu, 29 Nov 2001 08:06:43 +0000 Subject: [Cmake] Generating code during the build: Fluid FLTK In-Reply-To: References: Message-ID: <01112908064300.24137@gwa12> Hi Luis, It appears that the .h file can not be found. As this file does not exist at the time of the target creation, I've added a rule in cmMakeDepend.cxx that also look if the file will not be generated. Unfortunately there was a problem with the matching of the path (since we only know the name of the file itself and not its path). I had to guess the path by looking at the include directories. So you have to add an INCLUDE_DIRECTORIES rule in your CMakeLists.txt that tells cmake where to look for. For instance, with the Qt ui wrapper and vxl, I use a rule like this : INCLUDE_DIRECTORIES( ${allvxl_BINARY_DIR} ) ... QT_WRAP_UI(drawing drawing_ui_headers drawing_ui_sources drawing_interfaces ) and I include the .h file using : #include so that cmMakeDepend.cxx can find that the file ${allvxl_BINARY_DIR}/programs/drawing/drawing.h is in the target list. Beware not to use a "/" at the end of your INCLUDE_DIRECTORIES path because the algorithm append it automatically and two "/" would cause the matching to fail. I hope it helps. Franck On Thursday 29 November 2001 07:12, Luis Ibanez wrote: > Hi, > > I'm adding a new command: cmFLTKWrapUICommand [...] > There is however a problem with the creation of > the customCommand in m_Makefile. The method > verifies if the target in question already > exists or not. In this case the targets > are the .cxx and .h generated files. A for that > reason this new command is inserting directly > the .cxx and .h as targets of the built. > > > In order to support these files as a Type of > targets was added to cmTarget: "GENERATED_CODE". > > A residual problem is appearing with the > custom rule for the .h file, its rule > is missing in the Makefile (under Linux). > It seems that somewhere in the process > the fils with .h extension are ignored as > targets... The Custom rule for .cxx is working > ok. > > > Any suggestions ? > > Thanks, > > Luis -- -- ========================================= Franck BETTINGER PhD student Imaging Science and Biomedical Engineering University of Manchester bettingf@cs.man.ac.uk ========================================== From ken.martin@kitware.com Fri Nov 30 20:50:50 2001 From: ken.martin@kitware.com (Ken Martin) Date: Fri, 30 Nov 2001 15:50:50 -0500 Subject: [Cmake] cmake-mode.el Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_002A_01C179B6.C9399F10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Here is a fairly bad emacs mode for cmake. Maybe someone smarter than I can figure out how to get the: IF (foo) INDENT MWE ENDIF (foo) to work. Thanks Ken -------------------------- Ken Martin, PhD Kitware Inc. 518 371-3971 x101 469 Clifton Corporate Pkwy. Clifton Park, NY 12065 ------=_NextPart_000_002A_01C179B6.C9399F10 Content-Type: application/octet-stream; name="make-regexp.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="make-regexp.el" ;;; make-regexp.el --- generate efficient regexps to match strings.=0A= =0A= ;; Copyright (C) 1994, 1995 Simon Marshall.=0A= =0A= ;; Author: Simon Marshall =0A= ;; Keywords: strings, regexps=0A= ;; Version: 1.02=0A= =0A= ;; LCD Archive Entry:=0A= ;; make-regexp|Simon Marshall|simon@gnu.ai.mit.edu|=0A= ;; Generate efficient regexps to match strings.|=0A= ;; 11-Jul-1995|1.02|~/functions/make-regexp.el.gz|=0A= =0A= ;; The archive is archive.cis.ohio-state.edu in = /pub/gnu/emacs/elisp-archive.=0A= =0A= ;;; This file is not part of GNU Emacs.=0A= =0A= ;;; This program is free software; you can redistribute it and/or modify=0A= ;;; it under the terms of the GNU General Public License as published by=0A= ;;; the Free Software Foundation; either version 2, or (at your option)=0A= ;;; any later version.=0A= =0A= ;;; This program is distributed in the hope that it will be useful,=0A= ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=0A= ;;; GNU General Public License for more details.=0A= =0A= ;;; You should have received a copy of the GNU General Public License=0A= ;;; along with GNU Emacs; see the file COPYING. If not, write to=0A= ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.=0A= =0A= ;;; Commentary:=0A= =0A= ;; Purpose:=0A= ;;=0A= ;; To make efficient regexps from lists of strings.=0A= =0A= ;; For example:=0A= ;;=0A= ;; (let ((strings '("cond" "if" "while" "let\\*?" "prog1" "prog2" "progn"=0A= ;; "catch" "throw" "save-restriction" "save-excursion"=0A= ;; "save-window-excursion" "save-match-data"=0A= ;; "unwind-protect" "condition-case" "track-mouse")))=0A= ;; (concat "(" (make-regexp strings t)))=0A= ;;=0A= ;; =3D> = "(\\(c\\(atch\\|ond\\(\\|ition-case\\)\\)\\|if\\|let\\*?\\|prog[12n]\\|sa= ve-\\(excursion\\|match-data\\|restriction\\|window-excursion\\)\\|t\\(hr= ow\\|rack-mouse\\)\\|unwind-protect\\|while\\)"=0A= ;;=0A= ;; To search for the above regexp takes about 70% of the time as for the = simple=0A= ;; (concat "(\\(" (mapconcat 'identity strings "\\|") "\\)") regexp.=0A= ;;=0A= ;; Obviously, the more the similarity between strings, the faster the = regexp:=0A= ;;=0A= ;; (make-regexp '("abort" "abs" "accept" "access" "array" "begin" "body" = "case"=0A= ;; "constant" "declare" "delay" "delta" "digits" "else" = "elsif"=0A= ;; "entry" "exception" "exit" "function" "generic" = "goto" "if"=0A= ;; "others" "limited" "loop" "mod" "new" "null" "out" = "subtype"=0A= ;; "package" "pragma" "private" "procedure" "raise" = "range"=0A= ;; "record" "rem" "renames" "return" "reverse" "select"=0A= ;; "separate" "task" "terminate" "then" "type" "when" = "while"=0A= ;; "with" "xor"))=0A= ;;=0A= ;; =3D> = "a\\(b\\(ort\\|s\\)\\|cce\\(pt\\|ss\\)\\|rray\\)\\|b\\(egin\\|ody\\)\\|c\= \(ase\\|onstant\\)\\|d\\(e\\(clare\\|l\\(ay\\|ta\\)\\)\\|igits\\)\\|e\\(l= s\\(e\\|if\\)\\|ntry\\|x\\(ception\\|it\\)\\)\\|function\\|g\\(eneric\\|o= to\\)\\|if\\|l\\(imited\\|oop\\)\\|mod\\|n\\(ew\\|ull\\)\\|o\\(thers\\|ut= \\)\\|p\\(ackage\\|r\\(agma\\|ivate\\|ocedure\\)\\)\\|r\\(a\\(ise\\|nge\\= )\\|e\\(cord\\|m\\|names\\|turn\\|verse\\)\\)\\|s\\(e\\(lect\\|parate\\)\= \|ubtype\\)\\|t\\(ask\\|erminate\\|hen\\|ype\\)\\|w\\(h\\(en\\|ile\\)\\|i= th\\)\\|xor"=0A= ;;=0A= ;; To search for the above regexp takes less than 60% of the time of the = simple=0A= ;; mapconcat equivalent.=0A= ;;=0A= ;; But even small regexps may be worth it:=0A= ;;=0A= ;; (make-regexp '("and" "at" "do" "end" "for" "in" "is" "not" "of" "or" = "use"))=0A= ;; =3D> "a\\(nd\\|t\\)\\|do\\|end\\|for\\|i[ns]\\|not\\|o[fr]\\|use"=0A= ;;=0A= ;; as this is 10% faster than the mapconcat equivalent.=0A= =0A= ;; Installation:=0A= ;; =0A= ;; (autoload 'make-regexp "make-regexp"=0A= ;; "Return a regexp to match a string item in STRINGS.")=0A= ;;=0A= ;; (autoload 'make-regexps "make-regexp"=0A= ;; "Return a regexp to REGEXPS.")=0A= ;;=0A= ;; Since these functions were written to produce efficient regexps, not = regexps=0A= ;; efficiently, it is probably not a good idea to in-line too many calls = in=0A= ;; your code, unless you use the following neat trick with = `eval-when-compile':=0A= ;;=0A= ;; (defvar definition-regexp=0A= ;; (let ((regexp (eval-when-compile=0A= ;; (make-regexp '("defun" "defsubst" "defmacro" = "defalias"=0A= ;; "defvar" "defconst" "defadvice") = t))))=0A= ;; (concat "^(" regexp)))=0A= ;;=0A= ;; The `byte-compile' code will be as if you had defined the variable = thus:=0A= ;;=0A= ;; (defvar definition-regexp=0A= ;; = "^(\\(def\\(a\\(dvice\\|lias\\)\\|const\\|macro\\|subst\\|un\\|var\\)\\)"= )=0A= =0A= ;; Feedback:=0A= ;;=0A= ;; Originally written for font-lock, from an idea from Stig's hl319.=0A= ;; Please don't tell me that it doesn't produce optimal regexps; I know = that=0A= ;; already. But (ideas or) code to improve things (are) is welcome. = Please=0A= ;; test your code and tell me the speed up in searching an appropriate = buffer.=0A= ;;=0A= ;; Please send me bug reports, bug fixes, and extensions, etc.=0A= ;; Simon Marshall =0A= =0A= ;; History:=0A= ;;=0A= ;; 1.00--1.01:=0A= ;; - Made `make-regexp' take `lax' to force top-level parentheses.=0A= ;; - Fixed `make-regexps' for MATCH bug and new `font-lock-keywords'.=0A= ;; - Added `unfontify' to user timing functions.=0A= ;; 1.01--1.02:=0A= ;; - Made `make-regexp' `let' a big `max-lisp-eval-depth'.=0A= =0C=0A= ;; The basic idea is to find the shortest common non-"" prefix each = time, and=0A= ;; squirrel it out. If there is no such prefix, we divide the list into = two so=0A= ;; that (at least) one half will have at least a one-character common = prefix.=0A= =0A= ;; In addition, we (a) delay the addition of () parenthesis as long as = possible=0A= ;; (until we're sure we need them), and (b) try to squirrel out = one-character=0A= ;; sequences (so we can use [] rather than ()).=0A= =0A= (defun make-regexp (strings &optional paren lax)=0A= "Return a regexp to match a string item in STRINGS.=0A= If optional PAREN non-nil, output regexp parentheses around returned = regexp.=0A= If optional LAX non-nil, don't output parentheses if it doesn't require = them.=0A= Merges keywords to avoid backtracking in Emacs' regexp matcher."=0A= (let* ((max-lisp-eval-depth (* 1024 1024))=0A= (strings (let ((l strings)) ; Paranoia---make strings unique!=0A= (while l (setq l (setcdr l (delete (car l) (cdr l)))))=0A= (sort strings 'string-lessp)))=0A= (open-paren (if paren "\\(" "")) (close-paren (if paren "\\)" ""))=0A= (open-lax (if lax "" open-paren)) (close-lax (if lax "" close-paren))=0A= (completion-ignore-case nil))=0A= (cond=0A= ;; If there's only one string, just return it.=0A= ((=3D (length strings) 1)=0A= (concat open-lax (car strings) close-lax))=0A= ;; If there's an empty string, pull it out.=0A= ((string=3D (car strings) "")=0A= (if (and (=3D (length strings) 2) (=3D (length (nth 1 strings)) 1))=0A= (concat open-lax (nth 1 strings) "?" close-lax)=0A= (concat open-paren "\\|" (make-regexp (cdr strings)) close-paren)))=0A= ;; If there are only one-character strings, make a [] list instead.=0A= ((=3D (length strings) (apply '+ (mapcar 'length strings)))=0A= (concat open-lax "[" (mapconcat 'identity strings "") "]" = close-lax))=0A= (t=0A= ;; We have a list of strings. Is there a common prefix?=0A= (let ((prefix (try-completion "" (mapcar 'list strings))))=0A= (if (> (length prefix) 0)=0A= ;; Common prefix! Squirrel it out and recurse with the suffixes.=0A= (let* ((len (length prefix))=0A= (sufs (mapcar '(lambda (str) (substring str len)) strings)))=0A= (concat open-paren prefix (make-regexp sufs t t) close-paren))=0A= ;; No common prefix. Is there a one-character sequence?=0A= (let ((letters (let ((completion-regexp-list '("^.$")))=0A= (all-completions "" (mapcar 'list strings)))))=0A= (if (> (length letters) 1)=0A= ;; Do the one-character sequences, then recurse on the rest.=0A= (let ((rest (let ((completion-regexp-list '("^..+$")))=0A= (all-completions "" (mapcar 'list strings)))))=0A= (concat open-paren=0A= (make-regexp letters) "\\|" (make-regexp rest)=0A= close-paren))=0A= ;; No one-character sequence, so divide the list into two by=0A= ;; dividing into those that start with a particular letter, and=0A= ;; those that do not.=0A= (let* ((char (substring (car strings) 0 1))=0A= (half1 (all-completions char (mapcar 'list strings)))=0A= (half2 (nthcdr (length half1) strings)))=0A= (concat open-paren=0A= (make-regexp half1) "\\|" (make-regexp half2)=0A= close-paren))))))))))=0A= =0C=0A= ;; This stuff is realy for font-lock...=0A= =0A= ;; Ahhh, the wonders of lisp...=0A= (defun regexp-span (regexp &optional start)=0A= "Return the span or depth of REGEXP.=0A= This means the number of \"\\\\(...\\\\)\" pairs in REGEXP, optionally = from START."=0A= (let ((match (string-match (regexp-quote "\\(") regexp (or start 0))))=0A= (if (not match) 0 (1+ (regexp-span regexp (match-end 0))))))=0A= =0A= ;; The basic idea is to concat the regexps together, keeping count of = the span=0A= ;; of the regexps so that we can get the correct match for hilighting.=0A= (defun make-regexps (&rest regexps)=0A= "Return a regexp to match REGEXPS=0A= Each item of REGEXPS should be of the form:=0A= =0A= STRING ; A STRING to be used literally.=0A= (STRING MATCH FACE DATA) ; Match STRING at depth MATCH = with FACE=0A= ; and highlight according to = DATA.=0A= (STRINGS FACE DATA) ; STRINGS is a list of strings = FACE is=0A= ; to highlight according to DATA.=0A= =0A= Returns a list of the form:=0A= =0A= (REGEXP (MATCH FACE DATA) ...)=0A= =0A= For example:=0A= =0A= (make-regexps \"^(\"=0A= '((\"defun\" \"defalias\" \"defsubst\" \"defadvice\") = keyword)=0A= \"[ \t]*\"=0A= '(\"\\\\([a-zA-Z-]+\\\\)?\" 1 function-name nil t))=0A= =0A= =3D>=0A= =0A= (\"^(\\\\(def\\\\(a\\\\(dvice\\\\|lias\\\\)\\\\|subst\\\\|un\\\\)\\\\)[ = ]*\\\\([a-zA-Z-]+\\\\)?\"=0A= (1 keyword) (4 function-name nil t))=0A= =0A= Uses `make-regexp' to make efficient regexps."=0A= (let ((regexp "") (data ()))=0A= (while regexps=0A= (cond ((stringp (car regexps))=0A= (setq regexp (concat regexp (car regexps))))=0A= ((stringp (nth 0 (car regexps)))=0A= (setq data (cons (cons (+ (regexp-span regexp)=0A= (nth 1 (car regexps)))=0A= (nthcdr 2 (car regexps)))=0A= data)=0A= regexp (concat regexp (nth 0 (car regexps)))))=0A= (t=0A= (setq data (cons (cons (1+ (regexp-span regexp))=0A= (cdr (car regexps)))=0A= data)=0A= regexp (concat regexp (make-regexp (nth 0 (car regexps))=0A= t)))))=0A= (setq regexps (cdr regexps)))=0A= (cons regexp (nreverse data))))=0A= =0C=0A= ;; Crude-rude timing...=0A= =0A= (defsubst time-seconds (&optional time)=0A= "Return the TIME in seconds, or the current time if not given.=0A= TIME should be the same format as produced by `current-time'."=0A= (let ((time (or time (current-time))))=0A= (+ (* (nth 0 time) 65536.0) (nth 1 time) (/ (nth 2 time) = 1000000.0))))=0A= =0A= (defsubst time-since (time)=0A= "Return the time in seconds since TIME.=0A= TIME should be the value of `current-time' or `time-seconds'."=0A= (- (time-seconds) (if (floatp time) time (time-seconds time))))=0A= =0A= (defun time-function (func &rest args)=0A= "Return the time in seconds taken to execute FUNC with ARGS.=0A= Returned is actually the cons pair (func-value . time)."=0A= (garbage-collect)=0A= (let ((start (time-seconds)))=0A= (cons (apply func args) (time-since start))))=0A= =0A= (defun time-regexps (regexps &optional buffer unfontify)=0A= "Return corresponding list of times to fontify using REGEXPS.=0A= Fontify using BUFFER, if non-nil, and UNFONTIFY first, if non-nil."=0A= (save-excursion=0A= (and buffer (set-buffer buffer))=0A= (let ((beg (point-min)) (end (point-max)))=0A= (and unfontify (font-lock-unfontify-region beg end))=0A= (mapcar (function (lambda (regexp)=0A= (let ((font-lock-keywords (list regexp)))=0A= (cons (cdr (time-function 'font-lock-hack-keywords beg end))=0A= regexp))))=0A= regexps))))=0A= =0A= (defun sort-font-lock-regexps (regexps &optional buffer unfontify)=0A= "Return sorted times to fontify syntactically and using REGEXPS.=0A= UNFONTIFY first, if non-nil."=0A= (let ((regexp-time (time-regexps regexps buffer unfontify)))=0A= (cons (list (apply '+ (mapcar 'car regexp-time)) 'regexps)=0A= (nreverse (sort regexp-time 'car-less-than-car)))))=0A= =0A= (defun time-fontification (&optional buffer unfontify)=0A= "Return time to fontify syntactically.=0A= UNFONTIFY first, if non-nil."=0A= (save-excursion=0A= (and buffer (set-buffer buffer))=0A= (let ((beg (point-min)) (end (point-max)))=0A= (and unfontify (font-lock-unfontify-region beg end))=0A= (cdr (time-function 'font-lock-fontify-region beg end)))))=0A= =0A= (defun sort-font-lock-fontification (regexps &optional buffer unfontify)=0A= "Return sorted times to fontify syntactically and using REGEXPS.=0A= UNFONTIFY first, if non-nil."=0A= (let ((syntactic-time (time-fontification buffer unfontify))=0A= (regexp-time (time-regexps regexps buffer)))=0A= (nreverse=0A= (sort (append (list (list syntactic-time 'syntactic)=0A= (list (apply '+ (mapcar 'car regexp-time)) 'regexps))=0A= regexp-time)=0A= 'car-less-than-car))))=0A= =0A= ;;; make-regexp.el ends here=0A= ------=_NextPart_000_002A_01C179B6.C9399F10-- From ken.martin@kitware.com Fri Nov 30 21:01:46 2001 From: ken.martin@kitware.com (Ken Martin) Date: Fri, 30 Nov 2001 16:01:46 -0500 Subject: [Cmake] And here is the mode not just the regexp Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_002F_01C179B8.4FA7E0B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit -------------------------- Ken Martin, PhD Kitware Inc. 518 371-3971 x101 469 Clifton Corporate Pkwy. Clifton Park, NY 12065 ------=_NextPart_000_002F_01C179B8.4FA7E0B0 Content-Type: application/octet-stream; name="cmake-mode.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cmake-mode.el" ;;; tcl-mode.el --- a major-mode for editing cmake/tk scripts=0A= =0A= ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.=0A= =0A= ;; Author: Gregor Schmid =0A= ;; Keywords: languages, processes, tools=0A= =0A= ;; This file is part of GNU Emacs.=0A= =0A= ;; GNU Emacs is free software; you can redistribute it and/or modify=0A= ;; it under the terms of the GNU General Public License as published by=0A= ;; the Free Software Foundation; either version 2, or (at your option)=0A= ;; any later version.=0A= =0A= ;; GNU Emacs is distributed in the hope that it will be useful,=0A= ;; but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=0A= ;; GNU General Public License for more details.=0A= =0A= ;; You should have received a copy of the GNU General Public License=0A= ;; along with GNU Emacs; see the file COPYING. If not, write to the=0A= ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,=0A= ;; Boston, MA 02111-1307, USA.=0A= =0A= ;;; Commentary:=0A= =0A= ;; Special Thanks to Simon Marshall for=0A= ;; font-lock patches.=0A= =0A= ;; This file was written with emacs using Jamie Lokier's folding mode=0A= ;; That's what the funny ;;willow marks are there for=0A= =0A= ;;willow Usage=0A= =0A= ;; Cmake3-mode supports c-mode style formatting and sending of=0A= ;; lines/regions/files to a cmake interpreter. An interpreter (see=0A= ;; variable `cmake-default-application') will be started if you try to=0A= ;; send some code and none is running. You can use the process-buffer=0A= ;; (named after the application you chose) as if it were an=0A= ;; interactive shell. See the documentation for `comint.el' for=0A= ;; details.=0A= =0A= ;;bongo=0A= ;;willow Key-bindings=0A= =0A= ;; To see all the keybindings for folding mode, look at = `cmake-setup-keymap'=0A= ;; or start `cmake-mode' and type `\C-h m'.=0A= ;; The keybindings may seem strange, since I prefer to use them with=0A= ;; cmake-prefix-key set to nil, but since those keybindings are already = used=0A= ;; the default for `cmake-prefix-key' is `\C-c', which is the = conventional=0A= ;; prefix for major-mode commands.=0A= =0A= ;; You can customise the keybindings either by setting `cmake-prefix-key'=0A= ;; or by putting the following in your .emacs=0A= ;; (setq cmake-mode-map (make-sparse-keymap))=0A= ;; and=0A= ;; (define-key cmake-mode-map )=0A= ;; for all the functions you need.=0A= =0A= ;;bongo=0A= ;;willow Variables=0A= =0A= ;; You may want to customize the following variables:=0A= ;; cmake-indent-level=0A= ;; cmake-always-show=0A= ;; cmake-mode-map=0A= ;; cmake-prefix-key=0A= ;; cmake-mode-hook=0A= =0A= ;;bongo=0A= =0A= ;;; Code:=0A= =0A= ;; We need that !=0A= (require 'comint)=0A= =0A= ;;willow variables=0A= =0A= (defgroup cmake nil=0A= "Major mode for editing cmake/tk code."=0A= :prefix "cmake-"=0A= :group 'languages)=0A= =0A= (defvar cmake-mode-map nil=0A= "Keymap used with cmake mode.")=0A= =0A= (defvar cmake-prefix-key "\C-c"=0A= "Prefix for all cmake-mode commands.")=0A= =0A= (defcustom cmake-mode-hook nil=0A= "Hooks called when cmake mode fires up."=0A= :type 'hook=0A= :group 'cmake)=0A= =0A= (defvar cmake-region-start (make-marker)=0A= "Start of special region for cmake communication.")=0A= =0A= (defvar cmake-region-end (make-marker)=0A= "End of special region for cmake communication.")=0A= =0A= (defcustom cmake-indent-level 4=0A= "Amount by which cmake subexpressions are indented."=0A= :type 'integer=0A= :group 'cmake)=0A= =0A= (defcustom cmake-default-eval "eval"=0A= "Default command used when sending regions."=0A= :type 'string=0A= :group 'cmake)=0A= =0A= (defvar cmake-mode-menu (make-sparse-keymap "Cmake3-Mode")=0A= "Keymap for cmake-mode's menu.")=0A= =0A= (defvar cmake-font-lock-keywords=0A= (eval-when-compile=0A= (list=0A= ;;=0A= ;; Function name declarations.=0A= '("\\<\\(icmake_class\\|class\\|method\\|proc\\|body\\)\\>[ = \t]*\\(\\sw+\\)?"=0A= (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))=0A= ;;=0A= ;; Keywords.=0A= (concat "\\<\\("=0A= "A\\(BSTRACT_FILES\\|DD_\\(CUSTOM_COMMAND\\|DE\\(FINITIONS\\|PENDENCIES\\= )\\|EXECUTABLE\\|LIBRARY\\|TEST\\)\\|UX_SOURCE_DIRECTORY\\)\\|BUILD_\\(CO= MMAND\\|NAME\\)\\|C\\(ABLE_\\(CLASS_SET\\|WRAP_TCL\\)\\|ONFIGURE_\\(FILE\= \|GCCXML\\)\\)\\|E\\(LSE\\|N\\(ABLE_TESTING\\|D\\(FOREACH\\|IF\\)\\)\\)\\= |F\\(IND_\\(FILE\\|LIBRARY\\|P\\(ATH\\|ROGRAM\\)\\)\\|LTK_WRAP_UI\\|OREAC= H\\)\\|GET_FILENAME_COMPONENT\\|I\\(F\\|N\\(CLUDE\\(\\|_\\(DIRECTORIES\\|= EXTERNAL_MSPROJECT\\|REGULAR_EXPRESSION\\)\\)\\|STALL_\\(FILES\\|PROGRAMS= \\|TARGETS\\)\\)\\)\\|L\\(I\\(BRARY\\|NK_\\(DIRECTORIES\\|LIBRARIES\\)\\)= \\|OAD_CACHE\\)\\|M\\(A\\(KE_DIRECTORY\\|RK_AS_ADVANCED\\)\\|ESSAGE\\)\\|= O\\(PTION\\|UTPUT_REQUIRED_FILES\\)\\|PROJECT\\|QT_WRAP_\\(CPP\\|UI\\)\\|= S\\(ET\\|ITE_NAME\\|OURCE_\\(FILES\\(\\|_REMOVE\\)\\|GROUP\\)\\|UBDIR\\(S= \\|_DEPENDS\\)\\)\\|TARGET_LINK_LIBRARIES\\|U\\(SE_MANGLED_MESA\\|TILITY_= SOURCE\\)\\|V\\(ARIABLE_REQUIRES\\|TK_WRAP_\\(JAVA\\|PYTHON\\|TCL\\)\\)\\= |WRAP_EXCLUDE_FILES"=0A= "\\)\\>")=0A= ;;=0A= ;; Types.=0A= ; (make-regexp '("global" "upvar" "variable" "inherit" "public"=0A= ; "private" "protected" "common"))=0A= (cons (concat "\\<\\("=0A= "common\\|global\\|inherit\\|p\\(r\\(ivate\\|otected\\)\\|ublic\\)"=0A= "\\|upvar\\|variable"=0A= "\\)\\>")=0A= 'font-lock-type-face)=0A= ))=0A= "Default expressions to highlight in CMAKE3 modes.")=0A= =0A= (defvar cmake-imenu-generic-expression=0A= '(=0A= (nil "^\\s-*\\(proc\\|body\\)\\s-+\\(\\(\\s_\\|\\sw\\)+\\)" 2)=0A= ("Classes" "^\\s-*class\\s-+\\(\\(\\s_\\|\\sw\\)+\\)" 1))=0A= =0A= "Imenu generic expression for cmake-mode. See = `imenu-generic-expression'.")=0A= =0A= =0A= ;;bongo=0A= ;;willow cmake-mode=0A= =0A= ;;;###autoload=0A= (defun cmake-mode ()=0A= "Major mode for editing cmake scripts.=0A= The following keys are bound:=0A= \\{cmake-mode-map}=0A= "=0A= (interactive)=0A= (let ((switches nil)=0A= s)=0A= (kill-all-local-variables)=0A= (setq major-mode 'cmake-mode)=0A= (setq mode-name "CMAKE3")=0A= (set (make-local-variable 'indent-line-function) 'cmake-indent-line)=0A= (set (make-local-variable 'comment-start) "# ")=0A= (set (make-local-variable 'comment-start-skip) "# *")=0A= (set (make-local-variable 'font-lock-defaults)=0A= '(cmake-font-lock-keywords nil nil ((?_ . "w") (?: . "w"))))=0A= (set (make-local-variable 'imenu-generic-expression)=0A= cmake-imenu-generic-expression)=0A= (setq imenu-case-fold-search nil)=0A= (make-local-variable 'cmake-default-eval)=0A= (or cmake-mode-map=0A= (cmake-setup-keymap))=0A= (use-local-map cmake-mode-map)=0A= (set-syntax-table (copy-syntax-table))=0A= (modify-syntax-entry ?# "<")=0A= (modify-syntax-entry ?\n ">")=0A= (run-hooks 'cmake-mode-hook)))=0A= =0A= ;;bongo=0A= ;;willow cmake-setup-keymap=0A= =0A= (defun cmake-setup-keymap ()=0A= "Set up keymap for cmake mode.=0A= If the variable `cmake-prefix-key' is nil, the bindings go directly=0A= to `cmake-mode-map', otherwise they are prefixed with = `cmake-prefix-key'."=0A= (setq cmake-mode-map (make-sparse-keymap))=0A= (define-key cmake-mode-map [menu-bar cmake-mode]=0A= (cons "Cmake3-Mode" cmake-mode-menu))=0A= (let ((map (if cmake-prefix-key=0A= (make-sparse-keymap)=0A= cmake-mode-map)))=0A= ;; indentation=0A= (define-key cmake-mode-map [?\)] 'cmake-electric-brace)=0A= ;; communication=0A= (define-key map "\C-\M-s" 'cmake-set-cmake-region-start)=0A= (define-key map "\C-\M-e" 'cmake-set-cmake-region-end)=0A= (define-key map "\C-\M-r" 'cmake-send-cmake-region)=0A= (if cmake-prefix-key=0A= (define-key cmake-mode-map cmake-prefix-key map))=0A= ))=0A= =0A= ;;bongo=0A= ;;willow indentation=0A= =0A= (defun cmake-electric-brace (arg)=0A= "Insert `)' and indent line for cmake."=0A= (interactive "P")=0A= (insert-char ?\) (prefix-numeric-value arg))=0A= (cmake-indent-line)=0A= (blink-matching-open))=0A= =0A= ;;willow cmake-indent-line=0A= =0A= (defun cmake-indent-line ()=0A= "Indent current line as cmake code.=0A= Return the amount the indentation changed by."=0A= (let ((indent (cmake-calculate-indentation nil))=0A= beg shift-amt=0A= (case-fold-search nil)=0A= (pos (- (point-max) (point))))=0A= (beginning-of-line)=0A= (setq beg (point))=0A= (skip-chars-forward " \t")=0A= (save-excursion=0A= (while (eq (following-char) ?\))=0A= (setq indent (max (- indent cmake-indent-level) 0))=0A= (forward-char 1)=0A= (if (looking-at "\\([ \t]*\\)\)")=0A= (progn=0A= (delete-region (match-beginning 1) (match-end 1))=0A= (insert-char ? (1- cmake-indent-level))))))=0A= (setq shift-amt (- indent (current-column)))=0A= (if (zerop shift-amt)=0A= (if (> (- (point-max) pos) (point))=0A= (goto-char (- (point-max) pos)))=0A= (delete-region beg (point))=0A= (indent-to indent)=0A= ;; If initial point was within line's indentation,=0A= ;; position after the indentation. Else stay at same point in = text.=0A= (if (> (- (point-max) pos) (point))=0A= (goto-char (- (point-max) pos))))=0A= shift-amt))=0A= =0A= ;;bongo=0A= ;;willow cmake-calculate-indentation=0A= =0A= (defun cmake-calculate-indentation (&optional parse-start)=0A= "Return appropriate indentation for current line as cmake code.=0A= In usual case returns an integer: the column to indent to."=0A= (let ((pos (point)))=0A= (save-excursion=0A= (if parse-start=0A= (setq pos (goto-char parse-start)))=0A= (beginning-of-line)=0A= (if (bobp)=0A= (current-indentation)=0A= (forward-char -1)=0A= (if (eq (preceding-char) ?\\)=0A= (+ (current-indentation)=0A= (progn=0A= (beginning-of-line)=0A= (if (bobp)=0A= (* 2 cmake-indent-level)=0A= (forward-char -1)=0A= (if (not (eq (preceding-char) ?\\))=0A= (* 2 cmake-indent-level)=0A= 0))))=0A= (forward-char 1)=0A= (if (re-search-backward=0A= "\\(^[^ \t\n\r#]\\)\\|\\(\([^\)]*[#\n]\\)\\|\\(\)\\s *\n\\)"=0A= nil t)=0A= (+ (- (current-indentation)=0A= (if (save-excursion=0A= (beginning-of-line)=0A= (and (not (bobp))=0A= (progn=0A= (forward-char -1)=0A= (eq (preceding-char) ?\\))))=0A= (* 2 cmake-indent-level)=0A= 0))=0A= (if (eq (following-char) ?\()=0A= cmake-indent-level=0A= 0))=0A= (goto-char pos)=0A= (beginning-of-line)=0A= (forward-line -1)=0A= (current-indentation)))))))=0A= =0A= ;;bongo=0A= =0A= ;;bongo=0A= ;;willow searching=0A= =0A= =0A= (provide 'cmake-mode)=0A= =0A= =0C=0A= ;;willow Emacs local variables=0A= =0A= ;; Local Variables:=0A= ;; folded-file: t=0A= ;; End:=0A= =0A= ;;bongo=0A= =0A= ;;; cmake-mode.el ends here=0A= ------=_NextPart_000_002F_01C179B8.4FA7E0B0--