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

[fixes] Boost fixes for versions >=1.85 #218

Merged
merged 9 commits into from
Jun 13, 2024
Merged
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
96 changes: 88 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ name: Continuous Integration

on:
push:
branches:
- master
- develop
# branches:
# - master
# - develop
# Skip jobs when only documentation files are changed
paths-ignore:
- '**.md'
- '**.rst'
- 'docs/**'
# paths-ignore:
# - '**.md'
# - '**.rst'
# - 'docs/**'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
- 'docs/**'

jobs:
build:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -68,3 +68,83 @@ jobs:
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_PREFIX_PATH:PATH="$PWD/../../cctag_install;${DEPS_INSTALL_DIR}"
make -j8

build_windows:
runs-on: windows-latest
strategy:
matrix:
config: [ Debug, Release ]
env:
buildDir: '${{ github.workspace }}\build\'
vcpkgDir: '${{ github.workspace }}\..\e\vcpkg'
# commit for version 2023.11.20
COMMIT_ID: a42af01b72c28a8e1d7b48107b33e4f286a55ef6

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Install latest CMake.
uses: lukka/get-cmake@latest

# Restore from cache the previously built ports. If a "cache miss" occurs, then vcpkg is bootstrapped. Since a the vcpkg.json is being used later on to install the packages when run-cmake runs, no packages are installed at this time and the input 'setupOnly:true' is mandatory.
- name: vcpkg - Setup dependencies
uses: lukka/run-vcpkg@v7
with:
# Just install vcpkg for now, do not install any ports in this step yet.
setupOnly: false
# Location of the vcpkg submodule in the Git repository.
vcpkgDirectory: ${{ env.vcpkgDir }}
vcpkgGitCommitId: ${{ env.COMMIT_ID }}
vcpkgArguments: >
boost-accumulators
boost-algorithm boost-container
boost-date-time
boost-exception
boost-filesystem
boost-foreach
boost-iterator
boost-lexical-cast
boost-math
boost-mpl
boost-multi-array
boost-ptr-container
boost-program-options
boost-serialization
boost-spirit
boost-static-assert
boost-stacktrace
boost-test
boost-thread
boost-throw-exception
boost-timer
boost-type-traits
boost-unordered
opencv
tbb
eigen3
vcpkgTriplet: x64-windows
# doNotCache: true
# This is used to unbreak cached artifacts if for some reason dependencies fail to build,
# the action does not notice it and saves broken artifacts.
appendedCacheKey: cache007

- name: vcpkg - Display installed packages
run:
${{ env.vcpkgDir }}\vcpkg.exe list

- name: Build
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildDirectory: ${{ env.buildDir }}
# cmakeGenerator: VS16Win64
cmakeAppendedArgs: -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DVCPKG_TARGET_TRIPLET=x64-windows -A x64 -T host=x64 -DCCTAG_WITH_CUDA:BOOL=OFF
# This input tells run-cmake to consume the vcpkg.cmake toolchain file set by run-vcpkg.
cmakeBuildType: ${{ matrix.config }}
useVcpkgToolchainFile: true
buildWithCMake: true
buildWithCMakeArgs: -j1 --config ${{ matrix.config }}
3 changes: 3 additions & 0 deletions doc/sphinx/source/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ To install the dependencies:
boost-container
boost-date-time
boost-exception
boost-foreach
boost-filesystem
boost-iterator
boost-lexical-cast
Expand All @@ -142,6 +143,8 @@ To install the dependencies:
tbb
eigen3

Note that for boost >= 1.85 you have to use :code:`math[legacy]`.

You can add the flag :code:`--triplet` to specify the architecture and the version you want to build.
For example:

