Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ jobs:
copts: -DBoost_USE_STATIC_LIBS=OFF
os: windows-latest

- lib: filesystem
bopts: link=shared --dlldir=bin install
copts: -DBoost_USE_STATIC_LIBS=OFF
dlldir: bin
os: windows-latest

- lib: filesystem
bopts: link=static,shared install
os: windows-latest
Expand Down Expand Up @@ -572,7 +578,9 @@ jobs:
cd tools\boost_install\test\${{matrix.lib}}
mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\..\.local -DUSE_BOOST_PACKAGE=1 -DBoost_VERBOSE=ON ${{matrix.copts}} ..
PATH %PATH%;%GITHUB_WORKSPACE%\..\.local\lib;%GITHUB_WORKSPACE%\..\boost-root\stage\lib
set _DLLDIR=%GITHUB_WORKSPACE%\..\.local\lib
if not "${{matrix.dlldir}}" == "" set _DLLDIR=%GITHUB_WORKSPACE%\..\.local\${{matrix.dlldir}}
PATH %PATH%;%_DLLDIR%;%GITHUB_WORKSPACE%\..\boost-root\stage\lib
cmake --build . --config Debug && cmake --build . --config Debug --target check
cmake --build . --config Release && cmake --build . --config Release --target check
cmake --build . --config MinSizeRel && cmake --build . --config MinSizeRel --target check
Expand Down
9 changes: 9 additions & 0 deletions boost-install-dirs.jam
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import path ;
import stage ;

stage.add-install-dir cmakedir : cmake : libdir ;
stage.add-install-dir dlldir : "" : exec-prefix ;

# header-subdir

Expand Down Expand Up @@ -58,6 +59,14 @@ rule stage-libdir
}
}

# stage-dlldir
# Stage has a flat layout; DLLs live in the same directory as the import libs.

rule stage-dlldir
{
return [ stage-libdir ] ;
}

# stage-includedir

rule stage-includedir
Expand Down
97 changes: 87 additions & 10 deletions boost-install.jam
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import make ;
import modules ;
import option ;
import property-set ;
import "class" : new ;
import project ;
Expand Down Expand Up @@ -488,7 +489,7 @@ rule generate-cmake-variant- ( target : sources * : properties * )
print.text

"set_target_properties($(target) PROPERTIES"
" IMPORTED_LOCATION_$(variant:U) \"${_BOOST_LIBDIR}/$(dll-name)\""
" IMPORTED_LOCATION_$(variant:U) \"${_BOOST_DLLDIR}/$(dll-name)\""
" )"
""
: true ;
Expand Down Expand Up @@ -770,6 +771,39 @@ rule make-cmake-config ( target : sources * : properties * )
libdir = [ path.relative-to $(cmakedir) $(libdir) ] ;
.info " libdir=" $(libdir) ;

# Determine where DLLs (SHARED_LIB) were installed. Mirrors os-dlldir:
# - <install-dlldir> set explicitly (e.g. staged layout): use dlldir feature.
# - --dlldir= passed on command line: relative to exec-prefix.
# - Cygwin build (os.name = CYGWIN): bindir (Cygwin installs DLLs there).
# - Everything else incl. Windows: libdir.
local explicit-dlldir = [ $(ps).get <install-dlldir> ] ;
local dlldir-opt = [ option.get dlldir ] ;
local dlldir ;
if $(explicit-dlldir)
{
dlldir = [ stage.get-dir dlldir : $(ps) : Boost ] ;
}
else if $(dlldir-opt)
{
local dlldir-path = [ path.make $(dlldir-opt) ] ;
if ! [ path.is-rooted $(dlldir-path) ]
{
local xprefix = [ stage.get-dir exec-prefix : $(ps) : Boost ] ;
dlldir-path = [ path.root $(dlldir-path) $(xprefix) ] ;
}
dlldir = $(dlldir-path) ;
}
else if [ os.name ] = CYGWIN
{
dlldir = [ stage.get-dir bindir : $(ps) : Boost ] ;
}
else
{
dlldir = [ stage.get-dir libdir : $(ps) : Boost ] ;
}
dlldir = [ path.relative-to $(cmakedir) $(dlldir) ] ;
.info " dlldir=" $(dlldir) ;

local lname = [ MATCH boost_(.*) : $(name) ] ;
.info " lname=" $(lname) ;

