Skip to content

Commit 88673dc

Browse files
author
Adarsh Pyarelal
authored
Improved Boost handling
This PR implements improved handling of the Boost library dependency. - The BOOST_PYTHON_MODULE_NAME can now be set by the user - this is useful because certain package managers do not follow the standard naming convention for the Boost Python library. - The visibility settings for compiling Malmo have been set to hidden, to be consistent with the compilation settings for the Boost release variant libraries.
1 parent ace3b04 commit 88673dc

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,21 @@ SET(Boost_ADDITIONAL_VERSIONS "1.68" "1.68.0")
106106
SET(Boost_ADDITIONAL_VERSIONS "1.69" "1.69.0")
107107
SET(Boost_ADDITIONAL_VERSIONS "1.70" "1.70.0")
108108

109-
SET(BOOST_PYTHON_MODULE_NAME "python")
110-
if ( USE_PYTHON_VERSIONS VERSION_GREATER 3 )
109+
# Boost release variant builds have symbol visibility set to hidden by default
110+
# (https://boostorg.github.io/build/manual/develop/index.html#bbv2.overview.builtins.features)
111+
# The line below adds compilation flags to make the visibility settings for compiling Malmo
112+
# consistent with the visibility settings for Boost, and fixes linking warnings emitted by the
113+
# GCC 9 compiler.
114+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
115+
116+
# This allows users to override the Boost Python library name if different from
117+
# the defaults (this can occur with certain package managers - e.g. For Boost compiled against Python 3.6,
118+
# MacPorts would name the Boost Python library as libboost_python3 instead of libboost_python36).
119+
SET(BOOST_PYTHON_MODULE_NAME "python" CACHE STRING "Boost Python library name.")
120+
121+
# From version 1.67 and up, Boost appends the Python version number to the library name by default.
122+
# (https://www.boost.org/users/history/version_1_67_0.html)
123+
if (Boost_VERSION VERSION_GREATER 1.67 )
111124
SET( BOOST_PYTHON_MODULE_NAME ${BOOST_PYTHON_NAME} )
112125
endif()
113126

0 commit comments

Comments
 (0)