Re: [cmake-developers] Using CMake as a library from Python

2016-01-04 Thread Tamás Kenéz
Charles,

I'd like to comment on a minor issue:

CMakeLists.txt files don't specify user-specific data like source and build
dirs (for a reason) yet your POC listfile contains this line:

cmake.init("Ninja", "/media/dev/src/cmaketest",
"/media/dev/build/cmaketest")

which sets the source and build directories. Is this some temporary
solution for the POC only?

Tamas

On Mon, Jan 4, 2016 at 8:41 AM, Charles Huet  wrote:

> Hi,
>
> Because of the above, I worry that you are basing your work on an old
>> version of CMake. As of April 2015 cmState is used as the interface to the
>> cache.
>
>
> Yeah, that is sadly right. I wanted to rebase on master before publishing,
> thinking it should not be too hard, and I have lots to re-do, mostly
> understand how things are done now.
>
> I did something similar some years ago with QML instead of python, so it
>> sounds interesting to me.
>
>
> I'm trying to be as declarative as possible, because really like how
> readable simple QML programs are, and I think it would be perfect for a
> buildsystem.
>
> My guess is that you are using python to instantiate a cmAddLibraryCommand
>> and then executing it.
>
>
> Actually, I'm directly using the cmMakefile, because I did not want to
> wrap all the commands, and it seemed backwards to me to wrap them.
>
> Even much of cmMakefile shouldn't be used by a new language. Instead
>> certain
>> parts of cmMakefile should be extracted as other classes
>> (cmVariableExpander
>> which should have the ExpandVariablesInString and ConfigureString stuff,
>> cmMessenger for the IssueMessage stuff, some other class for the
>> CompileFeature stuff etc). Then cmMakefile would be just about executing
>> and
>> scoping the CMake language. A new language would not need that, but would
>> use the refactored extracted classes.
>
>
> Ah, this is very interesting, thanks.
>
>
> Having said all that, Brad favors Lua I believe, and he favors a different
>> approach (which no one is working on as far as I know) to adding a new
>> language. So wait to hear from him to know whether it is something that
>> would be upstreamable.
>
>
> Have any details on the approach in question ? SWIG would allow for Lua
> bindings as easily, but I don't think having multiple languages would be a
> good idea.
> I went with Python because I'm familiar with it and have already written
> bindings for it with SWIG. Also, buildbot is written in python and it could
> provide a really interesting integration I think.
>
> I would guide/support you in refactoring cmake as needed. The refactoring
>> part would definitely be upstreamable. I would very much like to see a
>> proof
>> of concept alternative language even if that wasn't upstreamed. It would
>> prove that another language is possible, and that's one of the steps to
>> replacing the current cmake language I think.
>
>
> I will need to work on it to make it work again with master, but I'll try
> and do this soon.
>
> Here is what my test POC looked like for generating a simple shared
> library:
>
> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>> import cmake
>> cmake.init("Ninja", "/media/dev/src/cmaketest",
>> "/media/dev/build/cmaketest")
>> myProject = cmake.Project("MyTestProject")
>> myProject.targets = [ cmake.SharedLibrary("testLibrary", ["lib.cxx"]) ]
>> cmake.generate()
>
>
> Thanks a lot for your comments, I'm happy to see this was not just a dumb
> idea, and that others have thought about it.
>
> I'll update with the github as soon as I get it working.
>
> Best
>
>
> Le lun. 4 janv. 2016 à 01:16, Stephen Kelly  a écrit :
>
>> Charles Huet wrote:
>>
>> > * cmCacheManager::AddCacheEntry was made public, as cmake::Configure
>> > cannot be used from python (it check for the existence of a
>> CMakeLists.txt
>> > file, which does not exist in this scenario) and the cache variables it
>> > sets seem to be necessary.
>>
>> Because of the above, I worry that you are basing your work on an old
>> version of CMake. As of April 2015 cmState is used as the interface to the
>> cache.
>>
>>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b1ad13
>>
>> Also note that the C++ interfaces in CMake are not stable. In the last
>> year
>> they have been changed utterly and that will continue to happen without
>> notice. I'm sure you know this, but I thought I'd say it anyway.
>>
>> > I will try to make a layer of abstraction on top of the python bindings
>> > before publishing this work on github, in order to show the syntactic
>> > sugar python can provide, but I will publish this before if anybody is
>> > interested in working on this.
>>
>> I would be interested in seeing it.
>>
>> > Now, does anyone beside me think this is a good idea ?
>>
>> I did something similar some years ago with QML instead of python, so it
>> sounds interesting to me.
>>
>> In fact, one of the reasons for introducing cmState and doing all the
>> refactoring I did in cmake was to make it possible to 

