Skip to content

Commit

Permalink
Merge pull request #310 from pmienk/master
Browse files Browse the repository at this point in the history
Add flags to build instructions
  • Loading branch information
pmienk authored Feb 27, 2024
2 parents 3ff66dc + 51b26bb commit 2b35883
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 22 deletions.
8 changes: 6 additions & 2 deletions generate3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<option value="--with-test" />
</build>
<build name="secp256k1" github="libbitcoin" repository="secp256k1" branch="version7" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-tests" />
<option value="--enable-module-recovery" />
</build>
Expand Down Expand Up @@ -375,6 +376,7 @@
<install>
<!-- Building with our minimum (c++11 only) version of ICU. -->
<build name="icu" version="55.2" parallel="true" >
<flag value="-w" />
<!-- TODO: verify this with more recent ICU. -->
<!-- Bug in ICU 55.2 build requires enable-draft. -->
<option value="--enable-draft" />
Expand Down Expand Up @@ -402,6 +404,7 @@
<option value="--with-test" />
</build>
<build name="secp256k1" github="libbitcoin" repository="secp256k1" branch="version7" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-tests" />
<option value="--enable-module-recovery" />
</build>
Expand Down Expand Up @@ -785,6 +788,7 @@
<option value="${with_pkgconfigdir}" />
</build>
<build name="zmq" version="4.3.4" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-Werror" />
</build>
<build name="bitcoin-protocol" github="libbitcoin" repository="libbitcoin-protocol" branch="version3" parallel="true" >
Expand Down Expand Up @@ -2165,8 +2169,8 @@
</configuration>
<configuration name="gnu-optimized-size" description="Factored size optimization settings." hidden="true">
<property name="cacheVariables" type="object">
<property name="CMAKE_C_FLAGS" value="$env{CMAKE_C_FLAGS} -Os -s" />
<property name="CMAKE_CXX_FLAGS" value="$env{CMAKE_CXX_FLAGS} -Os -s" />
<property name="CMAKE_C_FLAGS" value="$env{CMAKE_C_FLAGS} -Os" />
<property name="CMAKE_CXX_FLAGS" value="$env{CMAKE_CXX_FLAGS} -Os" />
</property>
</configuration>
<configuration name="nix-gnu-debug-static" description="Debug build with static linking." hidden="false" display="*nix/GNU/Debug/Static">
Expand Down
17 changes: 12 additions & 5 deletions generate4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@

<install>
<!-- Boost.system is necessary for detection, which is only required for test. -->
<build name="boost" version="1.78.0" parallel="true" nuget="true" >
<build name="boost" version="1.78.0" parallel="true" nuget="true" prebuild="true" >
<option value="--with-system" />
<option value="--with-test" />
</build>
<build name="secp256k1" github="libbitcoin" repository="secp256k1" branch="version8" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-tests" />
<option value="--enable-experimental" />
<option value="--enable-module-recovery" />
Expand Down Expand Up @@ -463,6 +464,7 @@
<install>
<!-- Building with our minimum (c++11 only) version of ICU. -->
<build name="icu" version="55.2" parallel="true" >
<flag value="-w" />
<!-- TODO: verify this with more recent ICU. -->
<!-- Bug in ICU 55.2 build requires -enable-draft. -->
<option value="--enable-draft" />
Expand All @@ -475,7 +477,7 @@
<option value="--disable-tests" />
<option value="--disable-samples" />
</build>
<build name="boost" version="1.78.0" parallel="true" nuget="true" >
<build name="boost" version="1.78.0" parallel="true" nuget="true" prebuild="true" >
<option value="--with-chrono" />
<option value="--with-iostreams" />
<option value="--with-json" />
Expand All @@ -486,6 +488,7 @@
<option value="--with-test" />
</build>
<build name="secp256k1" github="libbitcoin" repository="secp256k1" branch="version8" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-tests" />
<option value="--enable-experimental" />
<option value="--enable-module-recovery" />
Expand Down Expand Up @@ -686,6 +689,7 @@
<install>
<!-- Building with our minimum (c++11 only) version of ICU. -->
<build name="icu" version="55.2" parallel="true" >
<flag value="-w" />
<!-- TODO: verify this with more recent ICU. -->
<!-- Bug in ICU 55.2 build requires enable-draft. -->
<option value="--enable-draft" />
Expand All @@ -698,7 +702,7 @@
<option value="--disable-tests" />
<option value="--disable-samples" />
</build>
<build name="boost" version="1.78.0" parallel="true" nuget="true" >
<build name="boost" version="1.78.0" parallel="true" nuget="true" prebuild="true" >
<option value="--with-chrono" />
<option value="--with-iostreams" />
<option value="--with-json" />
Expand Down Expand Up @@ -904,6 +908,7 @@