Expand Down Expand Up @@ -837,6 +871,7 @@ rule make-cmake-config ( target : sources * : properties * )
else
{
get-dir "_BOOST_LIBDIR" : $(libdir) ;
get-dir "_BOOST_DLLDIR" : $(dlldir) ;

print.text

Expand Down Expand Up @@ -869,6 +904,7 @@ rule make-cmake-config ( target : sources * : properties * )
"endforeach()"
""
"unset(_BOOST_SINGLE_VARIANT)"
"unset(_BOOST_DLLDIR)"
"unset(_BOOST_LIBDIR)"
"unset(_BOOST_INCLUDEDIR)"
"unset(_BOOST_CMAKEDIR)"
Expand Down Expand Up @@ -1060,8 +1096,10 @@ rule install-or-stage-cmake-config ( name * : install-or-stage )
if $(install-or-stage) = stage
{
local libdir = [ boost-install-dirs.stage-libdir ] ;
local dlldir = [ boost-install-dirs.stage-dlldir ] ;
local includedir = [ boost-install-dirs.stage-includedir ] ;
reqs = <install-libdir>$(libdir) <install-includedir>$(includedir) ;
# stage keeps DLLs in the same dir as import libs, so dlldir = libdir
reqs = <install-libdir>$(libdir) <install-dlldir>$(dlldir) <install-includedir>$(includedir) ;
}
else
{
Expand Down Expand Up @@ -1229,6 +1267,46 @@ rule install-subdir ( properties * )
return <location>(libdir)/$(r:E=) ;
}

# os-dlldir: conditional rule that returns the right install location for shared
# libraries (DLLs).
#
# Default behaviour (backward compatible):
# - Cygwin: bindir (Cygwin convention: DLLs live next to executables)
# - All other OSes incl. Windows: libdir
#
# Pass --dlldir=<path> to override the install location on any platform.

rule os-dlldir ( properties * )
{
local loc = [ property.select <location> : $(properties) ] ;
if $(loc)
{
return $(loc) ;
}

local dlldir-opt = [ option.get dlldir ] ;
if $(dlldir-opt)
{
local dlldir-path = [ path.make $(dlldir-opt) ] ;
if ! [ path.is-rooted $(dlldir-path) ]
{
local ps2 = [ property-set.create $(properties) ] ;
local xprefix = [ stage.get-dir exec-prefix : $(ps2) : Boost ] ;
dlldir-path = [ path.root $(dlldir-path) $(xprefix) ] ;
}
return <location>$(dlldir-path) ;
}

local os = [ property.select <target-os> : $(properties) ] ;
os = $(os:G=) ;
if $(os:E=x) = cygwin
{
return <location>(bindir) ;
}

return <location>(libdir) ;
}

rule boost-install ( libraries * )
{
.debug boost-install $(libraries) ;
Expand Down Expand Up @@ -1260,16 +1338,9 @@ rule boost-install ( libraries * )
install install-libraries-static : $(libraries) : <location>(libdir) <install-dependencies>on <install-type>STATIC_LIB : <install-package>Boost ;
$(p).mark-target-as-explicit install-libraries-static ;

alias install-libraries-shared : install-libraries-shared- ;
alias install-libraries-shared : install-libraries-shared-cygwin : <target-os>cygwin ;
install install-libraries-shared : $(libraries) : <install-type>SHARED_LIB <install-type>PDB <install-dependencies>on <install-no-version-symlinks>on <conditional>@boost-install%os-dlldir : <install-package>Boost ;
$(p).mark-target-as-explicit install-libraries-shared ;

install install-libraries-shared- : $(libraries) : <location>(libdir) <install-type>SHARED_LIB <install-type>PDB <install-dependencies>on <install-no-version-symlinks>on : <install-package>Boost ;
$(p).mark-target-as-explicit install-libraries-shared- ;

install install-libraries-shared-cygwin : $(libraries) : <location>(bindir) <install-type>SHARED_LIB <install-type>PDB <install-dependencies>on <install-no-version-symlinks>on : <install-package>Boost ;
$(p).mark-target-as-explicit install-libraries-shared-cygwin ;

install install-unprefixed-static : $(unprefixed) : <install-type>STATIC_LIB <conditional>@boost-install%install-subdir : <install-package>Boost ;
$(p).mark-target-as-explicit install-unprefixed-static ;

Expand Down Expand Up @@ -1325,17 +1396,23 @@ if [ MATCH --prefix=(.*) : [ modules.peek : ARGV ] ]
option.set datadir : ;
option.set datarootdir : ;
option.set cmakedir : ;
option.set dlldir : ;
}
if [ MATCH --exec-prefix=(.*) : [ modules.peek : ARGV ] ]
{
option.set bindir : ;
option.set libdir : ;
option.set cmakedir : ;
option.set dlldir : ;
}
if [ MATCH --libdir-prefix=(.*) : [ modules.peek : ARGV ] ]
{
option.set cmakedir : ;
}
if [ MATCH --bindir-prefix=(.*) : [ modules.peek : ARGV ] ]
{
option.set dlldir : ;
}
if [ MATCH --dataroot-prefix=(.*) : [ modules.peek : ARGV ] ]
{
option.set datadir : ;
Expand Down