Re: [cmake-developers] Using CMake as a library from Python

2016-01-04 Thread Charles Huet
I took the time to make it work again, so I pushed it here:
https://github.com/packadal/CMake/tree/cmake-python

The whole branch is ugly as can be, and because I started with an old CMake
and recently rebased, the python abstraction might be bloated already, but
it works in the nominal case, and it would be pretty easy to add most of
the CMake basic functionalities.

I am not used to writing python, so it might not be idiomatic either, but
hey, it works as a simple proof of concept, and it's all I wanted to do for
now :)

Le lun. 4 janv. 2016 à 08:41, Charles Huet  a
écrit :

> Hi,
>
> Because of the above, I worry that you are basing your work on an old
>> version of CMake. As of April 2015 cmState is used as the interface to the
>> cache.
>
>
> Yeah, that is sadly right. I wanted to rebase on master before publishing,
> thinking it should not be too hard, and I have lots to re-do, mostly
> understand how things are done now.
>
> I did something similar some years ago with QML instead of python, so it
>> sounds interesting to me.
>
>
> I'm trying to be as declarative as possible, because really like how
> readable simple QML programs are, and I think it would be perfect for a
> buildsystem.
>
> My guess is that you are using python to instantiate a cmAddLibraryCommand
>> and then executing it.
>
>
> Actually, I'm directly using the cmMakefile, because I did not want to
> wrap all the commands, and it seemed backwards to me to wrap them.
>
> Even much of cmMakefile shouldn't be used by a new language. Instead
>> certain
>> parts of cmMakefile should be extracted as other classes
>> (cmVariableExpander
>> which should have the ExpandVariablesInString and ConfigureString stuff,
>> cmMessenger for the IssueMessage stuff, some other class for the
>> CompileFeature stuff etc). Then cmMakefile would be just about executing
>> and
>> scoping the CMake language. A new language would not need that, but would
>> use the refactored extracted classes.
>
>
> Ah, this is very interesting, thanks.
>
>
> Having said all that, Brad favors Lua I believe, and he favors a different
>> approach (which no one is working on as far as I know) to adding a new
>> language. So wait to hear from him to know whether it is something that
>> would be upstreamable.
>
>
> Have any details on the approach in question ? SWIG would allow for Lua
> bindings as easily, but I don't think having multiple languages would be a
> good idea.
> I went with Python because I'm familiar with it and have already written
> bindings for it with SWIG. Also, buildbot is written in python and it could
> provide a really interesting integration I think.
>
> I would guide/support you in refactoring cmake as needed. The refactoring
>> part would definitely be upstreamable. I would very much like to see a
>> proof
>> of concept alternative language even if that wasn't upstreamed. It would
>> prove that another language is possible, and that's one of the steps to
>> replacing the current cmake language I think.
>
>
> I will need to work on it to make it work again with master, but I'll try
> and do this soon.
>
> Here is what my test POC looked like for generating a simple shared
> library:
>
> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>> import cmake
>> cmake.init("Ninja", "/media/dev/src/cmaketest",
>> "/media/dev/build/cmaketest")
>> myProject = cmake.Project("MyTestProject")
>> myProject.targets = [ cmake.SharedLibrary("testLibrary", ["lib.cxx"]) ]
>> cmake.generate()
>
>
> Thanks a lot for your comments, I'm happy to see this was not just a dumb
> idea, and that others have thought about it.
>
> I'll update with the github as soon as I get it working.
>
> Best
>
>
> Le lun. 4 janv. 2016 à 01:16, Stephen Kelly  a écrit :
>
>> Charles Huet wrote:
>>
>> > * cmCacheManager::AddCacheEntry was made public, as cmake::Configure
>> > cannot be used from python (it check for the existence of a
>> CMakeLists.txt
>> > file, which does not exist in this scenario) and the cache variables it
>> > sets seem to be necessary.
>>
>> Because of the above, I worry that you are basing your work on an old
>> version of CMake. As of April 2015 cmState is used as the interface to the
>> cache.
>>
>>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b1ad13
>>
>> Also note that the C++ interfaces in CMake are not stable. In the last
>> year
>> they have been changed utterly and that will continue to happen without
>> notice. I'm sure you know this, but I thought I'd say it anyway.
>>
>> > I will try to make a layer of abstraction on top of the python bindings
>> > before publishing this work on github, in order to show the syntactic
>> > sugar python can provide, but I will publish this before if anybody is
>> > interested in working on this.
>>
>> I would be interested in seeing it.
>>
>> > Now, does anyone beside me think this is a good idea ?
>>
>> I did something similar some years ago with QML instead of python, so it
>> 

