I am working with a debug build of llvm and writing a pass. It takes about 5-10 minutes to build every time I run 'make'. I see a lot of *.inc files getting build every time. What are those files and how can I make builds go faster?
Thanks
You are probably talking about files generated by TableGen utility. This process is slow for you because you've built it in Debug mode, probably. There is a CMake option called LLVM_OPTIMIZED_TABLEGEN to build TableGen in Release mode regardless the build type of all other projects.
Related
I'm trying to install a C++ framework which has a pretty complicated installation process since a binary installer is not provided. Here is the link that shows the steps to take to install this framework. http://fw4spl.readthedocs.io/en/dev/Installation/src/WindowsInstall.html. I'm using Windows 10 if that helps.
I've been able to successfully follow the instructions (hopefully) until this part: Compile the FW4SPL dependencies with jom in the console (e.g. jom all, jom qt, etc). I don't really understand what I am expected to do and what cmd commands I am supposed to use to complete the installation. Also, I don't really understand why there are separate instructions for dependencies and source since they look exactly the same to me. Am I supposed to do both? Any help would be appreciated.
Compiling dependencies and source files are not the same since the instructions say that the fw4spl-deps folder must be built and compiled in the dependencies section, while the fw4spl folder must be built and compiled in the source section. You must have missed that the folder names were different: fw4spl-deps vs fw4spl. So you must do both.
"Compile dependencies in the console" means use the command prompt to compile the folder that was generated during the fw4spl-deps build. The building may be done with CMake for example as explained in the instructions.
I am now using cmake to compile and build a C++ project on multiple platforms. Every time the cmake script is called, everything in the building folder is deleted. For example, I use the following shell command to illustrate the way how cmake is called:
rm -rf build_folder
mkdir build_folder
cd build_folder
cmake ..
By doing so, we are sure that the library or binary produced by the project is updated with regard to the source code. However, it may take time as every time camke will call the compiler to build the project from scratch. The reason lies in the fact that we are concerned that cmake may keep some intermediate results from the previous build if we do not delete everything in the building folder. So my question is: are our concerns justified and if just call cmake .. in the previous building folder without deleting anything in the folder what kind of danger can we have?
A major point of using a build system is not having to rebuild everything every time. A correct build system correctly tracks which files have changed and what commands are therefore necessary to do a correct, minimal rebuild.
If that doesn't work for you, you have messed up your build system.
If you are worried about doing builds for different platforms, and the build system not recognizing the difference, that's just one way your build system is messed up. Specifically, the problem is that you are building different variants, sequentially, in the same directory. At least that's what I take from your description. That's stupid, don't do it. Use a different build folder for every platform, call cmake once in each folder with the correct configuration, and then leave it be.
AFAIK, CMake is a tool for automated builds, so what I would expect from CMake is to "Make" the whole thing, i.e., when I hit "generate" it will create all the files, and compile them, so I will have all I need.
But instead when I run CMake on OpenCV it makes a VS2010 Solution and lots of projects, and then I have to open it in VS2010, and compile the projects myself...why CMake doesn't do it all in a single operation? I think it's capable of doing so right? So why not?
EDIT:
In this link they show how this is the regular way.
Take a look at CMake page:
"CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice."
On the OpenCV website you can find a complete guide to the installation on your Windows machine
In my cmake script I determine the current date and hand it to my c++ program source, so that the build date is compiled into the program. The problem is, that in subsequent runs of make, in which cmake is acutally not run at all, the date is not updated.
How can I force cmake to refresh it's variables and recompile the program by using make only? Alternatively: What is the best way to compile the build date into the binary?
The cmake script contains this:
INCLUDE(Today)
TODAY(DATE)
ADD_DEFINITIONS(
...
-DBUILD_DATE=\"${DATE}\"
)
you could use a custom target to execute whatever you want. custom targets are always considered out of date and run on every build.
add_custom_target(RerunCmake ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR})
add_dependencies(YourTarget RerunCmake)
this works fine with makefiles. but visual studio for example will nag you after every build asking to reload the project because the project files changed on disk.
maybe it would be better to make a custom target that just updates a header file with the correct date so cmake doesn't rerun on every build
I have several projects which all rely on a basic library. Now when I change a header file in this basic library I have to rebuild all dependent projects. Currently Eclipse/CDT builds one project after another. How can I build all these projects in parallel?
Please note that I already use the -j (parallel compiling) option for each project. But this is not enough because:
there are really a lot of CPU's available (for most projects more than source files) and
due to parallel compiling the linking takes much longer than compiling and (to my knowledge) can not use multi-threading.
I don't think the current version of Eclipse CDT can build projects in parallel, but you can achieve the same effect by having an Eclipse CDT Makefile project which builds multiple binaries (libraries and executables).
A simple way to generate such project is by using CMake with Eclipse CDT4 - Unix Makefiles generator. Then if you specify /usr/bin/make -j<n> as a build command, where n is the number of parallel jobs in Project Properties, it will build your targets (not only source files) in parallel.
Project Properties > C++ Build > Behaviour > Enable Parallel Build