Skip to content

Commit

Permalink
Add support for modular build structure. (#752)
Browse files Browse the repository at this point in the history
* Make the library modular usable.

* Add missing modular build.jam. And fix gitignore that caused it to be originally deleted!

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Update build deps.
  • Loading branch information
grafikrobot authored Aug 20, 2024
1 parent f56c4c6 commit 8fd5cc5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ graph_info.json
# clangd
compile_commands.json
.clangd/

!build.jam
11 changes: 0 additions & 11 deletions Jamfile

This file was deleted.

34 changes: 34 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright René Ferdinand Rivera Morell 2023-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 ;

constant boost_dependencies :
/boost/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/container_hash//boost_container_hash
/boost/core//boost_core
/boost/filesystem//boost_filesystem
/boost/integer//boost_integer
/boost/iterator//boost_iterator
/boost/mp11//boost_mp11
/boost/preprocessor//boost_preprocessor
/boost/type_traits//boost_type_traits
/boost/variant2//boost_variant2 ;

project /boost/gil
: common-requirements
<include>include
;

explicit
[ alias boost_gil : : : : <library>$(boost_dependencies) ]
[ alias all : boost_gil example test ]
;

call-if : boost-library gil
;

4 changes: 3 additions & 1 deletion example/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

import ../../config/checks/config : requires ;
import-search /boost/config/checks ;
import config : requires ;
import regex ;

using libjpeg : : : : true ; # work around bug on master
Expand All @@ -22,6 +23,7 @@ local msvc-cxxs-with-experimental-fs = 14 ;
project
:
requirements
<library>/boost/gil//boost_gil
[ requires
cxx14_constexpr
cxx14_return_type_deduction
Expand Down
17 changes: 6 additions & 11 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

import ../../config/checks/config : requires ;
import-search /boost/config/checks ;
import config : requires ;
import os ;
import path ;
import regex ;
Expand All @@ -26,6 +27,7 @@ local msvc-cxxs-with-experimental-fs = 14 ;
project
:
requirements
<library>/boost/gil//boost_gil
[ requires
cxx11_constexpr
cxx11_defaulted_functions
Expand Down Expand Up @@ -83,21 +85,14 @@ rule generate_self_contained_headers ( headers_subpath * : exclude_subpaths * )
# NOTE: All '/' in test names are replaced with '-' because apparently
# test scripts have a problem with test names containing slashes.

local top_headers_path = [ path.make $(BOOST_ROOT)/libs/gil/include/boost/gil ] ;
local headers_path = $(top_headers_path) ;
if $(headers_subpath)
{
headers_path = $(top_headers_path)/$(headers_subpath) ;
}

for local file in [ path.glob-tree $(headers_path) : *.hpp : $(exclude_subpaths) ]
for local file in [ glob-tree-ex ../include/boost/gil : *.hpp : $(exclude_subpaths) ]
{
local target_no = [ sequence.length $(targets) ] ;
local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ;
local rel_file = [ path.relative-to ../include/boost/gil $(file) ] ;
local target_name = [ regex.replace h/$(target_no)/$(rel_file) "/" "-" ] ;
local target_name = [ regex.replace $(target_name) "\.hpp" "" ] ;
targets += [
compile $(BOOST_ROOT)/libs/gil/test/header/main.cpp
compile header/main.cpp
: <define>"BOOST_GIL_TEST_HEADER=$(rel_file)" <dependency>$(file)
: $(target_name)
] ;
Expand Down
2 changes: 1 addition & 1 deletion test/core/algorithm/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
import testing ;

run for_each_pixel.cpp ;
run std_fill.cpp ;
run std_fill.cpp : : : <library>/boost/array//boost_array ;
run std_uninitialized_fill.cpp ;
run extend_boundary.cpp ;
2 changes: 1 addition & 1 deletion test/legacy/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import testing ;

run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt ;
run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt : <library>/boost/crc//boost_crc ;
run channel.cpp error_if.cpp ;
run pixel.cpp error_if.cpp ;
run pixel_iterator.cpp error_if.cpp ;
Expand Down

0 comments on commit 8fd5cc5

Please sign in to comment.