Re: [cmake-developers] Using CMake as a library from Python

2016-01-04 Thread Charles Huet
Yes, this is POC-only.

I felt too lazy to make an argparse object and properly perform these tasks.
Obviously, the generator and source dir should be arguments.
The build dir should be the execution dir of the script, to mimic CMake
behavior.

This should not be difficult, but as I said I wanted first to get this
disussion started.

Le lun. 4 janv. 2016 à 11:54, Tamás Kenéz  a écrit :

> Charles,
>
> I'd like to comment on a minor issue:
>
> CMakeLists.txt files don't specify user-specific data like source and
> build dirs (for a reason) yet your POC listfile contains this line:
>
> cmake.init("Ninja", "/media/dev/src/cmaketest",
> "/media/dev/build/cmaketest")
>
> which sets the source and build directories. Is this some temporary
> solution for the POC only?
>
> Tamas
>
> On Mon, Jan 4, 2016 at 8:41 AM, Charles Huet 
> wrote:
>
>> Hi,
>>
>> Because of the above, I worry that you are basing your work on an old
>>> version of CMake. As of April 2015 cmState is used as the interface to
>>> the
>>> cache.
>>
>>
>> Yeah, that is sadly right. I wanted to rebase on master before
>> publishing, thinking it should not be too hard, and I have lots to re-do,
>> mostly understand how things are done now.
>>
>> I did something similar some years ago with QML instead of python, so it
>>> sounds interesting to me.
>>
>>
>> I'm trying to be as declarative as possible, because really like how
>> readable simple QML programs are, and I think it would be perfect for a
>> buildsystem.
>>
>> My guess is that you are using python to instantiate a cmAddLibraryCommand
>>> and then executing it.
>>
>>
>> Actually, I'm directly using the cmMakefile, because I did not want to
>> wrap all the commands, and it seemed backwards to me to wrap them.
>>
>> Even much of cmMakefile shouldn't be used by a new language. Instead
>>> certain
>>> parts of cmMakefile should be extracted as other classes
>>> (cmVariableExpander
>>> which should have the ExpandVariablesInString and ConfigureString stuff,
>>> cmMessenger for the IssueMessage stuff, some other class for the
>>> CompileFeature stuff etc). Then cmMakefile would be just about executing
>>> and
>>> scoping the CMake language. A new language would not need that, but would
>>> use the refactored extracted classes.
>>
>>
>> Ah, this is very interesting, thanks.
>>
>>
>> Having said all that, Brad favors Lua I believe, and he favors a different
>>> approach (which no one is working on as far as I know) to adding a new
>>> language. So wait to hear from him to know whether it is something that
>>> would be upstreamable.
>>
>>
>> Have any details on the approach in question ? SWIG would allow for Lua
>> bindings as easily, but I don't think having multiple languages would be a
>> good idea.
>> I went with Python because I'm familiar with it and have already written
>> bindings for it with SWIG. Also, buildbot is written in python and it could
>> provide a really interesting integration I think.
>>
>> I would guide/support you in refactoring cmake as needed. The refactoring
>>> part would definitely be upstreamable. I would very much like to see a
>>> proof
>>> of concept alternative language even if that wasn't upstreamed. It would
>>> prove that another language is possible, and that's one of the steps to
>>> replacing the current cmake language I think.
>>
>>
>> I will need to work on it to make it work again with master, but I'll try
>> and do this soon.
>>
>> Here is what my test POC looked like for generating a simple shared
>> library:
>>
>> #!/usr/bin/env python
>>> # -*- coding: utf-8 -*-
>>> import cmake
>>> cmake.init("Ninja", "/media/dev/src/cmaketest",
>>> "/media/dev/build/cmaketest")
>>> myProject = cmake.Project("MyTestProject")
>>> myProject.targets = [ cmake.SharedLibrary("testLibrary", ["lib.cxx"]) ]
>>> cmake.generate()
>>
>>
>> Thanks a lot for your comments, I'm happy to see this was not just a dumb
>> idea, and that others have thought about it.
>>
>> I'll update with the github as soon as I get it working.
>>
>> Best
>>
>>
>> Le lun. 4 janv. 2016 à 01:16, Stephen Kelly  a
>> écrit :
>>
>>> Charles Huet wrote:
>>>
>>> > * cmCacheManager::AddCacheEntry was made public, as cmake::Configure
>>> > cannot be used from python (it check for the existence of a
>>> CMakeLists.txt
>>> > file, which does not exist in this scenario) and the cache variables it
>>> > sets seem to be necessary.
>>>
>>> Because of the above, I worry that you are basing your work on an old
>>> version of CMake. As of April 2015 cmState is used as the interface to
>>> the
>>> cache.
>>>
>>>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b1ad13
>>>
>>> Also note that the C++ interfaces in CMake are not stable. In the last
>>> year
>>> they have been changed utterly and that will continue to happen without
>>> notice. I'm sure you know this, but I thought I'd say it anyway.
>>>
>>> > I will try to make a layer of abstraction 

