Shared variables in multi directory qmake - qmake

I have multiple qmake .pro files which are called from a root .pro file with a subdirs template.
What is the best way to change a setting for the whole build system (eg. release to debug).
Currently I can only do this by changing each sub .pro file, or using an external script to change each .pro file.
I was hoping there was a way to share qmake variables between the subdirs .pro file and the others.

The only way I know of doing this is through an include file: define all your variables in a vars.pri file at the root of your project and use include() in the .pro files to access the shared variable.

Qt Creator takes care of the issue quite nicely. When you compile a subdir project with a config all the child projects gets compiled with the config.
And for the all project tree a single shadow-build directory is used.

Related

How to import an external .cpp and .h files from a saperate directory in a ros node?

I have a simple ros node inside a catkin package. Now i want to include a .h along with another .cpp file in my node. The .h and .cpp files are part of another directory which is not part of the catkin package that has this nodes. So I believe I need to add the external directory in my package's cmake lists but I am not sure how. Can anyone help me how ? Should I also link targets of the .h files ?
catkin is just an extension of CMake, so you can use the standard CMake commands to solve your problem.
First, you need to add the include directory (doc) like:
include_directories(${YOUR_DIRECTORY})
Defining the source files can be done by setting a variable (doc)
set(EXT_SOURCES
${YOUR_DIRECTORY}/file.cpp
)
using these source files at your node libaray (doc) and / or node (doc) executable:
add_library(library_name ${EXT_SOURCES})
add_executable(node_executable_name ${EXT_SOURCES})

When to prefix a BUILD file (*.BUILD) in Bazel

In its C++ unit testing tutorial, Bazel suggests adding a root level gtest.BUILD file to the workspace root in order to properly integrate Google Test into the test project.
https://docs.bazel.build/versions/master/cpp-use-cases.html
Why would one create a new BUILD file and add gtest prefix to it rather than adding a new build rule to an existing BUILD file in the workspace? Is it just a minor style preference?
Because if you added a BUILD file somewhere in the workspace (e.g. under //third_party/gtest/BUILD) then that file would create a package there.
Then, if you had targets declared in that BUILD file, would their files exist under //third_party/gtest, or would they exist in the zip file that the http_archive downloads? If the former, then there's no need for a http_archive because the files are already in the source tree; if the latter, then the BUILD file references non-existent files in its own package. Both scenarios are flawed.
Better to call gtest's BUILD-file-to-be something that doesn't create a package, but that's descriptive of its purpose.
The build_file attribute of http_archive can reference any file, there's no requirement of the name. The name gtest.BUILD is mostly stylistic, yes, but it also avoids creating a package where it shouldn't. You could say it's an "inactive" BUILD file that will be "active" when Bazel downloads the http_archive, extracts it somewhere, and creates in that directory a symlink called BUILD which points to gtest.BUILD.
Another advantage of having such "inactive" BUILD files is that you can have multiple of them within one package, for multiple http_archives.

Jenkins and MSBuild Error

I am having an issue with building a sln on Jenkins. I know what the problem is I just have no idea how to fix said problem. So the sln imports a project that is not located in the same folder as the sln. This is not an issue with other sln files that we do the same thing with. As you can see below instead of .. to get back to parent directory it is a looking for a .. directory which obviously doesn't exist.
D:\Path\To\sln\OurSolution.sln.metaproj : error MSB3202: The project file
"D:\Path\To\sln\..\..\PathTo\SharedProject\Shared.csproj" was not found
[D:\Path\To\sln\OurSolution.sln]
Edit your .sln file and have it point to the .csproj file that does exist.
Also, double check your working directory to make sure it's the directory where the solution exists.
Paths in the .sln file need to be relative to the location of the .sln file so that when Jenkins can checks out the entire solution into its workspace from source control the paths resolve.
Check that the paths in the solution file are indeed relative to the solution file.
Check that all the project files defined in the solution file (and all their files in turn) are indeed being checked out to the Jenkins job workspace folder.
Where is the shared project in source control in relation to your solution file? Is it in the same repository? If it isn't then my bet is your Jenkins job isn't checking it out from source control into its workspace and therefore not finding it when the solution tries to compile.
Paths your sln and csproj files are relative. .sln and .csproj files paths are relative from where the sit on the file system.
Usually you would expect csproj files to exist in immediate subdirectories of the directory where the .sln file sits.

Add generated subproject configure file to main project in CMake

I am trying to compile my application using CMake, and I need to compile Lua with it for various reasons. My current setup is as follows:
project/
CMakeLists.txt
...
libs/
CMakeLists.txt
...
lua/
CMakeLists.txt
...
I am using LuaDist as it already provides a CMake build system for lua. The problem comes when I try to include lua.h from my project, as it requires luaconfig.h which is generated by the Lua subproject and output to its binary directory, not source directory.
In my main project I do something like this:
include_directories(libs/lua/src/ etc...)
How can I also include generated files from subprojects in my main project?
If you're including lua directly via an add_subdirectory call, you can also use include_directories(${lua_BINARY_DIR}) (assuming there's a project(lua) command in lua's CMakeLists.txt file). The name of the variable may be something else if the project command is different, or you may need multiple additional include_directories, depending on where the header files you need are ... but this should get you started.

Dart Editor won't allow me to edit files inside the package folder

Does anyone know why Dart Editor won't allow me to edit files located inside the packages folder? I originally had my library class files outside of that folder, but I thought the right way to do it was to put my library under that folder, so I did it and now I can't modify the files.
Everything in packages/ is (usually) a symlink to a possibly shared copy of a package, so if you edited a file in packages/ you'd be editing it for all your projects, which might be very not what you want.
If you'd like to edit multiple packages together, the best way to do it is to specify a dependency override that uses a path source, like so:
name: my_package
dependency_overrides:
my_other_package:
path: /Users/me/dart/my_other_package
This way any other dependency on that package will also load it from the specified path and pub won't complain that you have different sources for the same package. Then you can open both projects separately in the editor and the my_package will see the changes in my_other_package as you edit.

Resources