How to change package destination folder in CPack? - build-process

I have a multiple module CMake project with a root CMakeLists.txt with multipe add_subdirectory macros.
As far as I understand the default for CPack/CMake is to create package in project root folder, where root CMakeLists.txt resides. I would like to create a separate install module, with its own folder and create packages there? How to do this?

To get the created packages in the "packages" subdirectory of your build directory, use:
SET(CPACK_OUTPUT_FILE_PREFIX packages)

Use the CPack variable CPACK_PACKAGE_DIRECTORY.
Example:
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Packaging")
Do not use the non-documented variable CPACK_OUTPUT_FILE_PREFIX as suggested in one of the answers. It makes the -B argument of the cpack command unusable (tested with CMake v3.21.0).
Also note that the variables CPACK_PACKAGE_FILE_NAME and CPACK_TOPLEVEL_TAG mentioned in the accepted answer are unrelated to the package (output) directory used by CPack.

Take a look at the CPACK_TOPLEVEL_TAG and the CPACK_PACKAGE_FILE_NAME variables in the documentation.

Related

why windeplotqt failed:Warning: Unable to read \mkspecs\qconfig.pri?

I am developing a project in QT, when I want to use Windeployqt to wrap my exe.
error:Warning: Unable to read \mkspecs\qconfig.pri comes out
I execute Eindeployqt in "QT5.1.1 for Desktop(Mingw 4.8.3)", I checked the qconfig.pri exsited in
C:\Qt\Qt5.1.1\5.1.1\mingw48_32\mkspecs\qconfig.pri
I have added environment variable, can anyone help on this?
Usually you would do this with environment variable
QMAKESPEC=C:\SOMEPATH\qt\mkspecs\win32-g++
or in your case probably:
QMAKESPEC=C:\Qt\Qt5.1.1\5.1.1\mingw48_32\mkspecs
though normally it should be a folder below mkspecs specifying your platform (win32-g++ in my first example).
The windeploy tool will use the paths provided from qmake.
Assuming that you are in the bin folder of your qt installation.
All "important" paths can be seen with:
qmake -query
In your case you will see that all paths have the wrong location.
You have to add a qt.conf file.
https://doc.qt.io/qt-5/qt-conf.html
with the following content:
[Paths]
Prefix = ..
Now, running qmake -query should return correct paths. Also the windeploy tool should be able to find the correct paths.

Where to put a Dockerfile in an R package

A contributor has added a Dockerfile to my R package. When trying to upload it to CRAN, it gets flagged:
Non-standard file/directory found at top level:
'Dockerfile'
Is there a more appropriate placement for Dockerfiles within the library's directory structure?
Many thanks
You can leave it in the top level directory. Use the .Rbuildignore file to add an exclusion to the Dockerfile (and other non-standard files).
.Rbuildignore uses regex. Here's an example .Rbuildignore file:
^.*\.Rproj$
^\.Rproj\.user$
.travis.yml
.*.tar.gz
^local

How to add files in the RPM package of an Sailfish OS project?

