Skip to content

For MacOsX XCode clang

oussama Dahmaz edited this page Jun 29, 2020 · 21 revisions

Build with Clang / XCode

Prerequisites

Install XCode from AppStore

Run it once, to accept license agreements. (if not done, clang compiler is not usable)

Brew

install brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Boost

  1. First Method (recommended)

Download boost_1_72_0.tar.bz2

Extract it

tar xf boost_1_72_0.tar.bz2

Create bootstrap

cd boost_1_72_0
./bootstrap

Build boost

./b2 --with-atomic --with-chrono --with-date_time --with-filesystem --with-regex --with-thread --with-system --with-locale toolset=clang cxxflags="-stdlib=libc++ -fPIC" linkflags="-stdlib=libc++" link=static runtime-link=static
  1. Second Method

Using Brew

brew install boost

CMake

brew install cmake

Protobuf

Download and extract the protobuf-cpp sources

wget https://github.com/google/protobuf/releases/download/v3.11.1/protobuf-cpp-3.11.1.tar.gz 
tar xf protobuf-cpp-3.11.1.tar.gz
cd protobuf-cpp-3.11.1
mkdir builds
cd builds
cmake -Dprotobuf_BUILD_TESTS=OFF ../cmake
cmake -Dprotobuf_BUILD_TESTS=OFF --build .
make install
sudo update_dyld_shared_cache

Swig (for python and other script interpreters)

brew install pcre
brew install swig

Gammu (for SmsDialer plugin)

brew install gammu

After installation, Brew display summary information

==> Summary
  /usr/local/Cellar/gammu/1.41.0: 275 files, 4.2M, built in 2 minutes 43 seconds

Please report the gammu path (here /usr/local/Cellar/gammu/1.41.0) to the CMakeUserConfig.txt

set(GAMMU_USE_PKGCONFIG OFF)
set(GAMMU_ROOT "/usr/local/Cellar/gammu/1.41.0")

Poco

Download and build poco (complete edition)

  1. Go to http://pocoproject.org/ ,download the complete edition and extract it.
tar xzf poco-1.9.4-all.tar.gz
  1. Install prerequisite

Download openssl from http://www.openssl.org/ (for example, 1.0.2e)

Extract downloaded package

cd openssl-1.0.2e
./Configure darwin64-x86_64-cc
make
export OPENSSL_ROOT_DIR=`pwd`
  1. Open and build Poco : in the extracted folder :
