During the build process, the executable resides in FeatureEx_artefacts instead of just FeatureEx.
Where does the _artefacts come from? I have it nowhere in my CMake file.
The _artefacts folder is automatically created by the juce_add_gui_app call. As well as holding the final executable, this folder also holds intermediate files such as generated sources, plists, and entitlements files - the purpose of the folder is to avoid file naming collisions between these generated files in the case that multiple targets are added in the same CMakeLists/directory. The choice of folder name was somewhat arbitrary, I just picked a name that was unlikely to be used by CMake itself, and which would be unique for each target.
Dear reuk,
Thank you for the prompt reply.
I am integrating JUCE with OpenCV and PyTorch, several DLL’s are copied to the final executable directory via a cmake directive. Therefore, since the postfix _artefacts does not exist anywhere in the namespace, I have two binary folders: one FeatureEx holding all the DLL’s ( and trained PyTorch models) and the FeatureEx_artefacts folder which holds the executable but not the required runtime files.
Also, I imagined i could still use the commonly used cmake style:
Hello.
I’m running up against this as well. I would just like to have complete control over where the executable goes. The reason is that I am calling the executable from a separate program, a Python program, and I’d like to be able to make it relatively simple for final users. Not to have to copy files around after building so that my Python program can find my C++ program. And I’d prefer for it to work the same whether it’s through CMake or VS.
I would love to be able to either skip this “artefacts” directory or somehow move the file automatically after it’s built. The CMake file(COPY) command is trying to run before anything is actually built…
Can someone point me in the right direction?
Sending the path to the C++ executable as an argument to the Python program
Using CMake to generate a Python file that simply contains the path to the C++ executable. This way, you don’t have to send the executable path to the Python script as an argument, but CMake is still in control of telling Python where to find the executable.
You could also copy the executable after it’s built by using something like this:
In general, however, I would advise against patterns like this. You may get it to work on your development machine, but if the Python script will be deployed to end users, then this becomes much more complex, because during installation all paths must be relative.
That sounds like a great solution. I’m looking into how to get CMAKE to generate a Python script (it could also just be plaintext), but I also don’t see how to get the final build directory from CMAKE; I don’t see it in there anywhere…
And it sets the variable exec_path. BUT it sets it to …/Builds. It does not include this MyTarget_artefacts, which is where the exec is actually written.
What is the macro for the actual output directory, then? If JUCE is able to set it, surely I can find it somewhere.
chuckk@debian:~/Coding/Rationale/RatEngine$ cmake --build Builds
– Configuring juceaide
– Building juceaide
– Exporting juceaide
CMake Error at CMakeLists.txt:119 (file):
file Incorrect arguments to GENERATE subcommand.
– Configuring incomplete, errors occurred!
See also “/home/chuckk/Coding/Rationale/RatEngine/Builds/CMakeFiles/CMakeOutput.log”.
gmake: *** [Makefile:1101: cmake_check_build_system] Error 1
Alas, it doesn’t. CMakeOutput.log has 430+ lines, but shows nothing that seems to be related.
It’s always a little shocking when something that you would expect to be one of the most sought-after features turns out to be super complicated or impossible. I thought I’d see it in a Google search without having to click anything! The ability to either build something to a specific directory OR to at least have the name of the final directory.
Thank you.
This is possible with “regular” CMake, but JUCE is fairly opinionated about where things go within the binary directory, and trying to override the JUCE settings would probably introduce issues.
I still have another question…
Like I said, I’d like this to run regardless of whether it’s built with VS or CMake. So I guess now I have to get into that dreaded section of VS to have it write that same execPath.py file with that same variable.
Anyone been down that road and care to offer a hint?