Re: [CMake] smarter shortcuts with NSIS
On 02/28/2012 05:53 PM, Eric Noulard wrote: 2012/2/28 Andrea Crottiandrea.crott...@gmail.com: On 02/28/2012 03:42 PM, Eric Noulard wrote: Yes more or less beside the fact is CPack is doing more work than that: 1) CPack handles CPack-private install location for you (including the installation of the component selected to be put in the installer taken from CPACK_COMPONENTS_ALL) 2) It prepares componentization of the installer. (including possible COMPONENT dependencies, display name etc... 3) Finally if you use configure_file + add_custom_command you won't get all the CPACK_xxx vars CPack has :-( Because some of them my be computed dynamically by CPack which then does the configure_file in this context. I forgot to mention that NSIS.template.in is including an auxiliary file: NSIS.InstallOptions.ini.in which is configured as well. All this is doable by hand but may not be as easy as it seems in the general case. Thanks for the great explanation, now it's clear.. Just one thing, how do I make sure that it's actually using my own template (apart from running the produced installer)? -- 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] smarter shortcuts with NSIS
On Wed, Feb 29, 2012 at 1:44 PM, Andrea Crotti andrea.crott...@gmail.com wrote: On 02/28/2012 05:53 PM, Eric Noulard wrote: 2012/2/28 Andrea Crottiandrea.crott...@gmail.com: On 02/28/2012 03:42 PM, Eric Noulard wrote: Yes more or less beside the fact is CPack is doing more work than that: 1) CPack handles CPack-private install location for you (including the installation of the component selected to be put in the installer taken from CPACK_COMPONENTS_ALL) 2) It prepares componentization of the installer. (including possible COMPONENT dependencies, display name etc... 3) Finally if you use configure_file + add_custom_command you won't get all the CPACK_xxx vars CPack has :-( Because some of them my be computed dynamically by CPack which then does the configure_file in this context. I forgot to mention that NSIS.template.in is including an auxiliary file: NSIS.InstallOptions.ini.in which is configured as well. All this is doable by hand but may not be as easy as it seems in the general case. Thanks for the great explanation, now it's clear.. Just one thing, how do I make sure that it's actually using my own template (apart from running the produced installer)? -- 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 If you must, put an intentional error in your own template, and then verify that you get an error when you run CPack. It's probably quicker to simply run the installer... -- 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] smarter shortcuts with NSIS
Alright moving the include after did the trick, I get my code in the final nsi file, as below: set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS PageEx directory DirVar PythonDir PageExEnd CreateShortCut \\\$DESKTOP${PROJECT_NAME}.lnk\\\ \\\$INSTDIRbuilt_eggrun.exe\\\ \$PythonDirpythonw.exe\ \\ \\ \.$INSTDIR\ \Run project ${PROJECT_NAME}\ ) The problem is that it fails for this reason: Error: command PageEx not valid in Section which makes sense, but is there a way to avoid that PageEx to end up in a section at all? Is that the only way to inject NSIS code? At worst is there a way to just create my own .nsi file and use it directly? I need to create a page which simply asks for a directory to the user, and then use that to create a shortcut.. Any idea (also other solutions might be fine). -- 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] smarter shortcuts with NSIS
2012/2/28 Andrea Crotti andrea.crott...@gmail.com: Alright moving the include after did the trick, I get my code in the final nsi file, as below: set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS PageEx directory DirVar PythonDir PageExEnd CreateShortCut \\\$DESKTOP${PROJECT_NAME}.lnk\\\ \\\$INSTDIRbuilt_eggrun.exe\\\ \$PythonDirpythonw.exe\ \\ \\ \.$INSTDIR\ \Run project ${PROJECT_NAME}\ ) The problem is that it fails for this reason: Error: command PageEx not valid in Section which makes sense, but is there a way to avoid that PageEx to end up in a section at all? Is that the only way to inject NSIS code? Yes currently that's the case if you use the CMake-provided NSIS.template.in but... At worst is there a way to just create my own .nsi file and use it directly? I need to create a page which simply asks for a directory to the user, and then use that to create a shortcut.. Any idea (also other solutions might be fine). 1) Copy the current NSIS.template.in in your project. and update it the way you like. 2) update CMAKE_MODULE_PATH list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/packaging) in order to make your NSIS.template.in in the CMAKE_MODULE_PATH (you can even use CPACK_MODULE_PATH) 3) run-rerun packaging an dmake sure that cpack is using your projevtc specific NSIS.template.in -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.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] smarter shortcuts with NSIS
On 02/28/2012 03:42 PM, Eric Noulard wrote: At worst is there a way to just create my own .nsi file and use it directly? I need to create a page which simply asks for a directory to the user, and then use that to create a shortcut.. Any idea (also other solutions might be fine). 1) Copy the current NSIS.template.in in your project. and update it the way you like. 2) update CMAKE_MODULE_PATH list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/packaging) in order to make your NSIS.template.in in the CMAKE_MODULE_PATH (you can even use CPACK_MODULE_PATH) 3) run-rerun packaging an dmake sure that cpack is using your projevtc specific NSIS.template.in Ok thanks that's probably the best solution. So if I understand correctly this is more or less the same as writing my own nsi file, run configure_file on it and then add a create_custom_target for packaging, is that right? I will then probably write the file from scratch, trying to understand what it does, because the template is quite mysterious at the moment.. -- 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
[CMake] smarter shortcuts with NSIS
My brain is almost going to explode, so before it does maybe someone can help.. I have a cpack with NSIS working installer, which just copies a directory. In that directory there is a file run.exe, which needs to take an argument to run correctly. Now that argument is a path which is only known at install-time, via asking to the user. So what I would like to do is to: 1. get that path into a variable 2. stick it into the arguments of a shortcut file on the windows machine I found something like this on stackoverflow: set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS CreateShortCut \\\$DESKTOP${PROJECT_NAME}.lnk\\\ \\\$INSTDIRbuilt_eggrun.exe\\\ \c:\python25\pythonw.exe\ ) But I have some trouble understand in general, how is this command processed? First the cmake variables are substituted and then it's simply run? And any advice on how to get the variable with the path? Thanks, Andrea -- 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] smarter shortcuts with NSIS
On 02/27/2012 03:34 PM, Andrea Crotti wrote: My brain is almost going to explode, so before it does maybe someone can help.. I have a cpack with NSIS working installer, which just copies a directory. In that directory there is a file run.exe, which needs to take an argument to run correctly. Now that argument is a path which is only known at install-time, via asking to the user. So what I would like to do is to: 1. get that path into a variable 2. stick it into the arguments of a shortcut file on the windows machine I found something like this on stackoverflow: set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS CreateShortCut \\\$DESKTOP${PROJECT_NAME}.lnk\\\ \\\$INSTDIRbuilt_eggrun.exe\\\ \c:\python25\pythonw.exe\ ) But I have some trouble understand in general, how is this command processed? First the cmake variables are substituted and then it's simply run? And any advice on how to get the variable with the path? Thanks, Andrea This is the first attempt: set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS PageEx directory DirVar PythonDir PageExEnd CreateShortCut \\\$DESKTOP${PROJECT_NAME}.lnk\\\ \\\$INSTDIRbuilt_eggrun.exe\\\ \$PythonDir\\pythonw.exe\ \\ \\ \.$INSTDIR\ \Run project ${PROJECT_NAME}\ ) but I don't get any page asking me for the destination directory, and no shortcut is created.. By the way, how do I see the actual paths NSI configuration that generates the final exe? It seems that if NSIS works the file used get all removed.. -- 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] smarter shortcuts with NSIS
By the way, how do I see the actual paths NSI configuration that generates the final exe? It seems that if NSIS works the file used get all removed.. It does not get removed for me using Visual Studio 2010. All of the NSIS stuff exists in a _CPack_Packages folder inside of the build tree. John -- 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] smarter shortcuts with NSIS
On 02/27/2012 04:52 PM, John Drescher wrote: By the way, how do I see the actual paths NSI configuration that generates the final exe? It seems that if NSIS works the file used get all removed.. It does not get removed for me using Visual Studio 2010. All of the NSIS stuff exists in a _CPack_Packages folder inside of the build tree. John Ah yes you're right, last time I checked I didn't see them.. Anyway my extra_commands don't appear anywhere in the nsi file, is that normal? -- 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] smarter shortcuts with NSIS
Ah yes you're right, last time I checked I didn't see them.. Anyway my extra_commands don't appear anywhere in the nsi file, is that normal? I can't help with that part. I do add components also executables with shortcuts for my executables by setting the CPACK_PACKAGE_EXECUTABLES variable. However I never mess with changing the installation folders or creating shortcuts directly. -- John M. Drescher -- 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] smarter shortcuts with NSIS
2012/2/27 John Drescher dresche...@gmail.com: Ah yes you're right, last time I checked I didn't see them.. Anyway my extra_commands don't appear anywhere in the nsi file, is that normal? No i'ts not. Did you set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ...) BEFORE include(CPack) ? The process is relatively simple. 0) Your CPACK_xxx vars are set and processed by the inclusion of CPack.cmake (the include(CPack) of your CMakeLists.txt) 1) CPack NSIS generator configures the NSIS.template.in file by replacing occurences of CPACK_NSIS_... specific vars in there. 2) makensis is launched using the generated project.nsi CPack private installation of your project in a _CPackPackage subdir is done somewhere between 0) and 1). You need awkward extra escape in CPACK_NSIS_xxx because of the double CMake script processing 0) and 1). Is it clearer? -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.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] smarter shortcuts with NSIS
On 02/27/2012 05:51 PM, Eric Noulard wrote: 2012/2/27 John Drescherdresche...@gmail.com: Ah yes you're right, last time I checked I didn't see them.. Anyway my extra_commands don't appear anywhere in the nsi file, is that normal? No i'ts not. Did you set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS ...) BEFORE Actually I didn't.. Some time ago it was failing when including after, so I moved all the includes on top. I'll change it again tomorrow then.. include(CPack) ? The process is relatively simple. 0) Your CPACK_xxx vars are set and processed by the inclusion of CPack.cmake (the include(CPack) of your CMakeLists.txt) 1) CPack NSIS generator configures the NSIS.template.in file by replacing occurences of CPACK_NSIS_... specific vars in there. 2) makensis is launched using the generated project.nsi CPack private installation of your project in a _CPackPackage subdir is done somewhere between 0) and 1). You need awkward extra escape in CPACK_NSIS_xxx because of the double CMake script processing 0) and 1). Is it clearer? Ok now is clear thanks -- 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