<install>
<build name="zmq" version="4.3.5" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-Werror" />
</build>
<build name="bitcoin-system" github="libbitcoin" repository="libbitcoin-system" branch="master" parallel="true" >
Expand Down Expand Up @@ -1106,6 +1111,7 @@

<install>
<build name="zmq" version="4.3.5" parallel="true" nuget="true" >
<flag value="-w" />
<option value="--disable-Werror" />
</build>
<build name="bitcoin-protocol" github="libbitcoin" repository="libbitcoin-protocol" branch="master" parallel="true" >
Expand Down Expand Up @@ -1302,6 +1308,7 @@

<install>
<build name="icu" version="68.2" parallel="true" >
<flag value="-w" />
<!-- Bug in ICU 55.2 build requires -enable-draft. -->
<option value="--enable-rpath" />
<option value="--enable-tools" />
Expand Down Expand Up @@ -2254,8 +2261,8 @@
</configuration>
<configuration name="gnu-optimized-size" description="Factored size optimization settings." hidden="true">
<property name="cacheVariables" type="object">
<property name="CMAKE_C_FLAGS" value="$env{CMAKE_C_FLAGS} -Os -s" />
<property name="CMAKE_CXX_FLAGS" value="$env{CMAKE_CXX_FLAGS} -Os -s" />
<property name="CMAKE_C_FLAGS" value="$env{CMAKE_C_FLAGS} -Os" />
<property name="CMAKE_CXX_FLAGS" value="$env{CMAKE_CXX_FLAGS} -Os" />
</property>
</configuration>
<configuration name="nix-gnu-debug-static" description="Debug build with static linking." hidden="false" display="*nix/GNU/Debug/Static">
Expand Down
4 changes: 2 additions & 2 deletions templates/gsl.CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "$(compiler_id(_flag.compiler))")
. endif
$(my.indent)check_cxx_compiler_flag( "-$(_flag.name)" HAS_FLAG_$(_flag.name:upper) )
$(my.indent)if ( HAS_FLAG_$(_flag.name:upper) )
$(my.indent)add_compile_options( "-$(_flag.name)" )
$(my.indent)add_compile_options( $<$<COMPILE_LANGUAGE:CXX>:-$(_flag.name)> )
$(my.indent)else()
$(my.indent)message( FATAL_ERROR "Compiler does not support -$(_flag.name)" )
$(my.indent)endif()
Expand Down Expand Up @@ -1117,7 +1117,7 @@ $(my.indent)check_cxx_compiler_flag("$(my.flags)" $(my.symbol_prefix)$(my.compou

$(my.indent)if ($(my.symbol_prefix)$(my.compound.name:upper))
. for my.compound.flag as _flag where defined(_flag.name) & !is_empty(_flag.name)
$(my.indent)add_compile_options( "-$(_flag.name)" )
$(my.indent)add_compile_options( $<$<COMPILE_LANGUAGE:CXX>:-$(_flag.name)> )
. endfor
. if defined(my.compound->program)
$(my.indent)set( CMAKE_REQUIRED_FLAGS_PREV "${CMAKE_REQUIRED_FLAGS}" )
Expand Down
44 changes: 41 additions & 3 deletions templates/gsl.developer_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,14 @@ make_jobs()
. define_disable_exit_on_error()
.endmacro # define_utility_functions
.
.macro define_build_functions()
.macro define_build_functions(install)
. define my.install = define_build_functions.install
. define_tarball_functions("true")
. define_github_functions()
. define_boost_build_functions()
. if (count(my.install.build, count.name = "boost") > 0)
. define my.build = my.install->build(name = "boost")
. define_boost_build_functions(my.build)
. endif
. define_initialize_object_directory()
.endmacro # define_build_functions
.
Expand All @@ -293,55 +297,76 @@ $(my.prefix)unpack_from_tarball $ICU_ARCHIVE $ICU_URL gzip "$BUILD_ICU"
.endmacro # unpack_from_tarball_icu
.
.macro build_from_tarball_icu(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${ICU_FLAGS[@]}"
$(my.prefix)build_from_tarball $ICU_ARCHIVE source "$PARALLEL" "$BUILD_ICU" "${ICU_OPTIONS[@]}" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_from_tarball_icu
.
.macro unpack_from_tarball_zlib(prefix)
$(my.prefix)unpack_from_tarball $ZLIB_ARCHIVE $ZLIB_URL gzip "$BUILD_ZLIB"
.endmacro # unpack_from_tarball_zlib
.
.macro build_from_tarball_zlib(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${ZLIB_FLAGS[@]}"
$(my.prefix)build_from_tarball $ZLIB_ARCHIVE . "$PARALLEL" "$BUILD_ZLIB" "${ZLIB_OPTIONS[@]}" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_from_tarball_zlib
.
.macro unpack_from_tarball_png(prefix)
$(my.prefix)unpack_from_tarball $PNG_ARCHIVE $PNG_URL xz "$BUILD_PNG"
.endmacro # unpack_from_tarball_png
.
.macro build_from_tarball_png(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${PNG_FLAGS[@]}"
$(my.prefix)build_from_tarball $PNG_ARCHIVE . "$PARALLEL" "$BUILD_PNG" "${PNG_OPTIONS[@]}" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_from_tarball_png
.
.macro unpack_from_tarball_qrencode(prefix)
$(my.prefix)unpack_from_tarball $QRENCODE_ARCHIVE $QRENCODE_URL bzip2 "$BUILD_QRENCODE"
.endmacro # unpack_from_tarball_qrencode
.
.macro build_from_tarball_qrencode(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${QRENCODE_FLAGS[@]}"
$(my.prefix)build_from_tarball $QRENCODE_ARCHIVE . "$PARALLEL" "$BUILD_QRENCODE" "${QRENCODE_OPTIONS[@]}" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_from_tarball_qrencode
.
.macro unpack_from_tarball_zmq(prefix)
$(my.prefix)unpack_from_tarball $ZMQ_ARCHIVE $ZMQ_URL gzip "$BUILD_ZMQ"
.endmacro # unpack_from_tarball_zmq
.
.macro build_from_tarball_zmq(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${ZMQ_FLAGS[@]}"
$(my.prefix)build_from_tarball $ZMQ_ARCHIVE . $PARALLEL "$BUILD_ZMQ" "${ZMQ_OPTIONS[@]}" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_from_tarball_zmq
.
.macro unpack_from_tarball_mbedtls(prefix)
$(my.prefix)unpack_from_tarball $MBEDTLS_ARCHIVE $MBEDTLS_URL gzip "$BUILD_MBEDTLS"
.endmacro # unpack_from_tarball_mbedtls
.
.macro build_from_tarball_mbedtls(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${MBEDTLS_FLAGS[@]}"
$(my.prefix)build_from_tarball $MBEDTLS_ARCHIVE . $PARALLEL "$BUILD_MBEDTLS" "${MBEDTLS_OPTIONS[@]}" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_from_tarball_mbedtls
.
.macro unpack_boost(prefix)
$(my.prefix)unpack_from_tarball $BOOST_ARCHIVE $BOOST_URL bzip2 "$BUILD_BOOST"
.endmacro # unpack_boost
.
.macro build_boost(prefix)
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS ${BOOST_FLAGS[@]}"
$(my.prefix)build_from_tarball_boost $BOOST_ARCHIVE "$PARALLEL" "$BUILD_BOOST" "${BOOST_OPTIONS[@]}"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_boost
.
.macro create_github(build, prefix)
Expand All @@ -354,16 +379,24 @@ $(my.prefix)create_from_github $(my.build.github) $(my.build.repository) $(my.bu
. define my.build = build_github.build
. define my.parallel = is_true(my.build.parallel) ?? "$PARALLEL" ? "$SEQUENTIAL"
. define my.conditional = is_true(my.build.conditional) ?? "$WITH_$(my.build.name:upper,c)" ? "yes"
. define my.flags = "${$(my.build.name:upper,c)_FLAGS[@]}"
. define my.options = "${$(my.build.name:upper,c)_OPTIONS[@]}"
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $(my.flags)"
$(my.prefix)build_from_github $(my.build.repository) "$(my.parallel)" false "$(my.conditional)" "$(my.options)" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_github_test
.
.macro build_github_test(build, prefix)
. define my.build = build_github_test.build
. define my.parallel = is_true(my.build.parallel) ?? "$PARALLEL" ? "$SEQUENTIAL"
. define my.conditional = is_true(my.build.conditional) ?? "$WITH_$(my.build.name:upper,c)" ? "yes"
. define my.flags = "${$(my.build.name:upper,c)_FLAGS[@]}"
. define my.options = "${$(my.build.name:upper,c)_OPTIONS[@]}"
local SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $(my.flags)"
$(my.prefix)build_from_github $(my.build.repository) "$(my.parallel)" true "$(my.conditional)" "$(my.options)" "$@"
export CPPFLAGS=$SAVE_CPPFLAGS
.endmacro # build_github_test
.
.macro define_create_local_copies(install)
Expand Down Expand Up @@ -532,7 +565,7 @@ function generate_setup(path_prefix)
define_display_configuration(_repository, _install)

heading1("Define build functions.")
define_build_functions()
define_build_functions(_install)

heading1("The master download/clone/sync function.")
define_create_local_copies(_install)
Expand All @@ -543,6 +576,11 @@ function generate_setup(path_prefix)
heading1("Initialize the build environment.")
define_initialization_calls()

heading1("Define build flags.")
for _install.build as _build where count(_build.flag) > 0
define_build_flags(_config, _build)
endfor _build

heading1("Define build options.")
for _install.build as _build where count(_build.option) > 0
define_build_options(_config, _build)
Expand Down
Loading

0 comments on commit 2b35883

Please sign in to comment.