avilleret/pix_opencv

opencv4 branch compiling w cmake

Closed this issue · 3 comments

my cmake knowledge is pretty limited. so how do I build this branch with cmake? Right now if i do:

$ cmake .

i get:

-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'pd'
--   No package 'pd' found

not "quite" sure how to specify where the m_pd.h is.

also can i do a $ cmake clean like a `$ make clean'?

If I can get i building I can attempt to make fixes but at least submit issues :)

cmake generate a build system with the generator of your choice.
By default it uses Makefile, so yes you can do a make clean as long as you're using the Makefile generator.
In any case, cmake generate a clean target that you can invoke with cmake --build . --target clean from your build folder. If you used the Makefile generator this will call make clean if you used another one, then it will be invoked to clean the build folder.

Also one big difference between common build system and cmake is that with cmake it is very easy to use a separate folder to build (which is very nice when you want to generate several configuration in parallel, for example Debug and Release). You can put it where you want but it is common to put it in the repo root or in its parent folder.

cd <path_to_pix_opencv_repo>
mkdir build && cd build # create a new directory and change to it

In this build folder, you invoke cmake by giving it the path to the repo root (where there is a CMakeLists.txt) which is the parent folder if you put the build folder in the repo root, you access it with ... Moreover on Macos, pkg-config will fail to locate Pd and Gem if you don't install them in the Unix way (in /usr/local for example). That's why you need to hint it where they are by defining PUREDATA_INCLUDE_DIRS and GEM_INCLUDE_DIRS variables like :

cmake .. -DPUREDATA_INCLUDE_DIRS=/Applications/Pd-0.50-2.app/Contents/Resources/src/ -DGEM_INCLUDE_DIRS=~/Documents/Pd/externals/Gem/include/Gem 

Of course you need to adapt the path to reflect where Pd and Gem are on you system.
On my side, I put Pd in the /Applications folder and I install Gem through deken inside ~/Documents/Pd/externals/.

Then you should have some makefile in your build folder, and you can actucally build it with :

cmake --build .

or (because we are using the default Makefile generator) :

make 

cool thanks for the quick cmake intro. all objects you have updated compiled and working so far....

I'm closing this one since it seems to be fixed now