[cmake-developers] [CMake 0015901]: `-Og` dose not produce debug symbol in CMake

2016-01-04 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://cmake.org/Bug/view.php?id=15901 
== 
Reported By:acgtyrant
Assigned To:
== 
Project:CMake
Issue ID:   15901
Category:   CMake
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2016-01-04 03:50 EST
Last Modified:  2016-01-04 03:50 EST
== 
Summary:`-Og` dose not produce debug symbol in CMake
Description: 
Use `-Og` in CMAKE_CXX_FLAGS, the compiled result does not contain any
`.debug_*` section.

Steps to Reproduce: 
CMakeList.txt:

set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Og")
add_executable(Demo tmp.cc)

tmp.cc:

#include 

int main(void) {
  std::cout << "Hello, world" << std::endl;
  return 0;
}

Put CMakeList.txt and tmp.cc in the same directory, then execute `cmake .; make;
objdump -h Demo | grep .debug`, no result.

For comparison, I compile the tmp.cc by myself: `g++ -std=c++11 -Wall -Wextra
-Og tmp.cc; objdump -h a.out | grep .debug`. It returns:

 26 .debug_aranges 0030      
0d32  2**0
 27 .debug_info   2a64      
0d62  2**0
 28 .debug_abbrev 0651      
37c6  2**0
 29 .debug_line   0372      
3e17  2**0
 30 .debug_str1a02      
4189  2**0
 31 .debug_loc009e      
5b8b  2**0

Additional Information: 
$ LANG=C gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5.3.0/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
Thread model: posix
gcc version 5.3.0 (GCC) 
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-01-04 03:50 acgtyrant  New Issue
==

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] Add command line options for deprecation message control

2016-01-04 Thread Michael Scott

Hi Brad,

To round off the -W options functionality, I've implemented the -Werror 
and -Wno-error set of options for the two current types of messages, dev 
and deprecated. This includes updating the QT GUI to include new options 
for controlling this functionality.


The third patch is not for new functionality, but addresses two small 
inconsistencies relating to dev and deprecated messages functionality, 
it's not needed at the end of the day but I thought it would be good to 
make the code consistent while I was in the area.


Lastly I'm also looking at changing all the current usages of the 
cmake::IssueMessage command, where the message type is dev warning. To 
check if the warning got upgraded to an error (by checking if the error 
state has been signalled with the cmSystemTools class), and change the 
return value of the calling function for example. I think this was 
discussed previously, however I think this might not be the right change 
to make. There's quite a few instances of the above code and changing 
them all is dangerous I imagine where I don't know exactly what all of 
the callers are generally doing and should be doing. It also implies an 
undocumented rule that future users of the above functionality should 
also do this check, which doesn't sound like a good idea to me.  What 
are your thoughts on this last point?


