Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[boost-modular-build-helper] Fix boost build toolchain options not being used #18529

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions ports/boost-modular-build-helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ else()
endif()

if(APPLE)
list(APPEND B2_OPTIONS target-os=darwin toolset=clang)
set(B2_TOOLSET clang)
list(APPEND B2_OPTIONS target-os=darwin)
elseif(WIN32)
list(APPEND B2_OPTIONS target-os=windows toolset=gcc)
set(B2_TOOLSET gcc)
list(APPEND B2_OPTIONS target-os=windows)
elseif(ANDROID)
list(APPEND B2_OPTIONS target-os=android toolset=gcc)
set(B2_TOOLSET gcc)
list(APPEND B2_OPTIONS target-os=android)
else()
list(APPEND B2_OPTIONS target-os=linux toolset=gcc)
set(B2_TOOLSET gcc)
list(APPEND B2_OPTIONS target-os=linux)
omartijn marked this conversation as resolved.
Show resolved Hide resolved
endif()

if(WIN32)
Expand Down Expand Up @@ -80,6 +84,28 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif()
endif()

if(APPLE)
if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(CXXFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} ${CXXFLAGS}")
set(CFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} ${CFLAGS}")
set(LDFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} ${LDFLAGS}")
endif()

if(CMAKE_OSX_SYSROOT)
set(CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${CXXFLAGS}")
set(CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${CFLAGS}")
set(LDFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${LDFLAGS}")
endif()

# if specific architectures are set, configure them,
# if not set, this will still default to current arch
foreach(ARCH ${CMAKE_OSX_ARCHITECTURES})
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
set(CXXFLAGS "-arch ${ARCH} ${CXXFLAGS}")
set(CFLAGS "-arch ${ARCH} ${CFLAGS}")
set(LDFLAGS "-arch ${ARCH} ${LDFLAGS}")
endforeach()
endif()

string(STRIP "${CXXFLAGS}" CXXFLAGS)
string(STRIP "${CFLAGS}" CFLAGS)
string(STRIP "${LDFLAGS}" LDFLAGS)
Expand Down Expand Up @@ -122,7 +148,7 @@ foreach(INCDIR ${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES})
endforeach()

if(APPLE)
set(CXXFLAGS "${CXXFLAGS} <compileflags>-D_DARWIN_C_SOURCE <compileflags>-std=c++11 <compileflags>-stdlib=libc++")
set(CXXFLAGS "${CXXFLAGS} <compileflags>-D_DARWIN_C_SOURCE <cxxflags>-std=c++11 <cxxflags>-stdlib=libc++")
set(LDFLAGS "${LDFLAGS} <linkflags>-stdlib=libc++")
endif()

Expand Down Expand Up @@ -157,6 +183,7 @@ endif()

add_custom_target(boost ALL
COMMAND "${B2_EXE}"
toolset=${B2_TOOLSET}
omartijn marked this conversation as resolved.
Show resolved Hide resolved
--user-config=${CMAKE_CURRENT_BINARY_DIR}/user-config.jam
--stagedir=${CMAKE_CURRENT_BINARY_DIR}/stage
--build-dir=${CMAKE_CURRENT_BINARY_DIR}
Expand Down
13 changes: 13 additions & 0 deletions ports/boost-modular-build-helper/boost-modular-build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ function(boost_modular_build)
if(DEFINED _bm_BOOST_CMAKE_FRAGMENT)
list(APPEND configure_option "-DBOOST_CMAKE_FRAGMENT=${_bm_BOOST_CMAKE_FRAGMENT}")
endif()
if(VCPKG_TARGET_IS_OSX)
if(VCPKG_OSX_DEPLOYMENT_TARGET)
list(APPEND configure_options "-DCMAKE_OSX_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}")
endif()
if(VCPKG_OSX_SYSROOT)
list(APPEND configure_options "-DCMAKE_OSX_SYSROOT=${VCPKG_OSX_SYSROOT}")
endif()
if(VCPKG_OSX_ARCHITECTURES)
# note: VCPKG_OSX_ARCHITECTURES is a list and must be enclosed in quotes
list(APPEND configure_options "-DCMAKE_OSX_ARCHITECTURES=\"${VCPKG_OSX_ARCHITECTURES}\"")
endif()
endif()

ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
vcpkg_configure_cmake(
SOURCE_PATH ${BOOST_BUILD_INSTALLED_DIR}/share/boost-build
PREFER_NINJA
Expand Down
2 changes: 1 addition & 1 deletion ports/boost-modular-build-helper/user-config.jam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if "@VCPKG_PLATFORM_TOOLSET@" != "external"
}
else
{
using gcc : 5.4.1 : @CMAKE_CXX_COMPILER@
using @B2_TOOLSET@ : : @CMAKE_CXX_COMPILER@
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
:
<ranlib>@CMAKE_RANLIB@
<archiver>@CMAKE_AR@
Expand Down
2 changes: 1 addition & 1 deletion ports/boost-modular-build-helper/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "boost-modular-build-helper",
"version-string": "1.75.0",
"port-version": 9,
"port-version": 10,
"dependencies": [
"boost-build",
"boost-uninstall"
Expand Down
5 changes: 5 additions & 0 deletions versions/b-/boost-modular-build-helper.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "09b58787785be0fcc5fb86560ef421eb341aa537",
"version-string": "1.75.0",
"port-version": 10
},
{
"git-tree": "c475b268ac42e886acfdc783944e1e3a988b0ac8",
"version-string": "1.75.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@
},
"boost-modular-build-helper": {
"baseline": "1.75.0",
"port-version": 9
"port-version": 10
},
"boost-move": {
"baseline": "1.75.0",
Expand Down