OpenMP support in xcode build and automated builds - xcode

I need to integrate cpp files that are using the omp header file in my xcode project. I followed this article http://antonmenshov.com/2017/09/09/clang-openmp-setup-in-xcode/ which helped me compile the xcode project without issues. However, the paths being /usr/local/... doesn't work for automated builds. I am using VSTS for automated-build of my xcode project and it can't obviously find the file/directory.
I tried to include the header and dylib as part of the xcode project and reference it instead of the /usr/local path. But I don't know how to update the "user defined setting" described in the article which points to the path /usr/local/opt/llvm/bin/clang. The auto-build is failing because of this path.
Is there a way to make this work for automated builds?

The path for the user-defined setting CC is depend on where the llvm installed.
If you are using Hosted macOS Preview agent for VSTS build, you should install llvm first (brew install llvm) and then get the path for where llvm installed (it's mainly in the path /usr/local/opt/llvm), and then you should use the path /usr/local/opt/llvm/bin/clang instead.
If you are using private agent for VSTS build, the path for user-defined setting CC should be where llvm installed on the agent machine.

Related

building cmake from source for Visual Studio 2019

I get the following error, if trying to build cmake 3.18 from https://github.com/microsoft/CMake.
gmake: *** No rule to make target '/home/ubuntu/Projects/CMake/Source/cmStringTable.cxx'
The file by the way is not in any of the folders.
The system is ubuntu arm64.
It is said that this version must be used because of the activated CMake Server mode.
I can build cmake from kitware on the same machine without problems.
This is a known issue with Mircosoft's fork: https://github.com/microsoft/CMake/issues/90
User "tinco" writes:
I fixed it for myself by not using bootstrap and instead using cmake to compile itself.
I think the fix for this is to remove mention of cmStringTable from the bootstrap script. A more complete fix would be to have the bootstrap script generate the components instead of having them hardcoded.
So you should use your system CMake to build Microsoft's fork instead of using their bootstrap script.
It is said that this version must be used because of the activated CMake Server mode.
I wonder, though, who says this? The CMake Server mode was deprecated a while ago. Microsoft releases its own binaries as part of Visual Studio 2019's CMake tools for Windows. I am curious why you want to use this fork on Linux, rather than the upstream version.

How to build opencv correctly in windows to get "opencv_createsamples.exe"

I want to learn and use haarcascade classifier using OpenCV for detection of object of my choice. I searched the internet and found that createsamples utility helps in creating dataset for positive and negative images. I know how to install OpenCV in python (pip install opencv-python works perfectly) but since I need to use that utility I need to build the OpenCV for my windows system.
My attempts to install OpenCV in windows
Attempt 1 : using MinGW and cmake
cloned latest OpenCV using git at "C:\OpenCV" from https://github.com/opencv/opencv
Installed cmake
created build using cmake at "C:\OpenCV\build" using MinGW(64 bit) build system with default options
ran mingw32-make
ran mingw32-make install
It created an install directory in "C:\OpenCV\build\install"
but to my surprise opencv_createsamples.exe was not present there
opencv_visualisation.exe, opencv_annotation.exe, opencv_version.exe etc. are present
screenshot of install files generated
screenshot of build options selected in cmake by default
It is clear BUILD_opencv_apps is true by default and other apps were created except this one
still in source folder : createsamples.cpp is present in "C:\OpenCV\apps\" along with opencv_visualisation.cpp and others
Attempt 2: visual studio 14_15 build from official site
Downloaded OpenCV latest 4.0.1 from https://github.com/opencv/opencv/releases/download/4.0.1/opencv-4.0.1-vc14_vc15.exe from https://github.com/opencv/opencv/releases webpage
extracted the opencv build at "C:\OpenCV401\"
still to my surprise at "C:\OpenCV401\build\x64\vc14\bin" no opencv_createsamples.exe
likewise other files are present
screenshot of files present in build
Attempt 3
This time I downloaded visual studio 10 build from this github page : https://github.com/abreheret/opencv3.2.0_build
here at <OpenCV_DIR>/x64/vc10/bin/ all the amazing files are present
screenshot of files present in this build
So, my question is :
Why that utility was not built from the source using MinGW and cmake in my first attempt
Why they have not included in the official build
How to build using MinGW and cmake to get that utility correctly (maybe some build configuration needed?)
Createsamples was disabled in latest OpenCV (4.0 and greater): here.

How to executed Rez utility on OsX using cmake?

I'm building an After Effects plugin on OsX.
The XCode project work fine and now I'm trying to port the XCode projects to Cmake environment.
One of the issues I have:
- The XCode automatically executes Rez utility on .r(esource) files
Any ideas how to build the .r files with cmake?
It seems CMake do not provide automatic resource file support in apple. You should use add_custom_command to run Rez at compile stage.

Trying to understand why Cocotron isn't creating Framework DLLs

I'm attempting to use Cocotron to build the Foundation framework. GCC 4.3.1 for Windows compiled fine, and it's creating valid Windows executable files, which I confirmed by making a "Hello, world" executable.
So what I don't understand is why, with Xcode 5.0.2, when I use either xcodebuild or build the Foundation project within Xcode itself, it isn't creating dll files.
So, it seems that as of Xcode 5, Apple no longer supports any compilers that are not derived from clang. To fix this issue, I had to copy the pbcomspec files from /Library/Application Support/Shared/Xcode/Specifications to ~/Library/Application Support/Shared/Xcode/Specifications and edit the file that declares that the compiler is based on llvm-gcc to declare that it's based on com.apple.compilers.llvm.clang.1_0. Then it should at least try to build.
I try to use hpc gcc instead clang and get same results. I found that cocotron needs additional libraries zlib, libjpeg and libpng and in xcode 4.x build failed without they, but in xcode 5.x its only warnings and build marks as success. I didn't try fix it because we began use virtual machine with xcode 3.2, but maybe it is cause that libraries are not created
BTW I use this post and this plugin

New Qt Directory is not valid

I've written an application using Qt on OS X. The installed SDK automatically installed as a framework which I didn't want. So I cloned their newest version from the Qt git repository and built it from source as static libraries. I would like it to compile using those static libraries instead of the framework but in preferences in setting the version/Path of Qt no matter what path I direct it to it says it's not a valid Qt directory. What has to be in a qt Directory that constitutes it being valid?
I'm closing this, The problem was installing on OSX I needed to declare -no-framework when running configure.
Some tips;
Install into a path that doesn't contain spaces
Use -prefix $PWD from the current path, and set the PATH, INCLUDE and LIB env variables appropriately - this makes it possible to have multiple Qt builds, e.g. multiple shadow builds from one source directory
Don't do static configure - it makes using plugins difficult, and assuming you use LGPL you have to ship the .o files.

Resources