I am trying to build a Sailfish OS app, and I need to use *.wav files, which are to be distributed through the *.rpm package. In my case, these files are to be put in /usr/share/[application_name]/sounds/*. How do I set up the *.pro and *.yamp files accordingly?
This isn't a RPM question per se: you seem to be asking how to configure
your application through *.pro and *.yamp if you deliver content in
*.rpm packages.
The packaging answer is: Patch the configuration files exactly the same
as if you were installing the *.wav files manually (i.e. not through *.rpm).
You will need to copy the *.wav content into the %buildroot tree that
is used to stage the files to be included in the package, as well as the
modified *.pro and *.yamp content. All the files to be included in the
*.rpm package will need to be mentioned in the %files manifest exactly
as they are to be installed (i.e. w/o the %buildroot prefix used for
staging files while building).
I finally found an answer!
I want to thank to the owner of that project:
https://github.com/krig/metronom-sailfish
From the .pro and the .yaml files of this project i found out how to deploy the files. First, we declare that constant:DEPLOYMENT_PATH = /usr/share/$${TARGET} which seems to hold the path to /usr/share/[appname]. Next, we define some kind of a variable (TODO: find a more detailed explanation of that). The definition of that first sets the path to the files, for example, data.files = data (the second data is the folder). Next, we set data.path to $${DEPLOYMENT_PATH}. We list all the files in OTHER_FILES and add the setting, in our case, data, to INSTALLS. Now, that we are finished with the .pro file, we move to the .yaml file for the .rpm and we add to the necessary line to the Files: section, in our case, - '%{_datadir}/%{name}/data', the last being the folder we need to add. TODO: to whoever is more experienced, please provide a more detailed answer.
Did you check https://sailfishos.org/develop-packaging-apps.html carefully? May helps.

How to modify/edit a Meteor package?

I want to run two different Meteor apps on the same server (on different ports) but I want to change something in one of Meteor's core packages and I want one app to use the original package and the other app to use the modified one. How could I do it?
A bit more straightforward answer, based on answer from here :
Create packages folder in your project and change location to that folder ('cd yourproject' && 'mkdir packages' && 'cd packages')
Fetch files from git ('git clone https://github.com/YOUR_PACKAGE_ADDRESS' - you need to have git installed)
Inside fetched package folder find package.js and edit inside 'Package.describe' name value, for example by adding '-manually-modified'
Edit files you need to modify inside fetched package folder.
Add package to project (meteor add package-name-manually-modified)
You can get the package's files at the github repo : https://github.com/meteor/meteor/tree/master/packages
Fetch the files you want except the package.js files and add them to your project. Of note is you need to ensure their loading order sometimes so you might have to modify the file names, to have a look at the loading order have a look at package.js. By default meteor orders file by name but packages don't necessarily use that.
You can avoid renaming the files if you just mod the package and add it back using meteorite : https://github.com/oortcloud/meteorite
Full instructions on how to make a smart.json : https://atmosphere.meteor.com/wtf/package. If its anything nice please consider adding it to atmosphere too!
I have my packages in my user folder at its root as a hidden folder called .meteor.
Perhaps you can check there? On a mac it would be under:
~/.meteor/packages/your package name
You must also now go into a file there os.json, and change the "length" variable for the file you changed to match the new byte file size. Otherwise it might not compile, but try compiling first and see if its an issue that you changed some package code.

Qmake: Avoid file name conflicts in different folders without introducing libraries

I have a project with some folders which happen to contain source files with the same names.
My source tree looks like this:
project.pro
foo/
conflict.h
conflict.cpp
bar/
conflict.h
conflict.cpp
some.h
other.h
files.h
main.cpp
Per default, qmake generates a Makefile which will produce a build tree like this:
conflict.o
main.o
target
Where conflict.o is the object file resulting for both foo/conflict.cpp and foo/conflict.h.
I can't to change their names because they are generated using an external tool and forcing different file names would imply to change their contents, so this is not an option.
I also don't want to use qmake SUBDIRS template because this would imply that (1) every subdir is built separately as a library and thus very much complicate the overall build process (in my eyes at least) and (2) in the top level directory I can't have any source files. Or am I wrong?
Can't I just tell qmake to write the object files into separate directories within the build directory? So my build tree will look like this:
foo/
conflict.o
bar/
conflict.o
main.o
target
Or are there any other solutions neither requiring to rename the source files nor introducing something complicated like static libraries? I just can't believe that Qt didn't solve this (in my eyes simple) problem for years. (I already hat this problem 4 years ago but could rename the files in that project, while here I can't.)
If it's important: I use Qt 4.8 on both Ubuntu with G++ and Windows with mingw32.
Are you tied to qmake? If not, an alternative could be to use cmake. I just verified your usecase with a simple CMakeLists.txt like
cmake_minimum_required (VERSION 2.6)
project (conflict)
add_executable(conflict foo/conflict.cpp bar/conflict.cpp main.cpp)
which even included a source file in the top level directory (main.cpp). This properly builds the executable - the object files are created in sub directories like
./CMakeFiles/conflict.dir/main.cpp.o
./CMakeFiles/conflict.dir/bar/conflict.cpp.o
./CMakeFiles/conflict.dir/foo/conflict.cpp.o
cmake also includes support for Qt4, to automatically pull in the required include paths and libraries. It might require some effort to migrate from qmake to cmake, but given the requirements you have I would give it a try.

Resources