Cheers,
Michael
>From 319afb022cae89d64bc9075e2a686966971cda1c Mon Sep 17 00:00:00 2001
From: Michael Scott 
Date: Mon, 21 Dec 2015 21:39:27 +
Subject: [PATCH 1/3] Implement -Werror and -Wno-error cmake options

Expanded the -W set of cmake options to include support for the -Werror
and -Wno-error format, which is used to control upgrading and downgrading
warning and error messages. Implemented support for these new formats for
the dev and deprecated message types.

Added tests and updated documentation for new options.
---
 Help/manual/OPTIONS_BUILD.txt  |  24 +++
 Help/release/dev/cmake-W-options.rst   |   7 +
 Source/cmMessageCommand.cxx|  29 +--
 Source/cmake.cxx   | 200 -
 Source/cmake.h |  42 -
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake  |  22 +++
 Tests/RunCMake/CommandLine/W_bad-arg3-result.txt   |   1 +
 Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt   |   2 +
 .../CommandLine/Werror_deprecated-result.txt   |   1 +
 .../CommandLine/Werror_deprecated-stderr.txt   |   4 +
 Tests/RunCMake/CommandLine/Werror_deprecated.cmake |   1 +
 Tests/RunCMake/CommandLine/Werror_dev-result.txt   |   1 +
 Tests/RunCMake/CommandLine/Werror_dev-stderr.txt   |  11 ++
 Tests/RunCMake/CommandLine/Werror_dev.cmake|   7 +
 .../CommandLine/Wno-error_deprecated-stderr.txt|   4 +
 .../CommandLine/Wno-error_deprecated.cmake |   2 +
 .../RunCMake/CommandLine/Wno-error_dev-stderr.txt  |  11 ++
 Tests/RunCMake/CommandLine/Wno-error_dev.cmake |   7 +
 Tests/RunCMake/message/RunCMakeTest.cmake  |   6 +-
 Tests/RunCMake/message/errormessage-result.txt |   1 -
 Tests/RunCMake/message/errormessage-stderr.txt |   4 -
 Tests/RunCMake/message/errormessage.cmake  |   4 -
 .../message/errormessage_deprecated-result.txt |   1 +
 .../message/errormessage_deprecated-stderr.txt |   4 +
 .../RunCMake/message/errormessage_deprecated.cmake |   3 +
 Tests/RunCMake/message/errormessage_dev-result.txt |   1 +
 Tests/RunCMake/message/errormessage_dev-stderr.txt |   5 +
 Tests/RunCMake/message/errormessage_dev.cmake  |   3 +
 28 files changed, 372 insertions(+), 36 deletions(-)
 create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg3-result.txt
 create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/Werror_deprecated-result.txt
 create mode 100644 Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/Werror_deprecated.cmake
 create mode 100644 Tests/RunCMake/CommandLine/Werror_dev-result.txt
 create mode 100644 Tests/RunCMake/CommandLine/Werror_dev-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/Werror_dev.cmake
 create mode 100644 Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake
 create mode 100644 Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/Wno-error_dev.cmake
 delete mode 100644 Tests/RunCMake/message/errormessage-result.txt
 delete mode 100644 Tests/RunCMake/message/errormessage-stderr.txt
 delete mode 100644 Tests/RunCMake/message/errormessage.cmake
 create mode 100644 Tests/RunCMake/message/errormessage_deprecated-result.txt
 create mode 100644 Tests/RunCMake/message/errormessage_deprecated-stderr.txt
 create mode 100644 Tests/RunCMake/message/errormessage_deprecated.cmake
 create mode 100644 

[cmake-developers] [CMake 0015902]: ExternalProject Module doesn't work with GHS Multi Generator and Git

2016-01-04 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://public.kitware.com/Bug/view.php?id=15902 
== 
Reported By:iainmeikle
Assigned To:
== 
Project:CMake
Issue ID:   15902
Category:   CMake
Reproducibility:always
Severity:   major
Priority:   normal
Status: new
== 
Date Submitted: 2016-01-04 09:09 EST
Last Modified:  2016-01-04 09:09 EST
== 
Summary:ExternalProject Module doesn't work with GHS Multi
Generator and Git
Description: 
When using the ExternalProject module with the GHS Multi generator external
project dependencies are not obtained and built, rule files are missing but the
external project GPJ files still report success when building.

