Re: [CMake] Adding a new language
On 11/16/2011 4:03 PM, Alan W. Irwin wrote: Hi Bill: Your summary shows you misunderstood what I said so I have to correct that. The basic issue I have with your interpretation is "additional generic language support" != "Creating a generic way to add new languages" OK, let me try again. Adding any new feature to CMake, that will work on all platforms is a pretty huge task, and will require some serious funding, or someone with lots of free time and skill. I do not see any low hanging fruit or easy to do things in what you are asking for. Perhaps other developers will. The Fortran support was funded by a group at Sandia labs, and was implemented over many months of effort. It is also a slighty different beast as the IDE's like VS can have Fortran support. So, coming up with a makefile only solution can work with the IDE as well. ADA and OCaml do not have the same IDE support. -Bill -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 2011-11-15 23:35-0500 Bill Hoffman wrote: On 11/14/2011 3:24 PM, Alan W. Irwin wrote: If you are willing to make such an OCaml summary, I would be willing to do the same thing for Ada to make our joint case to the CMake developers of what kind of additional generic language support is needed by CMake to deal with the complicated build needs of languages such as OCaml and Ada (and Fortran 95) in a completely generic way. There is no case to make, I would love to improve the general language support. However, either you find someone to develop this for you, or you find someone willing to pay someone to develop it. That is really how open source works. Creating a generic way to add new languages that will work on all platforms is a pretty huge task, and will require some serious funding, or someone with lots of free time and skill. Hi Bill: Your summary shows you misunderstood what I said so I have to correct that. The basic issue I have with your interpretation is "additional generic language support" != "Creating a generic way to add new languages" What I said refers to step by step revisions in how CMake supports languages. Each such step has to be evaluated on its merits, costs, etc., i.e., what I was referring to by "make our joint case". The other is indeed a huge project, but gives a wrong impression of what I was asking for which must be corrected. To use a specific example of such a step, the Ada compiler generates both *.o files and *.ali (Ada library information) files. The *.ali files are similar to Fortran 95 module files in the sense that the location of all *.ali files needs to be known for further Ada binding and linking steps, and the *.ali files need to be installed. OCaml has similar issues. These issues have already been completely solved in the Fortran 95 case with special code for the Fortran case. Would it be difficult to generalize that Fortran-specific code so that Ada (and OCaml when the time comes) could use it? Right now for the Ada case I work around the *.ali issues by many additional compile and link flags in the relevant CMakeLists.txt files to locate where the *.ali files are generated in the build tree or installed in the install tree and by using an additional "install(FILES ..." command and "clean" logic for the *.ali files. It would be nice to get that mess cleaned up with a proper generalization of the Fortran modules case, and it would make implementing proper OCaml language support (if and when) a lot easier. Thus, I think it makes sense for CMake developers (not necessarily just KitWare developers, but on the other hand I don't have the required C++ skills to do this myself) to evaluate the cost of this specific requested generalization while being careful not to confuse that relatively small cost with the huge costs of "Creating a generic way to add new languages". Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 11/16/2011 3:52 AM, Michael Hertling wrote: On 11/16/2011 04:13 AM, Stefan Monnier wrote: I'd still like to know how to explain to cmake that the command produces 2 files, but at least I can get rid of my hack. That (assuming just a simple object file is produced by compilation) is one of several general limitations with CMake language support. For example, my understanding is this issue has been taken care of for Fortran 95 (where compilation produces both object and module files) with Fortran-95 specific changes to the C++ cmake code. But I would far prefer to see a generic mechanism for this to not only to deal with the Fortran 95 module issue, but also the compilation-generated Ada library identification (*.ali) files, and also the similar issue for OCaml compiler generated files that you have described. Hmm... Because of this and other struggles I had trying to implement Ada language support for CMake, I didn't even consider implementing CMake language support for OCaml for the PLplot OCaml bindings. Instead we currently use (many!) custom commands and targets for that case, but I would be happy to change to your CMake OCaml language support if/when that works. I'm trying to use CMake for a new project here. This project (a new programming language, whose first implementation is in OCaml) is currently in the very first stages (I have barely more than the lexer written) and doesn't require anything sophisticated (there's only 1 OCaml file for now ;-). So my "language support" is very primitive and rather than fight CMake, I'll probably just switch to something else :-( In addition to custom commands/targets, as suggested meanwhile by Alan and Bill, you might also use the diverse RULE_LAUNCH properties. These allow to take arbitrary actions at build time, and you may grant them access to the placeholders used in rule variables, like and , so it should be well possible to address the OCaml-related issues you have reported on. Search the ML's archive for examples of these properties' usage. However, they are currently restricted to Makefiles, but your CMAKE_OCaml_COMPILE_OBJECT rule is too, AFAIK. I would not recommend using RULE_LAUNCH as it will only work with makefile based builds. Normal custom commands will work everywhere. -Bill -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 11/16/2011 04:13 AM, Stefan Monnier wrote: >>> I'd still like to know how to explain to cmake that the command produces >>> 2 files, but at least I can get rid of my hack. >> That (assuming just a simple object file is produced by compilation) >> is one of several general limitations with CMake language support. For >> example, my understanding is this issue has been taken care of for >> Fortran 95 (where compilation produces both object and module files) >> with Fortran-95 specific changes to the C++ cmake code. But I would far >> prefer to see a generic mechanism for this to not only to deal with >> the Fortran 95 module issue, but also the compilation-generated Ada >> library identification (*.ali) files, and also the similar issue for >> OCaml compiler generated files that you have described. > > Hmm... > >> Because of this and other struggles I had trying to implement Ada >> language support for CMake, I didn't even consider implementing CMake >> language support for OCaml for the PLplot OCaml bindings. Instead we >> currently use (many!) custom commands and targets for that case, but >> I would be happy to change to your CMake OCaml language support >> if/when that works. > > I'm trying to use CMake for a new project here. This project (a new > programming language, whose first implementation is in OCaml) is > currently in the very first stages (I have barely more than the lexer > written) and doesn't require anything sophisticated (there's only > 1 OCaml file for now ;-). So my "language support" is very primitive > and rather than fight CMake, I'll probably just switch to something > else :-( In addition to custom commands/targets, as suggested meanwhile by Alan and Bill, you might also use the diverse RULE_LAUNCH properties. These allow to take arbitrary actions at build time, and you may grant them access to the placeholders used in rule variables, like and , so it should be well possible to address the OCaml-related issues you have reported on. Search the ML's archive for examples of these properties' usage. However, they are currently restricted to Makefiles, but your CMAKE_OCaml_COMPILE_OBJECT rule is too, AFAIK. Regards, Michael -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 2011-11-15 22:13-0500 Stefan Monnier wrote: I'd still like to know how to explain to cmake that the command produces 2 files, but at least I can get rid of my hack. That (assuming just a simple object file is produced by compilation) is one of several general limitations with CMake language support. For example, my understanding is this issue has been taken care of for Fortran 95 (where compilation produces both object and module files) with Fortran-95 specific changes to the C++ cmake code. But I would far prefer to see a generic mechanism for this to not only to deal with the Fortran 95 module issue, but also the compilation-generated Ada library identification (*.ali) files, and also the similar issue for OCaml compiler generated files that you have described. Hmm... Because of this and other struggles I had trying to implement Ada language support for CMake, I didn't even consider implementing CMake language support for OCaml for the PLplot OCaml bindings. Instead we currently use (many!) custom commands and targets for that case, but I would be happy to change to your CMake OCaml language support if/when that works. I'm trying to use CMake for a new project here. This project (a new programming language, whose first implementation is in OCaml) is currently in the very first stages (I have barely more than the lexer written) and doesn't require anything sophisticated (there's only 1 OCaml file for now ;-). So my "language support" is very primitive and rather than fight CMake, I'll probably just switch to something else :-( Hi Stefan: I am sorry that CMake support for new languages with complicated needs is not there yet, and I completely understand why you don't want to get involved with that general problem for your limited OCaml needs. However, I wouldn't give up on CMake entirely because of that constraint. Instead, I would suggest you use the alternative of low-level CMake custom commands and custom targets to build what you need to build with OCaml. For a detailed example of that approach, see http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/cmake/modules/ocaml.cmake?view=log (which sets things up for the OCaml parts of the PLplot build) , http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/ocaml/CMakeLists.txt?view=log (which gives examples of relevant custom commands and targets to build the PLplot OCaml bindings), and http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/examples/ocaml/CMakeLists.txt?view=log (which shows how we build the PLplot OCaml examples). Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 11/15/2011 10:13 PM, Stefan Monnier wrote: I'm trying to use CMake for a new project here. This project (a new programming language, whose first implementation is in OCaml) is currently in the very first stages (I have barely more than the lexer written) and doesn't require anything sophisticated (there's only 1 OCaml file for now ;-). So my "language support" is very primitive and rather than fight CMake, I'll probably just switch to something else :-( You should be able to use custom commands to what you need in CMake. It really should not be that hard. You create custom targets for the libraries of your language. You then have custom commands that produce the outputs that make up the input to the custom targets. So, I don't think you would need to fight CMake that much. Just take a different approach. -Bill -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 11/14/2011 3:24 PM, Alan W. Irwin wrote: If you are willing to make such an OCaml summary, I would be willing to do the same thing for Ada to make our joint case to the CMake developers of what kind of additional generic language support is needed by CMake to deal with the complicated build needs of languages such as OCaml and Ada (and Fortran 95) in a completely generic way. There is no case to make, I would love to improve the general language support. However, either you find someone to develop this for you, or you find someone willing to pay someone to develop it. That is really how open source works. Creating a generic way to add new languages that will work on all platforms is a pretty huge task, and will require some serious funding, or someone with lots of free time and skill. The custom commands are the best way to do this in CMake today, and likely in the near future. Basically, they can be used to do just about anything ( I have seen latex, and all sorts of other things done with custom commands.) -Bill -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
>> I'd still like to know how to explain to cmake that the command produces >> 2 files, but at least I can get rid of my hack. > That (assuming just a simple object file is produced by compilation) > is one of several general limitations with CMake language support. For > example, my understanding is this issue has been taken care of for > Fortran 95 (where compilation produces both object and module files) > with Fortran-95 specific changes to the C++ cmake code. But I would far > prefer to see a generic mechanism for this to not only to deal with > the Fortran 95 module issue, but also the compilation-generated Ada > library identification (*.ali) files, and also the similar issue for > OCaml compiler generated files that you have described. Hmm... > Because of this and other struggles I had trying to implement Ada > language support for CMake, I didn't even consider implementing CMake > language support for OCaml for the PLplot OCaml bindings. Instead we > currently use (many!) custom commands and targets for that case, but > I would be happy to change to your CMake OCaml language support > if/when that works. I'm trying to use CMake for a new project here. This project (a new programming language, whose first implementation is in OCaml) is currently in the very first stages (I have barely more than the lexer written) and doesn't require anything sophisticated (there's only 1 OCaml file for now ;-). So my "language support" is very primitive and rather than fight CMake, I'll probably just switch to something else :-( Stefan -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
On 2011-11-14 13:30-0500 Stefan Monnier wrote: I'd still like to know how to explain to cmake that the command produces 2 files, but at least I can get rid of my hack. That (assuming just a simple object file is produced by compilation) is one of several general limitations with CMake language support. For example, my understanding is this issue has been taken care of for Fortran 95 (where compilation produces both object and module files) with Fortran-95 specific changes to the C++ cmake code. But I would far prefer to see a generic mechanism for this to not only to deal with the Fortran 95 module issue, but also the compilation-generated Ada library identification (*.ali) files, and also the similar issue for OCaml compiler generated files that you have described. Because of this and other struggles I had trying to implement Ada language support for CMake, I didn't even consider implementing CMake language support for OCaml for the PLplot OCaml bindings. Instead we currently use (many!) custom commands and targets for that case, but I would be happy to change to your CMake OCaml language support if/when that works. Here is what I suggest you do to move forward with that project. Present a complete summary of your OCaml compilation needs for the CMake developers. That is, state what commands are used to build libraries, what commands are used to build executables, what kinds of files are generated for each stage of each kind of build, and what directories need to be identified at each stage of the build to gain access to files generated in previous stages of the build process. Furthermore, a complicating factor with OCaml is there are two kinds of executables (and libraries?) based on whether ocamlc or ocamlopt is used to respectively produce bytecode executable files that are executed with the OCaml interpreter (ocamlrun) or native executable files that are executed with the ordinary run-time loader. If there are different generic build needs for ocamlc versus ocamlopt be sure to include those differences in your summary. If you are willing to make such an OCaml summary, I would be willing to do the same thing for Ada to make our joint case to the CMake developers of what kind of additional generic language support is needed by CMake to deal with the complicated build needs of languages such as OCaml and Ada (and Fortran 95) in a completely generic way. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
> "If the -c option is given, specify the name of the > object file produced for the next source file that appears on the > command line." > So if the help says that -o is supposed to do something sensible when used > with -c but it doesn't, I'd suggest to file a bug. Note that the order of > arguments may be important. Duh! Thanks for insisting: it works! I'd still like to know how to explain to cmake that the command produces 2 files, but at least I can get rid of my hack. Stefan "happier" -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
Am Freitag, 11. November 2011, 15:55:12 schrieb Stefan Monnier: > > According to http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html, > > it does: > > -o exec-file > > > > Specify the name of the output file produced by the compiler. The > > > > default output name is a.out under Unix and camlprog.exe under Windows. > > If > > This manpage describes all kinds of uses and in practice the -o only > applies to the case whre you use ocamlc to link your program (notice how > it says "-o exec file" rather than "-o output-file"), but it seems > ignored when using it to just compile one file. > > I guess part of the reason is that in that case there is more than > one output (it generates a .cmo and a .cmi file for each input file), so > it wouldn't be clear what to do with this single "output file name". You did cut the part where it says: "If the -c option is given, specify the name of the object file produced for the next source file that appears on the command line." So if the help says that -o is supposed to do something sensible when used with -c but it doesn't, I'd suggest to file a bug. Note that the order of arguments may be important. HS -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
>> I'm trying to use cmake for a project using OCaml, so I'm trying to add >> support for a new language. > Just in case you weren't aware of that. > There has been [several] discussions on the ML > in the past concerning CMake OCaml support at least this one: > http://www.cmake.org/pipermail/cmake/2010-March/035740.html I've seen those, yes. But they don't seem to give me any answer. Stefan -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
> According to http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html, it > does: > -o exec-file > Specify the name of the output file produced by the compiler. The > default output name is a.out under Unix and camlprog.exe under Windows. If This manpage describes all kinds of uses and in practice the -o only applies to the case whre you use ocamlc to link your program (notice how it says "-o exec file" rather than "-o output-file"), but it seems ignored when using it to just compile one file. I guess part of the reason is that in that case there is more than one output (it generates a .cmo and a .cmi file for each input file), so it wouldn't be clear what to do with this single "output file name". > So using > set (CMAKE_OCaml_COMPILE_OBJECT " -c -o > ") > does not work? Nope, Stefan -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
2011/11/9 Stefan Monnier : > I'm trying to use cmake for a project using OCaml, so I'm trying to add > support for a new language. Just in case you weren't aware of that. There has been [several] discussions on the ML in the past concerning CMake OCaml support at least this one: http://www.cmake.org/pipermail/cmake/2010-March/035740.html -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding a new language
Am 09.11.2011 23:00, schrieb Stefan Monnier: I'm trying to use cmake for a project using OCaml, so I'm trying to add support for a new language. Among the many problems I encounter, the most pressing is the following: the rule to build object files (CMAKE_OCaml_COMPILE_OBJECT) seems to want a command that takes and generates , both of which absolute file names. Problems is, `ocamlc' seems to insist on sending the result to a file name of its own choosing (basically with the extension modified). Worse yet: it generates 2 files (a .cmo object file and a .cmi that is similar to a header file). The rule below "works": set (CMAKE_OCaml_COMPILE_OBJECT " -c \; mv \"$$(dirname )/$$(basename )\" ") but it's clearly not what we want. - How do I tell Cmake that `ocamlc' generates 2 files? - How do I tell Cmake that `ocamlc' does not let us choose where to put the result? According to http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html, it does: -o exec-file Specify the name of the output file produced by the compiler. The default output name is a.out under Unix and camlprog.exe under Windows. If the -a option is given, specify the name of the library produced. If the -pack option is given, specify the name of the packed object file produced. If the -output-obj option is given, specify the name of the output file produced. If the -c option is given, specify the name of the object file produced for the next source file that appears on the command line. So using set (CMAKE_OCaml_COMPILE_OBJECT " -c -o ") does not work? HS -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake