Use boost libraries in appveyor - boost

I am writng a script for appveyor.
I need to use boost libraries in my c++ project.
In my appveyor script I have written these lines:
set INCLUDE=C:\Libraries\boost_1_67_0;%INCLUDE%
cd C:\Libraries\boost_1_67_0
dir
.\bootstrap.bat
.\b2 --with-iostreams runtime-link=static --build-type=complete
set LIB=C:\Libraries\boost_1_67_0\stage\lib;%LIB%
but that gives an error on .\bootstrap.bat
.\bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
Command exited with code 1
you could find the log of appveyor at https://ci.appveyor.com/project/srbcheema1/vcf-demo/build/1.0.32
my CMakeLists.txt is like :
cmake_minimum_required (VERSION 2.8.9)
project (reader-demo CXX C)
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(Boost_USE_STATIC_LIBS ON)
add_executable(reader uncompress.cpp)
how could I use the boost libraries in appveyor ?

There is no need to manually install a recent version of boost. It is already there and precompiled. Just make sure your to pass the correct path to your build configuration for using boost headers and the appropriate linkder flag. For a cmake build, this would be
cmake -DBOOST_ROOT=C:\Libraries\boost_1_67_0 path\to\your\source

Related

Building Boost with Clang "Failed to build Boost.build engine"

I am trying to build Boost 1_74_0 for Clang on Windows 7. I go to the folder with bootstrap etc and run:
bootstrap --with-toolset=clang-win
but I get:
Building Boost.build engine
Failed to build Boost.build engine
and the log says:
Found with vswhere Visual Studio Locator version 2.5.2+gebb9f26a3d
###
### "Unknown toolset: vcunk"
###
### You can specify the toolset as the argument, i.e.:
### .\build.bat msvc
###
### Toolsets supported by this script are: borland, como, gcc,
### gcc-nocygwin, intel-win32, metrowerks, mingw,
### vc11, vc12, vc14, vc141, vc142
I did add my Clang bin folder to my PATH env variable.
How should I resolve this?
I assume that your version of clang was installed with VS2019 from your previous question.
Therefore, you need to issue the commands from a Developer Command Prompt for VS 2019.
Since you've already added the Clang bin folder to your PATH env variable, the following should work for you:
bootstrap.bat --with-toolset=clang-win
b2 toolset=clang-win link=shared threading=multi --build-type=complete stage
Note: this builds 32 bit boost library binaries.
The following command should build 64 bit boost library binaries:
b2 toolset=clang-win address-model=64 link=shared threading=multi --build-type=complete stage
However, it only builds the exception and test_exec_monitor binaries.
The other binaries, including date_time, report linker errors.

How to build Boost.Test dynamic library and link it to my project in CMake?

What I did:
I built the library as described here:
> cd $boost_path
> bootstrap.bat
> b2 address-model=64 architecture=x86 --with-test link=shared --prefix=$boost_installation_prefix install
My $boost_path is P:\boost_1_65_1 and $boost_installation_prefix is a folder called boosttest in P:\boost_1_65_1
And then in my cmake I try to find it as follows:
project(Test)
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
# Get Boost
set(BOOST_ROOT "P:/boost_1_65_1")
find_package(Boost COMPONENTS unit_test_framework)
But CMake simply says:
Could NOT find Boost
What am I doing wrong? I suspect I am building the library in the wrong location, but then where do I put it?

C++: setting DebugInformationFormat using Clang and VS14

I'm trying to build a simple hello-world program using cmake, clang and VS14 with Clang 3.7.
cmake ../src -G "Visual Studio 14 2015" -T "v140_clang_3_7"
My CMakeLists.txt looks as follows:
cmake_minimum_required(VERSION 2.8.9)
project (test)
add_executable(test testfile.cpp)
I get the error that DebugInformationFormat has an incorrect value:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Clang
.targets(206,5): error : Element <DebugInformationFormat> has an value of
"ProgramDatabase". [...\build\CMakeFiles\CMakeTmp\cmTC_c45da.vcxproj]
I did some research and tried to override the default value in my CMakeLists.txt without success
set (CMAKE_CXX_FLAGS "-g2 -gdwarf-2")
Whatever I tried so far, didn't work out (of course I cleaned the build directory before every new cmake)
I got the same problem on build project with CMake, VS15, Clang 3.7.
I just got an LLVM snapshotbuild for windows form http://llvm.org/builds/
Install a recent version of clang (at the time of writing v3.9.0).
After the installation Properties -> General -> Platform Tools -> LLVM-vs2014 (Switch to LLVM-vs2014), and build.

Building OpenCV 3.0.0-beta contrib text sample application

I am trying to build the sample applications from opencv-3.0.0-beta with opencv_contrib-3.0.0-beta.
Here is what I have done
Downloaded and unzipped: https://github.com/Itseez/opencv/tree/3.0.0-beta to /home/me/opencv
Downloaded and unzipped https://github.com/Itseez/opencv_contrib/tree/3.0.0-beta to /home/me/opencv
mkdir /home/me/opencv/opencv-3.0.0-beta/build
cd /home/me/opencv/opencv-3.0.0-beta/build
cmake -DOPENCV_EXTRA_MODULES_PATH=/home/me/opencv/opencv_contrib-3.0.0-beta/modules /home/me/opencv/opencv-3.0.0-beta
make -j5
The above works perfectly, no errors.
However I was expecting the sample applications to build, the only one I really care about is: /home/me/opencv/opencv_contrib-3.0.0-beta/modules/text/
I have tried building it with the following steps
cd /home/me/opencv/opencv_contrib-3.0.0-beta/modules/text/
sudo cmake .
However I get an error, here is the output I get!
-- Tesseract: NO CMake Error at CMakeLists.txt:21 (ocv_define_module): Unknown CMake command "ocv_define_module".
CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required
command is present. A line of code such as
cmake_minimum_required(VERSION 2.8)
should be added at the top of the file. The version specified may
be lower if you wish to support older CMake versions for this
project. For more information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
What am I doing wrong?

Building Boost Libs

About 3 months ago I managed to build boost libs and left myself the following instructions:
Extract boost to ->
cd C:\Program Files\boost\boost_1_43_0
Build bjam ->
bootstrap.bat
Issue the following command ->
bjam --toolset=msvc-9.0 stage variant=debug threading=multi link=static runtime-link=static --with-filesystem --with-iostreams --with-regex --with-serialization --with-signals --with-system --with-thread --with-wave
before it build the libs in the default 'stage' directory. Now the command fails to accept any of the lib names. If i remove filesystem, it fails on the next... and so on.
C:\Program Files\boost\boost_1_44_0>win32_build_boost_libs.bat
error: wrong library name 'filesystem' in the --with- option.
Can anyone tell me why I've spent 3 hours trying to google for this but can't find anything :-(
I'm sure its something stupid but the process works on my old laptop but not on my new. They both have the same visual studio, version of boost, archive of boost, path variables... It really is quite frustrating.
You can use BlueGo to build boost - it supports different boost and Visual Studio versions: https://bitbucket.org/Vertexwahn/bluego

Resources