Steps to Reproduce: 
1. Create a CMake project which makes use of the ExternalProject module to pull
in an external project using Git.
2. Execute CMake to generate the GPJ files.
3. Build the generated default GPJ.
4. Note that the dependency is not resolved and that *.rule files referenced by
any "CMake Rules.gpj" which is in turn referenced by each external project GPJ,
which is referenced by the ExternalProjectTargets.gpj are missing.
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-01-04 09:09 iainmeikle New Issue
==

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] [CMake 0015903]: pkg_search_module no longer caches _PREFIX, _LIBDIR, _INCLUDEDIR

2016-01-04 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
http://public.kitware.com/Bug/view.php?id=15903 
== 
Reported By:Bernd Lörwald
Assigned To:
== 
Project:CMake
Issue ID:   15903
Category:   Modules
Reproducibility:always
Severity:   major
Priority:   normal
Status: new
== 
Date Submitted: 2016-01-04 17:49 CET
Last Modified:  2016-01-04 17:49 CET
== 
Summary:pkg_search_module no longer caches _PREFIX, _LIBDIR,
_INCLUDEDIR
Description: 
Beginning with
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70e8db6e20749a484dd677d7094780c5f4b451c6,
the pkgconfig module no longer caches the _PREFIX, _LIBDIR, _INCLUDEDIR
variables. This was introduced by using pkg_get_variable which sets for
PARENT_SCOPE but not CACHE as _pkgconfig_set did previously. Instead, a helper
variable is cached.

Steps to Reproduce: 
$ cat > CMakeLists.txt 
cmake_minimum_required (VERSION 3.3)
find_package (PkgConfig)
pkg_search_module (PREFIX REQUIRED gl)
if (NOT PREFIX_PREFIX)
  message (FATAL_ERROR "BUMMER")
endif()
^D

$ cmake-3.4.1 .
-- […snip]
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- Checking for one of the modules 'gl'
-- Configuring done
-- Generating done
-- Build files have been written to: […snip]
$ cmake-3.4.1 .
CMake Error at CMakeLists.txt:5 (message):
  BUMMER
$ grep -E "prefix_result|PREFIX_PREFIX" CMakeCache.txt 
PREFIX_PREFIX:INTERNAL=
prefix_result:INTERNAL=/usr/lib64

$ cmake-3.3.2 .
-- […snip]
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for one of the modules 'gl'
-- Configuring done
-- Generating done
-- Build files have been written to: […snip]
$ cmake-3.3.2 .
-- Configuring done
-- Generating done
-- Build files have been written to: […snip]
$ grep -E "prefix_result|PREFIX_PREFIX" CMakeCache.txt 
PREFIX_PREFIX:INTERNAL=/usr

== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-01-04 17:49 Bernd Lörwald  New Issue
==

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Profile Cmake scripts

2016-01-04 Thread Ben Boeckel
On Sun, Dec 27, 2015 at 22:04:14 +0100, Dimitar Yordanov wrote:
> I agree with you. Running valgrind directly on the cmake binary
> provides useful information: I can see which internal cmake functions
> are used the most and consume most of the time.
> 
> Nevertheless, I think it would be useful to have a higher level
> overview. E.g. to see if there are some issues with the scripts
> themselves that I use in my project ...

I had patches which did this, but it doesn't really help much. At least
I didn't think it did. The problems are mainly in CMake itself (regular
expressions, path parsing, etc.). I think the next big improvement would
be caching variable values which are parsed as numbers, on/off, and
paths as a more structured state so that if you have a path, path
operations don't have to keep searching for directory separators since
it is already in a std::vector structure.

> > Usually you see mostly string handling related functions.
> 
> malloc and free are on the top of what I see for a random project used
> mostly by std::string. Maybe we can optimize something here too?

I did a lot of profiling of CMake two years ago. I fixed the low-hanging
fruit (rewriting the CMakeLists.txt parser/variable expander (CMP0053 if
you aren't using it), fixing other mini-parsers (escape routines, the
genex parser) to chunk rather than do char-by-char iteration, etc.). The
big remaining problem is passing char* as an argument where functions do
std::string(arg) right away. I fixed all of those which did explicit
std::string conversions (via assignment or otherwise), but those which
are conditional should get std::string overloads to avoid a
malloc/copy/free penalty. There is a *lot* of work here though. The
branch I had been working on (which is now woefully out-of-date) is 100
commits long.

--Ben
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers