Skip to content

Commit

Permalink
[boost-python] Try to fix build issue on Linux (#9780)
Browse files Browse the repository at this point in the history
* [boost-python] Try to fix build issue on Linux

* Update baseline: enable boost-python:x64-linux

* Fix number of processor detection on Linux: use CMake module

* Fix user-config.jam configuration on Linux

* Update baseline: enable boost-mpi:x64-linux

* Fix build boost-regex[icu] on Linux, issue #4962
  • Loading branch information
yurybura authored Mar 2, 2020
1 parent 1e697e9 commit 1c414f9
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 56 deletions.
13 changes: 2 additions & 11 deletions ports/boost-modular-build-helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,8 @@ endif()

configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam ${CMAKE_CURRENT_BINARY_DIR}/user-config.jam @ONLY)

set(NUMBER_OF_PROCESSORS 1)
if(DEFINED ENV{NUMBER_OF_PROCESSORS})
set(NUMBER_OF_PROCESSORS $ENV{NUMBER_OF_PROCESSORS})
elseif(CMAKE_HOST_LINUX)
execute_process(
COMMAND nproc
OUTPUT_VARIABLE NUMBER_OF_PROCESSORS
)
string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
endif()
include(ProcessorCount)
ProcessorCount(NUMBER_OF_PROCESSORS)
if(NOT NUMBER_OF_PROCESSORS)
set(NUMBER_OF_PROCESSORS 1)
endif()
Expand Down
40 changes: 25 additions & 15 deletions ports/boost-modular-build-helper/boost-modular-build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,35 @@ function(boost_modular_build)
# endif()

if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(configure_option)
if(DEFINED _bm_BOOST_CMAKE_FRAGMENT)
set(fragment_option "-DBOOST_CMAKE_FRAGMENT=${_bm_BOOST_CMAKE_FRAGMENT}")
list(APPEND configure_option "-DBOOST_CMAKE_FRAGMENT=${_bm_BOOST_CMAKE_FRAGMENT}")
endif()
if(DEFINED VCPKG_PYTHON_EXECUTABLE)
list(APPEND configure_option "-DVCPKG_PYTHON_EXECUTABLE=${VCPKG_PYTHON_EXECUTABLE}")
endif()
if(DEFINED VCPKG_PYTHON_INCLUDE)
list(APPEND configure_option "-DVCPKG_PYTHON_INCLUDE=${VCPKG_PYTHON_INCLUDE}")
endif()
if(DEFINED VCPKG_PYTHON_LIBS_RELEASE)
list(APPEND configure_option "-DVCPKG_PYTHON_LIBS_RELEASE=${VCPKG_PYTHON_LIBS_RELEASE}")
endif()
if(DEFINED VCPKG_PYTHON_LIBS_DEBUG)
list(APPEND configure_option "-DVCPKG_PYTHON_LIBS_DEBUG=${VCPKG_PYTHON_LIBS_DEBUG}")
endif()
if(DEFINED VCPKG_PYTHON_VERSION)
list(APPEND configure_option "-DVCPKG_PYTHON_VERSION=${VCPKG_PYTHON_VERSION}")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${CURRENT_INSTALLED_DIR}/share/boost-build
PREFER_NINJA
OPTIONS
"-DPORT=${PORT}"
"-DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}"
"-DB2_EXE=${B2_EXE}"
"-DSOURCE_PATH=${_bm_SOURCE_PATH}"
"-DBOOST_BUILD_PATH=${BOOST_BUILD_PATH}"
${fragment_option}
${configure_option}
)
vcpkg_install_cmake()

Expand Down Expand Up @@ -126,15 +144,10 @@ function(boost_modular_build)
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
)

if(DEFINED ENV{NUMBER_OF_PROCESSORS})
set(NUMBER_OF_PROCESSORS $ENV{NUMBER_OF_PROCESSORS})
else()
execute_process(
COMMAND nproc
OUTPUT_VARIABLE NUMBER_OF_PROCESSORS
)
string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
include(ProcessorCount)
ProcessorCount(NUMBER_OF_PROCESSORS)
if(NOT NUMBER_OF_PROCESSORS)
set(NUMBER_OF_PROCESSORS 1)
endif()

######################
Expand Down Expand Up @@ -195,7 +208,6 @@ function(boost_modular_build)
list(APPEND _bm_OPTIONS_DBG "cxxflags=${VCPKG_CXX_FLAGS_DEBUG}")
endif()


if(VCPKG_C_FLAGS)
list(APPEND _bm_OPTIONS "cflags=${VCPKG_C_FLAGS}")
endif()
Expand All @@ -208,7 +220,6 @@ function(boost_modular_build)
list(APPEND _bm_OPTIONS_DBG "cflags=${VCPKG_C_FLAGS_DEBUG}")
endif()


if(VCPKG_LINKER_FLAGS)
list(APPEND _bm_OPTIONS "linkflags=${VCPKG_LINKER_FLAGS}")
endif()
Expand All @@ -221,7 +232,6 @@ function(boost_modular_build)
list(APPEND _bm_OPTIONS_DBG "linkflags=${VCPKG_LINKER_FLAGS_DEBUG}")
endif()


# Add build type specific options
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
list(APPEND _bm_OPTIONS runtime-link=shared)
Expand All @@ -246,7 +256,7 @@ function(boost_modular_build)
endif()

file(TO_CMAKE_PATH "${_bm_DIR}/nothing.bat" NOTHING_BAT)
set(TOOLSET_OPTIONS " <cxxflags>/EHsc <compileflags>-Zm800 <compileflags>-nologo")
set(TOOLSET_OPTIONS "<cxxflags>/EHsc <compileflags>-Zm800 <compileflags>-nologo")
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if(NOT VCPKG_PLATFORM_TOOLSET MATCHES "v140")
find_path(PATH_TO_CL cl.exe)
Expand Down
41 changes: 28 additions & 13 deletions ports/boost-modular-build-helper/user-config.jam
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import toolset ;

if "@VCPKG_PLATFORM_TOOLSET@" != "external"
{
using msvc : : cl.exe :
<setup>"@NOTHING_BAT@"
@TOOLSET_OPTIONS@
;
using msvc : : cl.exe
:
<setup>"@NOTHING_BAT@"
@TOOLSET_OPTIONS@
;
}
else
{
Expand All @@ -23,8 +24,8 @@ else

if "@PORT@" = "boost-python"
{
using python : @PYTHON_VERSION@ : : "@PYTHON_INCLUDE_PATH@" : "@PYTHONLIBS_RELEASE@" ;
using python : @PYTHON_VERSION@ : : "@PYTHON_INCLUDE_PATH@" : "@PYTHONLIBS_DEBUG@" : <python-debugging>on ;
using python : @VCPKG_PYTHON_VERSION@ : "@VCPKG_PYTHON_EXECUTABLE@" : "@VCPKG_PYTHON_INCLUDE@" : "@VCPKG_PYTHON_LIBS_RELEASE@" ;
using python : @VCPKG_PYTHON_VERSION@ : "@VCPKG_PYTHON_EXECUTABLE@" : "@VCPKG_PYTHON_INCLUDE@" : "@VCPKG_PYTHON_LIBS_DEBUG@" : <python-debugging>on ;
}

if "@PORT@" = "boost-mpi"
Expand All @@ -37,16 +38,30 @@ if "@PORT@" = "boost-mpi"

project user-config : ;

lib advapi32 ;
if "@VCPKG_PLATFORM_TOOLSET@" != "external"
{
lib advapi32 ;

lib icuuc : : <file>"@CURRENT_INSTALLED_DIR@/lib/icuuc.lib" <variant>release : : <library>advapi32 ;
lib icuuc : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/icuucd.lib" <variant>debug : : <library>advapi32 ;

lib icuuc : : <file>"@CURRENT_INSTALLED_DIR@/lib/icuuc.lib" <variant>release : : <library>advapi32 ;
lib icuuc : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/icuucd.lib" <variant>debug : : <library>advapi32 ;
lib icuin : : <file>"@CURRENT_INSTALLED_DIR@/lib/icuin.lib" <variant>release : : ;
lib icuin : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/icuind.lib" <variant>debug : : ;

lib icuin : : <file>"@CURRENT_INSTALLED_DIR@/lib/icuin.lib" <variant>release : : ;
lib icuin : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/icuind.lib" <variant>debug : : ;
lib icudt : : <file>"@CURRENT_INSTALLED_DIR@/lib/icudt.lib" <variant>release : : ;
lib icudt : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/icudtd.lib" <variant>debug : : ;
}
else
{
lib icuuc : : <file>"@CURRENT_INSTALLED_DIR@/lib/libicuuc.a" <variant>release : : ;
lib icuuc : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/libicuuc.a" <variant>debug : : ;

lib icudt : : <file>"@CURRENT_INSTALLED_DIR@/lib/icudt.lib" <variant>release : : ;
lib icudt : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/icudtd.lib" <variant>debug : : ;
lib icuin : : <file>"@CURRENT_INSTALLED_DIR@/lib/libicui18n.a" <variant>release : : ;
lib icuin : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/libicui18n.a" <variant>debug : : ;

lib icudt : : <file>"@CURRENT_INSTALLED_DIR@/lib/libicudata.a" <variant>release : : ;
lib icudt : : <file>"@CURRENT_INSTALLED_DIR@/debug/lib/libicudata.a" <variant>debug : : ;
}

lib iconv : : <file>"@LIBICONV_LIBRARY@" <link>shared <runtime-link>shared <variant>release : : ;
lib iconv : : <file>"@LIBICONV_LIBRARY@" <link>shared <runtime-link>shared <variant>debug : : ;
4 changes: 2 additions & 2 deletions ports/boost-python/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Automatically generated by boost-vcpkg-helpers/generate-ports.ps1
Source: boost-python
Version: 1.72.0
Build-Depends: boost-bind, boost-compatibility, boost-config, boost-conversion, boost-core, boost-detail, boost-foreach, boost-function, boost-graph, boost-integer, boost-iterator, boost-lexical-cast, boost-math, boost-mpl, boost-numeric-conversion, boost-preprocessor, boost-property-map, boost-smart-ptr, boost-static-assert, boost-tuple, boost-type-traits, boost-utility, boost-vcpkg-helpers, python3 (!osx&!linux)
Version: 1.72.0-1
Build-Depends: boost-bind, boost-compatibility, boost-config, boost-conversion, boost-core, boost-detail, boost-foreach, boost-function, boost-graph, boost-integer, boost-iterator, boost-lexical-cast, boost-math, boost-mpl, boost-numeric-conversion, boost-preprocessor, boost-property-map, boost-smart-ptr, boost-static-assert, boost-tuple, boost-type-traits, boost-utility, boost-vcpkg-helpers, python3
Homepage: https://github.com/boostorg/python
Description: Boost python module
13 changes: 8 additions & 5 deletions ports/boost-python/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ vcpkg_from_github(
HEAD_REF master
)

# Find Python. Can't use find_package here, but we already know where everything is
file(GLOB PYTHON_INCLUDE_PATH "${CURRENT_INSTALLED_DIR}/include/python3.*")
set(PYTHONLIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib")
set(PYTHONLIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib")
string(REGEX REPLACE ".*python([0-9\.]+)$" "\\1" PYTHON_VERSION "${PYTHON_INCLUDE_PATH}")
# Find Python3 executable
vcpkg_find_acquire_program(PYTHON3)
set(VCPKG_PYTHON_EXECUTABLE "${PYTHON3}")
# Find Python3 libraries. Can't use find_package here, but we already know where everything is
file(GLOB VCPKG_PYTHON_INCLUDE "${CURRENT_INSTALLED_DIR}/include/python3.*")
set(VCPKG_PYTHON_LIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib")
set(VCPKG_PYTHON_LIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib")
string(REGEX REPLACE ".*python([0-9\.]+).*" "\\1" VCPKG_PYTHON_VERSION "${VCPKG_PYTHON_INCLUDE}")
include(${CURRENT_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake)
boost_modular_build(SOURCE_PATH ${SOURCE_PATH})
include(${CURRENT_INSTALLED_DIR}/share/boost-vcpkg-helpers/boost-modular-headers.cmake)
Expand Down
6 changes: 3 additions & 3 deletions scripts/boost/generate-ports.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function Generate()
$controlDeps = ($Depends | sort) -join ", "

$versionSuffix = ""
if ($Name -eq "iostreams")
if ($PortName -eq "iostreams" -or $PortName -eq "python")
{
$versionsuffix = "-1"
$versionSuffix = "-1"
}

mkdir "$portsDir/boost-$PortName" -erroraction SilentlyContinue | out-null
Expand Down Expand Up @@ -363,7 +363,7 @@ foreach ($library in $libraries)

if ($library -eq "python")
{
$deps += @("python3 (!osx&!linux)")
$deps += @("python3")
$needsBuild = $true
}
elseif ($library -eq "iostreams")
Expand Down
13 changes: 8 additions & 5 deletions scripts/boost/post-source-stubs/python.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Find Python. Can't use find_package here, but we already know where everything is
file(GLOB PYTHON_INCLUDE_PATH "${CURRENT_INSTALLED_DIR}/include/python3.*")
set(PYTHONLIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib")
set(PYTHONLIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib")
string(REGEX REPLACE ".*python([0-9\.]+)$" "\\1" PYTHON_VERSION "${PYTHON_INCLUDE_PATH}")
# Find Python3 executable
vcpkg_find_acquire_program(PYTHON3)
set(VCPKG_PYTHON_EXECUTABLE "${PYTHON3}")
# Find Python3 libraries. Can't use find_package here, but we already know where everything is
file(GLOB VCPKG_PYTHON_INCLUDE "${CURRENT_INSTALLED_DIR}/include/python3.*")
set(VCPKG_PYTHON_LIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib")
set(VCPKG_PYTHON_LIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib")
string(REGEX REPLACE ".*python([0-9\.]+).*" "\\1" VCPKG_PYTHON_VERSION "${VCPKG_PYTHON_INCLUDE}")
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ boost-locale:arm-uwp=fail
boost-locale:x64-uwp=fail
boost-log:arm-uwp=fail
boost-log:x64-uwp=fail
boost-python:x64-linux=ignore
boost-mpi:x64-linux=fail
boost-mpi:x64-osx=fail
boost-stacktrace:arm-uwp=fail
boost-stacktrace:x64-uwp=fail
Expand Down

0 comments on commit 1c414f9

Please sign in to comment.