Expand Down
3 changes: 1 addition & 2 deletions src/applications/detection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <boost/archive/xml_oarchive.hpp>
#include <boost/exception/all.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/ptr_container/ptr_list.hpp>
#include <boost/timer/timer.hpp>
#include <opencv2/core/core.hpp>
Expand Down Expand Up @@ -501,7 +500,7 @@ int main(int argc, char** argv)
tbb::parallel_for(0, 2, [&](size_t fileListIdx) {
for(const auto& fileInFolder : files[fileListIdx])
{
const std::string subExt(bfs::extension(fileInFolder.second));
const std::string subExt(fileInFolder.second.extension().string());

if((subExt == ".png") || (subExt == ".jpg") || (subExt == ".PNG") || (subExt == ".JPG"))
{
Expand Down
1 change: 0 additions & 1 deletion src/cctag/CCTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include <opencv2/core/core_c.h>

#include <boost/foreach.hpp>
#include <boost/array.hpp>
#include <boost/mpl/bool.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/cctag/CCTagFlowComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <cctag/CCTagFlowComponent.hpp>
#include <cctag/utils/Defines.hpp>

#include <boost/foreach.hpp>

namespace cctag
{
Expand Down
1 change: 0 additions & 1 deletion src/cctag/DataSerialization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/foreach.hpp>

namespace cctag {

Expand Down
1 change: 0 additions & 1 deletion src/cctag/Detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "cctag/cuda/tag.h"
#endif

#include <boost/foreach.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/mpl/bool.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/cctag/EllipseGrowing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <opencv2/core/types_c.h>

#include <boost/math/special_functions/pow.hpp>
#include <boost/foreach.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/assert.hpp>
Expand Down
4 changes: 0 additions & 4 deletions src/cctag/Fitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/round.hpp>
Expand Down Expand Up @@ -226,8 +225,6 @@
} // geometry

float innerProdMin(const std::vector<cctag::EdgePoint*>& filteredChildren, float thrCosDiffMax, Point2d<Vector3s> & p1, Point2d<Vector3s> & p2) {
using namespace boost::numeric;
//using namespace cctag::numerical;

EdgePoint* pAngle1 = nullptr;
EdgePoint* pAngle2 = nullptr;
Expand All @@ -240,7 +237,7 @@

if (!filteredChildren.empty())
{

Check notice on line 240 in src/cctag/Fitting.cpp

View check run for this annotation

codefactor.io / CodeFactor

src/cctag/Fitting.cpp#L240

Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
float normGrad = std::sqrt(p0->dX() * p0->dX() + p0->dY() * p0->dY());

// Step 1
Expand Down Expand Up @@ -335,8 +332,7 @@
}

void circleFitting(cctag::numerical::geometry::Ellipse& e, const std::vector<cctag::EdgePoint*>& points) {
using namespace boost::numeric;

Check notice on line 335 in src/cctag/Fitting.cpp

View check run for this annotation

codefactor.io / CodeFactor

src/cctag/Fitting.cpp#L335

Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
std::size_t nPoints = points.size();

Eigen::MatrixXf A(nPoints, 4);
Expand Down
1 change: 0 additions & 1 deletion src/cctag/Fitting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <cctag/EdgePoint.hpp>
#include <cctag/geometry/Ellipse.hpp>
#include <cctag/geometry/Point.hpp>
#include <boost/foreach.hpp>

#include <list>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion src/cctag/ICCTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <cctag/Detection.hpp>
#include <cctag/utils/LogTime.hpp>

#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include <boost/archive/xml_iarchive.hpp>

Expand Down
18 changes: 9 additions & 9 deletions src/cctag/Identification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <boost/accumulators/statistics/median.hpp>
#include <boost/accumulators/statistics/variance.hpp>
#include <boost/assert.hpp>
#include <boost/foreach.hpp>

#include <cmath>
#include <mutex>
Expand Down Expand Up @@ -60,7 +61,7 @@ bool orazioDistanceRobust(

using MapT = std::map<float, MarkerID>;

if ( cuts.size() == 0 )
if ( cuts.empty() )
{
return false;
}
Expand Down Expand Up @@ -570,9 +571,7 @@ void selectCutCheapUniform( std::vector< cctag::ImageCut > & vSelectedCuts,

vSelectedCuts.clear();
vSelectedCuts.reserve(selectSize);

std::size_t sharpSize = 0;


// Initialize vector of indices of sharp cuts
std::vector<std::size_t> indToAdd;
indToAdd.reserve(varCuts.size());
Expand Down Expand Up @@ -700,12 +699,13 @@ std::pair<float,float> convImageCut(const std::vector<float> & kernel, ImageCut
//cut.imgSignal() = output;

// Locate the maximum value.
std::vector<float>::iterator maxValueIt = std::max_element(output.begin(), output.end());
auto maxValueIt = std::max_element(output.begin(), output.end());
float itsLocation = (float) std::distance(output.begin(), maxValueIt);

//CCTAG_COUT_VAR2(*maxValueIt, itsLocation);

return std::pair<float,float>(*maxValueIt,itsLocation);// max value, its location

// max value, its location
return {*maxValueIt, itsLocation};
}

/**
Expand Down Expand Up @@ -1261,7 +1261,7 @@ int identify_step_1(
)
#endif

if ( cuts.size() == 0 )
if ( cuts.empty() )
{
// Can happen when an object or the image frame is occluding a part of all available cuts.
return status::no_collected_cuts;
Expand All @@ -1287,7 +1287,7 @@ int identify_step_1(
const float spendTime = d.total_milliseconds();
}

if ( vSelectedCuts.size() == 0 )
if ( vSelectedCuts.empty() )
{
CCTAG_COUT_DEBUG("Unable to select any cut.");
return status::no_selected_cuts; // todo: is class attributes the best option?
Expand Down
2 changes: 0 additions & 2 deletions src/cctag/Identification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#include <opencv2/opencv.hpp>

#include <boost/foreach.hpp>
#include <boost/accumulators/statistics/median.hpp>
#include <boost/foreach.hpp>
#include <boost/math/special_functions/pow.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/cctag/Vote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <cctag/utils/Defines.hpp>
#include <cctag/utils/VisualDebug.hpp>

#include <boost/foreach.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/log1p.hpp>
Expand Down
3 changes: 0 additions & 3 deletions src/cctag/optimization/conditioner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#include <cctag/Statistic.hpp>
#include <cctag/geometry/Ellipse.hpp>

#include <boost/foreach.hpp>


namespace cctag {
namespace numerical {
namespace optimization {
Expand Down
Loading