cd poco-<version>/
mkdir cmake_build
cd cmake_build
cmake -DOPENSSL_ROOT_DIR="<path_to_>/openssl-<version>" -DENABLE_SEVENZIP=OFF -DENABLE_MONGODB=OFF -DENABLE_REDIS=OFF -DENABLE_DATA=OFF -DENABLE_DATA_SQLITE=OFF -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF -DPOCO_STATIC=ON  -DPOCO_MT=ON -DENABLE_MSVC_MP=ON -DFORCE_OPENSSL=ON ..
make
cmake -DOPENSSL_ROOT_DIR="<path_to_>/openssl-<version>" -DENABLE_SEVENZIP=OFF -DENABLE_MONGODB=OFF -DENABLE_REDIS=OFF -DENABLE_DATA=OFF -DENABLE_DATA_SQLITE=OFF -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF -DPOCO_STATIC=ON  -DPOCO_MT=ON -DENABLE_MSVC_MP=ON -DFORCE_OPENSSL=ON -DCMAKE_BUILD_TYPE=DEBUG ..
make
mkdir -p ../lib/Darwin/x86_64
cp lib/* ../lib/Darwin/x86_64/

In case cmake is not defined in the path (line 4), you can use the full path when CMake is installed as application

/Applications/CMake.app/Contents/bin/cmake ..
make

OpenCV (Optional)

Download OpenCV sources from here

Unzip the folder

cd opencv-<version>
mkdir build
cd build
cmake -DWITH_EIGEN:BOOL="0" -DWITH_IMGCODEC_HDR:BOOL="0" -DBUILD_opencv_ts:BOOL="0" -DBUILD_opencv_video:BOOL="0" -DWITH_TIFF:BOOL="0" -DBUILD_PACKAGE:BOOL="0" -DBUILD_opencv_features2d:BOOL="0" -DBUILD_ITT:BOOL="0" -Dthunder:BOOL="0" -Dlzw:BOOL="0" -DCV_TRACE:BOOL="0" -DWITH_MSMF:BOOL="0" -DWITH_FFMPEG:BOOL="0" -DWITH_IMGCODEC_PXM:BOOL="0" -DWITH_MSMF_DXVA:BOOL="0" -DCPACK_SOURCE_ZIP:BOOL="0" -Dpackbits:BOOL="0" -DBUILD_opencv_apps:BOOL="0" -DBUILD_PROTOBUF:BOOL="0" -DBUILD_opencv_objdetect:BOOL="0" -DBUILD_IPP_IW:BOOL="0" -DBUILD_opencv_videoio:BOOL="0" -DBUILD_PERF_TESTS:BOOL="0" -Dmdi:BOOL="0" -DWITH_1394:BOOL="0" -DINSTALL_PDB:BOOL="0" -DWITH_OPENCL:BOOL="0" -DM_LIBRARY:FILEPATH="M_LIBRARY-NOTFOUND" -DUSE_WIN32_FILEIO:BOOL="1" -DCPACK_SOURCE_7Z:BOOL="0" -DBUILD_opencv_stitching:BOOL="0" -Dccitt:BOOL="0" -DVIDEOIO_ENABLE_STRICT_PLUGIN_CHECK:BOOL="0" -DWITH_IPP:BOOL="0" -DBUILD_opencv_dnn:BOOL="0" -DWITH_ITT:BOOL="0" -DCPACK_BINARY_NSIS:BOOL="0" -DBUILD_opencv_photo:BOOL="0" -DBUILD_opencv_calib3d:BOOL="0" -DWITH_QUIRC:BOOL="0" -DWITH_WEBP:BOOL="0" -DBUILD_opencv_python_bindings_generator:BOOL="0" -DWITH_PROTOBUF:BOOL="0" -DBUILD_JASPER:BOOL="1" -DWITH_OPENCLAMDBLAS:BOOL="0" -DBUILD_JAVA:BOOL="0" -DWITH_VTK:BOOL="0" -DBUILD_opencv_java_bindings_generator:BOOL="0" -DBUILD_opencv_highgui:BOOL="0" -DWITH_ARITH_DEC:BOOL="0" -DWITH_IMGCODEC_SUNRASTER:BOOL="0" -DWITH_ADE:BOOL="0" -DBUILD_OPENEXR:BOOL="0" -DWITH_OPENEXR:BOOL="0" -DWITH_OPENCLAMDFFT:BOOL="0" -DVIDEOIO_ENABLE_PLUGINS:BOOL="0" -DWITH_DSHOW:BOOL="0" -DOPENCV_DNN_OPENCL:BOOL="0" -DWITH_LAPACK:BOOL="0" -DWITH_IMGCODEC_PFM:BOOL="0" -Dlogluv:BOOL="0" -DINSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL:BOOL="0" -DBUILD_opencv_ml:BOOL="0" -DOPENCV_ENABLE_MEMALIGN:BOOL="0" -DBUILD_opencv_python_tests:BOOL="0" -DCV_ENABLE_INTRINSICS:BOOL="0" -DOPENCL_FOUND:BOOL="0" -DWITH_OPENCL_D3D11_NV:BOOL="0" -Dnext:BOOL="0" -DBUILD_opencv_gapi:BOOL="0" -DBUILD_opencv_flann:BOOL="0" -DBUILD_TESTS:BOOL="0" -DWITH_DIRECTX:BOOL="0" -DCMAKE_BUILD_TYPE=DEBUG ..
make -j8
cmake -DWITH_EIGEN:BOOL="0" -DWITH_IMGCODEC_HDR:BOOL="0" -DBUILD_opencv_ts:BOOL="0" -DBUILD_opencv_video:BOOL="0" -DWITH_TIFF:BOOL="0" -DBUILD_PACKAGE:BOOL="0" -DBUILD_opencv_features2d:BOOL="0" -DBUILD_ITT:BOOL="0" -Dthunder:BOOL="0" -Dlzw:BOOL="0" -DCV_TRACE:BOOL="0" -DWITH_MSMF:BOOL="0" -DWITH_FFMPEG:BOOL="0" -DWITH_IMGCODEC_PXM:BOOL="0" -DWITH_MSMF_DXVA:BOOL="0" -DCPACK_SOURCE_ZIP:BOOL="0" -Dpackbits:BOOL="0" -DBUILD_opencv_apps:BOOL="0" -DBUILD_PROTOBUF:BOOL="0" -DBUILD_opencv_objdetect:BOOL="0" -DBUILD_IPP_IW:BOOL="0" -DBUILD_opencv_videoio:BOOL="0" -DBUILD_PERF_TESTS:BOOL="0" -Dmdi:BOOL="0" -DWITH_1394:BOOL="0" -DINSTALL_PDB:BOOL="0" -DWITH_OPENCL:BOOL="0" -DM_LIBRARY:FILEPATH="M_LIBRARY-NOTFOUND" -DUSE_WIN32_FILEIO:BOOL="1" -DCPACK_SOURCE_7Z:BOOL="0" -DBUILD_opencv_stitching:BOOL="0" -Dccitt:BOOL="0" -DVIDEOIO_ENABLE_STRICT_PLUGIN_CHECK:BOOL="0" -DWITH_IPP:BOOL="0" -DBUILD_opencv_dnn:BOOL="0" -DWITH_ITT:BOOL="0" -DCPACK_BINARY_NSIS:BOOL="0" -DBUILD_opencv_photo:BOOL="0" -DBUILD_opencv_calib3d:BOOL="0" -DWITH_QUIRC:BOOL="0" -DWITH_WEBP:BOOL="0" -DBUILD_opencv_python_bindings_generator:BOOL="0" -DWITH_PROTOBUF:BOOL="0" -DBUILD_JASPER:BOOL="1" -DWITH_OPENCLAMDBLAS:BOOL="0" -DBUILD_JAVA:BOOL="0" -DWITH_VTK:BOOL="0" -DBUILD_opencv_java_bindings_generator:BOOL="0" -DBUILD_opencv_highgui:BOOL="0" -DWITH_ARITH_DEC:BOOL="0" -DWITH_IMGCODEC_SUNRASTER:BOOL="0" -DWITH_ADE:BOOL="0" -DBUILD_OPENEXR:BOOL="0" -DWITH_OPENEXR:BOOL="0" -DWITH_OPENCLAMDFFT:BOOL="0" -DVIDEOIO_ENABLE_PLUGINS:BOOL="0" -DWITH_DSHOW:BOOL="0" -DOPENCV_DNN_OPENCL:BOOL="0" -DWITH_LAPACK:BOOL="0" -DWITH_IMGCODEC_PFM:BOOL="0" -Dlogluv:BOOL="0" -DINSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL:BOOL="0" -DBUILD_opencv_ml:BOOL="0" -DOPENCV_ENABLE_MEMALIGN:BOOL="0" -DBUILD_opencv_python_tests:BOOL="0" -DCV_ENABLE_INTRINSICS:BOOL="0" -DOPENCL_FOUND:BOOL="0" -DWITH_OPENCL_D3D11_NV:BOOL="0" -Dnext:BOOL="0" -DBUILD_opencv_gapi:BOOL="0" -DBUILD_opencv_flann:BOOL="0" -DBUILD_TESTS:BOOL="0" -DWITH_DIRECTX:BOOL="0" ..
make -j8
sudo make install

Tell Yadoms where to find OpenCV into the Yadoms file "sources/CMakeListsUserConfig.txt", by adding :

set(OPENCV_ROOT "/Users/yadoms/dev/opencv-<version>")

Yadoms

Configure repository

Get sources from Github

git clone https://github.com/Yadoms/yadoms.git

Create the sources/CMakeListsUserConfig.txt (from the .sample.txt) ans edit the boost root configuration (don't forget to remove #) set(BOOST_ROOT "/path/to/boost/boost_1_69_0")

Generate makefile

cd yadoms/
sh cmake_macosx.sh

select 'x' to build XCode project

Build Yadoms

Open XCode and load the project file which is in yadoms/project directory

In XCode, choose the scheme (= the target to build), and build

Build and then run the current scheme

Debug Yadoms plugin

As you know, a plugin is a separated process of Yadoms. Traditional debugging (debug main application to enter in the plugin code) is not available. Here is the way to debug your plugin.

  1. Set your breakpoints

  2. Attach to Process by PID or Name as shown on the picture below

  1. Chose your plugin and hit Attach

Clone this wiki locally