Skip to content

Commit

Permalink
increase testing of CMake build files
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Oct 26, 2023
1 parent a0fbf1d commit 3d17afc
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 11 deletions.
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def main(ctx):
windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.1", "B2_CXXSTD": "11,14,17"}, globalenv=globalenv),
windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019:2", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.2", "B2_CXXSTD": "17,latest"}, globalenv=globalenv),
windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv),
windows_cxx("msvc-14.3 cmake-superproject", "", image="cppalliance/dronevs2022:1", buildtype="cmake-superproject", buildscript="drone", environment={"B2_TOOLSET": "msvc-14.3", "B2_CXXSTD": "17,20"}, globalenv=globalenv),
osx_cxx("macOS: Clang", "clang++", packages="", buildscript="drone", buildtype="boost", xcode_version="13.4.1", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '17'}, globalenv=globalenv)
# osx_cxx("macOS: gcc-12", "g++-12", packages="", buildscript="drone", buildtype="boost", xcode_version="13.4.1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '17'}, globalenv=globalenv)
]
Expand Down
61 changes: 61 additions & 0 deletions .drone/drone.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,65 @@ echo '==================================> COMPILE'
set B2_TARGETS=libs/!SELF!/test libs/!SELF!/example
call !BOOST_ROOT!\libs\!SELF!\ci\build.bat

) else ( if "%DRONE_JOB_BUILDTYPE%" == "cmake-superproject" (

echo "Running cmake superproject job"
echo '==================================> INSTALL'
REM there seems to be some problem with b2 bootstrap on Windows
REM when CXX env variable is set
SET "CXX="

git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1
cp -prf boost-ci-cloned/ci .
rm -rf boost-ci-cloned
REM source ci/travis/install.sh
REM The contents of install.sh below:

for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi
SET BOOST_CI_TARGET_BRANCH=!TRAVIS_BRANCH!
SET BOOST_CI_SRC_FOLDER=%cd%

call ci\common_install.bat

echo '==================================> COMPILE'

if "!CMAKE_NO_TESTS!" == "" (
SET CMAKE_NO_TESTS=error
)
if "!CMAKE_NO_TESTS!" == "error" (
SET CMAKE_BUILD_TESTING=-DBUILD_TESTING=ON
)


cd ../../

mkdir __build_static && cd __build_static
cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^
-DBOOST_INCLUDE_LIBRARIES=!SELF! !CMAKE_OPTIONS! ..
cmake --build . --target install --config Debug
ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug

cmake --build . --target install --config Release
ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release
cd ..


if "!CMAKE_SHARED_LIBS!" == "" (
SET CMAKE_SHARED_LIBS=1
)
if "!CMAKE_SHARED_LIBS!" == "1" (

mkdir __build_shared && cd __build_shared
cmake -DBoost_VERBOSE=1 !CMAKE_BUILD_TESTING! -DCMAKE_INSTALL_PREFIX=iprefix ^
-DBOOST_INCLUDE_LIBRARIES=!SELF! -DBUILD_SHARED_LIBS=ON !CMAKE_OPTIONS! ..
cmake --build . --config Debug
cmake --build . --target install --config Debug
ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Debug

cmake --build . --config Release
cmake --build . --target install --config Release
ctest --output-on-failure --no-tests=error -R boost_!SELF! -C Release

)

))
22 changes: 12 additions & 10 deletions .drone/drone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,28 @@ common_install
echo '==================================> COMPILE'

export CXXFLAGS="-Wall -Wextra -Werror"
export CMAKE_OPTIONS=${CMAKE_OPTIONS:--DBUILD_TESTING=ON}
export CMAKE_SHARED_LIBS=${CMAKE_SHARED_LIBS:-1}
export CMAKE_NO_TESTS=${CMAKE_NO_TESTS:-error}
if [ $CMAKE_NO_TESTS = "error" ]; then
CMAKE_BUILD_TESTING="-DBUILD_TESTING=ON"
fi

mkdir __build_static
cd __build_static
cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 ${CMAKE_OPTIONS} \
-DBOOST_INCLUDE_LIBRARIES=$SELF ..
cmake --build .
ctest --output-on-failure -R boost_$SELF

cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \
-DBOOST_INCLUDE_LIBRARIES=$SELF ${CMAKE_OPTIONS} ..
cmake --build . --target install
ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS -R boost_$SELF
cd ..

if [ "$CMAKE_SHARED_LIBS" = 1 ]; then

mkdir __build_shared
cd __build_shared
cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 ${CMAKE_OPTIONS} \
-DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON ..
cmake --build .
ctest --output-on-failure -R boost_$SELF
cmake -DBoost_VERBOSE=1 ${CMAKE_BUILD_TESTING} -DCMAKE_INSTALL_PREFIX=iprefix \
-DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON ${CMAKE_OPTIONS} ..
cmake --build . --target install
ctest --output-on-failure --no-tests=$CMAKE_NO_TESTS -R boost_$SELF

fi

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run_analyze-bloat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: [push, pull_request]

env:
CMAKE_SHARED_LIBS: '0'
CMAKE_NO_TESTS: ignore
CMAKE_OPTIONS: >
-DBOOST_JSON_BUILD_TESTS=OFF
-DBOOST_JSON_BUILD_FUZZERS=OFF
Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ endif()

file(GLOB_RECURSE BOOST_JSON_TESTS_FILES CONFIGURE_DEPENDS Jamfile *.cpp *.hpp)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX cmake_install_test/.*$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX intrusive_macros\.cpp$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX limits\.cpp$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX no_exceptions\.cpp$)

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${BOOST_JSON_TESTS_FILES})
add_executable(boost_json-tests ${BOOST_JSON_TESTS_FILES})
Expand All @@ -29,7 +32,7 @@ add_test(NAME boost_json-tests COMMAND boost_json-tests)
add_dependencies(tests boost_json-tests)


source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES limits.cpp main.cpp unhygenic_macros.cpp)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES limits.cpp main.cpp intrusive_macros.cpp)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../src PREFIX "" FILES ../src/src.cpp)
add_executable(boost_json-limits limits.cpp main.cpp ../src/src.cpp Jamfile)
boost_json_setup_properties(boost_json-limits)
Expand Down

0 comments on commit 3d17afc

Please sign in to comment.