Build with Boost Log library and dependants

Requires Boost libraries to be available as an external library.

On Debian style Linux distributions:

sudo apt install boost-dev-all

On Red Hat style Linux distributions:

sudo dnf install boost-dev

On macOS install Boost from a suitable Open Source package manager,
e.g. MacPorts:

sudo port install boost

If building WSJT-X  packages on macOS for distribution  you must build
boost and  its dependants from  sources with a  suitable macports.conf
file specifying the target macOS  version (10.12 at present). To build
Boost from sources in this case:

sudo port -s install boost

On MS Windows boost must be built from sources using the correct MinGW
compilers,  i.e. the  Qt  tools  32- or  64-bit  g++  for each  target
bit-width respectively.  To  build boost something along  the lines of
the following recipe should be used:

1)     Download    the     boost    ZIP     source    archive     from
https://sourceforge.net/projects/boost/, the latest  release should be
OK, at the time of writing that was 1.74,

2) create a directory for the sources:

MKDIR C:\boost-install

and extract the boost sources there.

3) Bootstrap and  build Boost.Build. If you are building  both 32- and
64-bit  variants then  do  this  twice, each  from  the correct  MinGW
terminal  session  for  the  necessary tool-chain.  Specify  a  unique
install directory  for each variant  (--prefix=). I use C:\Tools  as a
root directory for external libraries and tools, choose whatever suits
your development environment.

CD C:\boost-install\boost_1_74_0\tools\build
bootstrap.bat gcc
b2 --prefix="C:\Tools\boost-build\MinGW32" install

CD C:\boost-install\boost_1_74_0\tools\build
bootstrap.bat gcc
b2 --prefix="C:\Tools\boost-build\MinGW64" install

4) Build Boost. If you are  building both 32- and 64-bit variants then
do this  twice, each from the  correct MinGW terminal session  for the
necessary tool-chain. Specify a unique build and install directory for
each variant (--build-dir=  and --prefix=).  I use C:\Tools  as a root
directory for external libraries and tools, choose whatever suits your
development environment.

SET Path=%Path%;C:\Tools\boost-build\MinGW32\bin
CD C:\boost-install\boost_1_74_0
b2 --build-dir="C:\boost-install\boost_1_74_0\build" ^
 --build-type=complete ^
 --prefix="C:\Tools\boost\MinGW32" ^
 toolset=gcc install

SET Path=%Path%;C:\Tools\boost-build\MinGW32\bin
CD C:\boost-install\boost_1_74_0
b2 --build-dir="C:\boost-install\boost_1_74_0\build" ^
 --build-type=complete ^
 --prefix="C:\Tools\boost\MinGW32" ^
 toolset=gcc address-model=64 install

5)  Once successfully  built  the sources  directory  and build  trees
within can be deleted. The build products are contained in the install
directories (C:\Tools\boost-build and C:\Tools\boost in my case).

6) Update  your development environment  to include the  boost headers
and libraries. In  my case I have  scripts that set up  32- and 64-bit
environments,  they need  to be  modified to  include the  appropriate
boost library  directories on  the Path  environment variable  so that
applications  linked  to Boost  libraries  can  locate the  DLLs.  For
32-bit:

SET Path=C:\Tools\boost\MinGW32\lib;%Path%

For 64-bit:

SET Path=C:\Tools\boost\MinGW64\lib;%Path%

7) To  build WSJT-X  CMake will need  to be able  to locate  the Boost
libraries. I do that using tool-chain files for each of 32- and 64-bit
in both Debug and Release configurations which are passed to the CMake
configuration  invocation using  the -DCMAKE_TOOLCHAIN_FILE=  variable
assignment.  In the  tool-chain files you need to  add the appropriate
Boost  installation  directory   to  the  CMAKE_PREFIX_PATH  variable,
something like:

set (BOOSTDIR C:/Tools/boost/MinGW32)
...
set (CMAKE_PREFIX_PATH ${BOOSTDIR} ${QTDIR} ...

adjust as needed for 32- or 64-bit variants.
This commit is contained in:
Bill Somerville 2020-09-15 10:35:34 +01:00
parent e4eb6eb94e
commit e65caabdea
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
1 changed files with 8 additions and 7 deletions

View File

@ -875,11 +875,12 @@ find_program(ETAGS etags)
#
# Boost
#
set (Boost_NO_SYSTEM_PATHS TRUE)
if (Boost_NO_SYSTEM_PATHS)
set (BOOST_ROOT ${PROJECT_SOURCE_DIR}/boost)
endif ()
find_package (Boost 1.63 REQUIRED)
# set (Boost_NO_SYSTEM_PATHS TRUE)
# if (Boost_NO_SYSTEM_PATHS)
# set (BOOST_ROOT ${PROJECT_SOURCE_DIR}/boost)
# endif ()
set (Boost_USE_STATIC_LIBS OFF)
find_package (Boost 1.63 REQUIRED COMPONENTS log)
#
# OpenMP
@ -1425,9 +1426,9 @@ set_target_properties (wsjtx PROPERTIES
target_include_directories (wsjtx PRIVATE ${FFTW3_INCLUDE_DIRS})
if (APPLE)
target_link_libraries (wsjtx Qt5::SerialPort wsjt_fort wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
target_link_libraries (wsjtx Boost::log Qt5::SerialPort wsjt_fort wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
else ()
target_link_libraries (wsjtx Qt5::SerialPort wsjt_fort_omp wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
target_link_libraries (wsjtx Boost::log Qt5::SerialPort wsjt_fort_omp wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
if (OpenMP_C_FLAGS)
set_target_properties (wsjtx PROPERTIES
COMPILE_FLAGS "${OpenMP_C_FLAGS}"