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

Add support for modular build structure. #7

Merged
merged 10 commits into from
Aug 17, 2024
44 changes: 18 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- master
- develop
- feature/**
- modular

env:
UBSAN_OPTIONS: print_stacktrace=1
Expand Down Expand Up @@ -56,22 +57,16 @@ jobs:
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=../tools/${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
BOOST_BRANCH=develop && ( test "${GITHUB_REF_NAME}" == "master" || test "${GITHUB_REF_NAME}" == "modular" ) && BOOST_BRANCH=${GITHUB_REF_NAME} || true
BOOST_GIT=https://github.com/${GITHUB_REPOSITORY/auto_index/boost}.git
echo BOOST_GIT: ${BOOST_GIT}
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
git clone -b $BOOST_BRANCH --depth 1 "${BOOST_GIT}" boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py -I examples --git_args "--jobs 3" $LIBRARY
git submodule update --init
rm -rf tools/auto_index/*
cp -r $GITHUB_WORKSPACE/* tools/auto_index
./bootstrap.sh
./b2 -d0 headers

Expand All @@ -83,7 +78,7 @@ jobs:
- name: Run tests
run: |
cd ../boost-root
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release
./b2 -j3 tools/auto_index//all toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release

windows:
strategy:
Expand All @@ -110,26 +105,23 @@ jobs:
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=../tools/%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
if "%GITHUB_REF_NAME%" == "master" set BOOST_BRANCH=master
if "%GITHUB_REF_NAME%" == "modular" set BOOST_BRANCH=modular
set BOOST_GIT=https://github.com/%GITHUB_REPOSITORY:auto_index=boost%.git
echo BOOST_GIT: %BOOST_GIT%
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
git clone -b %BOOST_BRANCH% --depth 1 %BOOST_GIT% boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY:/=\%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py -I examples --git_args "--jobs 3" %LIBRARY%
git submodule update --init
rd /s/q tools\auto_index
xcopy /s /e /q %GITHUB_WORKSPACE% tools\auto_index\
cmd /c bootstrap
b2 -d0 headers

- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release embed-manifest-via=linker
b2 -j3 tools/auto_index//all toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release embed-manifest-via=linker
29 changes: 29 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright René Ferdinand Rivera Morell 2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

require-b2 5.2 ;

import option ;
import path ;

local DIST_DIR = [ option.get distdir ] ;
DIST_DIR ?= [ option.get build-dir ] ;
DIST_DIR ?= [ path.join $(BOOST_ROOT) dist ] ;
DIST_DIR ?= dist ;
DIST_DIR = [ path.root [ path.make $(DIST_DIR) ] [ path.pwd ] ] ;

project /boost/auto_index ;

explicit
[ install dist-bin
: build//auto_index/<link>static
: <install-type>EXE <location>$(DIST_DIR)/bin
: release ]
[ alias auto_index : build//auto_index ]
[ alias all : auto_index test dist-bin ]
;

# Install distribution files/execs by default.
alias dist : dist-bin ;
37 changes: 10 additions & 27 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,13 @@
# http://www.boost.org/LICENSE_1_0.txt)
#==============================================================================

import quickbook ;
import modules ;
import boostcpp ;
import path ;
import option ;

local DIST_DIR = [ option.get distdir ] ;
DIST_DIR ?= [ option.get build-dir ] ;
DIST_DIR ?= [ path.join $(BOOST_ROOT) dist ] ;
DIST_DIR = [ path.root [ path.make $(DIST_DIR) ] [ path.pwd ] ] ;
local DIST_BIN = [ path.join $(DIST_DIR) bin ] ;

exe auto_index :
../src/auto_index.cpp
../src/file_scanning.cpp
../src/index_generator.cpp
../src/tiny_xml.cpp
/boost//regex
/boost//filesystem
/boost//system
/boost//program_options
: <define>BOOST_ALL_NO_LIB=1 <link>static release ;

install aii : auto_index : <location>. ;
explicit aii ;

install i : auto_index : <location>$(DIST_BIN) ;
exe auto_index :
../src/auto_index.cpp
../src/file_scanning.cpp
../src/index_generator.cpp
../src/tiny_xml.cpp
/boost/regex//boost_regex
/boost/filesystem//boost_filesystem
/boost/system//boost_system
/boost/program_options//boost_program_options
: <define>BOOST_ALL_NO_LIB=1 <link>static release ;
8 changes: 0 additions & 8 deletions doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ boostbook standalone
:
auto_index
:
# Path for links to Boost:
<xsl:param>boost.root=../../../..
# Path for libraries index:
<xsl:param>boost.libraries=$(boost-root)/libs/libraries.htm

# Some general style settings:
<xsl:param>table.footnote.number.format=1
<xsl:param>footnote.number.format=1
Expand Down Expand Up @@ -83,6 +78,3 @@ boostbook standalone
;

install pdf-install : standalone : <install-type>PDF <location>. <name>auto_index.pdf ;



61 changes: 18 additions & 43 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,31 @@ import toolset ;
import type ;

path-constant ROOT : ../../.. ;
path-constant HERE : . ;

exe line_compare_tool : text_diff.cpp ;
actions auto-index
{
"$(>[1])" "--prefix=$(ROOT)" "--in=$(>[2])" "--script=$(>[3])" "--out=$(<[1])"
}

rule auto-index-test ( target-name : input-file : script-file : output-file ? : options * )
{
local project = [ project.current ] ;

local t =
[ targets.create-typed-target RUN
: $(project)
: $(target-name)
: [ alias autoindex : ../build//auto_index : release ]
: $(requirements)
<location-prefix>$(target-name).test
<testing.arg>--prefix=$(ROOT)
<testing.arg>$(options)
<testing.arg>--in=$(HERE)/$(input-file)
<testing.arg>--script=$(HERE)/$(script-file)
<testing.arg>--out=$(HERE)/$(target-name).out
<preserve-test-targets>on
<dependency>Jamfile.v2
<dependency>$(input-file)
<dependency>$(script-file)
]
make $(target-name)._out
: ../build//auto_index/<variant>release
$(input-file)
$(script-file)
: @auto-index
: <location-prefix>$(target-name).test
<dependency>Jamfile.v2
;

local n = [ $(t).name ] ;
#ECHO n: $(n) ;

t +=
[ targets.create-typed-target RUN
: $(project)
: $(target-name)_check
: [ alias lct : line_compare_tool : release ]
: $(requirements)
<location-prefix>$(target-name).test
<testing.arg>$(HERE)/$(target-name).out
<testing.arg>$(HERE)/$(target-name).gold
<preserve-test-targets>on
<dependency>$(n)
<dependency>Jamfile.v2
<dependency>$(input-file)
<dependency>$(script-file)
]
testing.run text_diff.cpp
:
: $(target-name)._out
$(target-name).gold
: <preserve-test-targets>on
<dependency>Jamfile.v2
: $(target-name)_check
;

modules.poke testing : .all-tests : \$\(all-tests\) $(t) ;

return $(t) ;
}

auto-index-test test1 : type_traits.docbook : index.idx ;
Expand Down
Loading
Loading