diff --git a/.gitmodules b/.gitmodules index 5db4906..ee0290a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "submodules/Utils"] - path = submodules/Utils - url = https://github.com/ebertolazzi/Utils.git [submodule "submodules/quarticRootsFlocke"] path = submodules/quarticRootsFlocke url = https://github.com/ebertolazzi/quarticRootsFlocke.git @@ -10,3 +7,6 @@ [submodule "cmake_utils"] path = cmake_utils url = https://github.com/ebertolazzi/cmake_utils.git +[submodule "submodules/UtilsLite"] + path = submodules/UtilsLite + url = git@github.com:ebertolazzi/UtilsLite.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 03c4a7c..f030931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,19 @@ cmake_minimum_required(VERSION 3.14) project( Splines ) -include(./cmake_utils/CMakeLists-common.txt) + +if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/cmake_utils") + set( HOME "${PROJECT_SOURCE_DIR}/cmake_utils/" ) +else() + if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/../cmake_utils") + set( HOME "${PROJECT_SOURCE_DIR}/../cmake_utils/" ) + else() + set( HOME "${PROJECT_SOURCE_DIR}/../../cmake_utils/" ) + endif() +endif() + + +include( "${HOME}/CMakeLists-common.txt" ) project( ${PROJECT_NAME} @@ -26,8 +38,8 @@ if (APPLE) set( CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE} ) endif() -include(./cmake_utils/CMakeLists-cflags.txt) -include(./cmake_utils/CMakeLists-utilities.txt) +include( "${HOME}/CMakeLists-cflags.txt" ) +include( "${HOME}/CMakeLists-utilities.txt" ) # Evaluating the suffix to append to target built by this CMake file utils_artifacts_suffix(ARTIFACTS_STATIC_SUFFIX TRUE) @@ -95,7 +107,7 @@ set(DEPEND_TARGETS) # DEPENDENCIES (TRY TO USE ALREADY COMPILED SUBMODULE IN LARGE PROJECT) utils_add_library_or_submodule( "quarticRootsFlocke" ROOTS ) -utils_add_library_or_submodule( "Utils" UTILS ) +utils_add_library_or_submodule( "UtilsLite" UTILS ) utils_add_library_or_submodule( "GenericContainer" GC "GC" ) message( STATUS "----------------------------------------------------------------" ) diff --git a/Rakefile b/Rakefile index 4f04b3f..ba9bfd0 100755 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,8 @@ -require_relative "./cmake_utils/Rakefile_common.rb" +if File.exist?(File.expand_path('./cmake_utils/Rakefile_common.rb', File.dirname(__FILE__))) then + require_relative "./cmake_utils/Rakefile_common.rb" +else + require_relative "../Rakefile_common.rb" +end CLEAN.include ["./**/*.o", "./**/*.obj", "./bin/**/example*", "./build"] CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f").downcase == "core" } diff --git a/src/SplineAkima.cc b/src/SplineAkima.cc index 910b9db..2484784 100644 --- a/src/SplineAkima.cc +++ b/src/SplineAkima.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include /** diff --git a/src/SplineAkima2D.cc b/src/SplineAkima2D.cc index 3e882ad..e35baf6 100644 --- a/src/SplineAkima2D.cc +++ b/src/SplineAkima2D.cc @@ -20,6 +20,8 @@ #include "Splines.hh" #include #include +#include "Utils_fmt.hh" + /** * */ diff --git a/src/SplineBessel.cc b/src/SplineBessel.cc index b054f30..b56e5e5 100644 --- a/src/SplineBessel.cc +++ b/src/SplineBessel.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" /*\ | ____ _ ____ _ _ diff --git a/src/SplineBiCubic.cc b/src/SplineBiCubic.cc index 8972411..fa88831 100644 --- a/src/SplineBiCubic.cc +++ b/src/SplineBiCubic.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include @@ -37,6 +39,13 @@ namespace Splines { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + BiCubicSplineBase::BiCubicSplineBase( string const & name ) + : SplineSurf( name ) + , m_mem_bicubic( fmt::format("BiCubicSplineBase[{}]",name) ) + {} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + void BiCubicSpline::make_spline() { size_t nn{ size_t(m_nx*m_ny) }; diff --git a/src/SplineBiQuintic.cc b/src/SplineBiQuintic.cc index 7544a95..0ff99b1 100644 --- a/src/SplineBiQuintic.cc +++ b/src/SplineBiQuintic.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src/SplineBilinear.cc b/src/SplineBilinear.cc index a140b34..dbc9f7a 100644 --- a/src/SplineBilinear.cc +++ b/src/SplineBilinear.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src/SplineConstant.cc b/src/SplineConstant.cc index 1296725..95a47c1 100644 --- a/src/SplineConstant.cc +++ b/src/SplineConstant.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ @@ -36,6 +38,13 @@ namespace Splines { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ConstantSpline::ConstantSpline( string const & name ) + : Spline(name) + , m_mem_constant( fmt::format("ConstantSpline[{}]",name) ) + {} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + void ConstantSpline::reserve_external( integer n, diff --git a/src/SplineCubic.cc b/src/SplineCubic.cc index 34d4bf5..e31a0d9 100644 --- a/src/SplineCubic.cc +++ b/src/SplineCubic.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" #ifdef __clang__ #pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/src/SplineCubicBase.cc b/src/SplineCubicBase.cc index 06d1871..251e396 100644 --- a/src/SplineCubicBase.cc +++ b/src/SplineCubicBase.cc @@ -19,6 +19,8 @@ #include "Splines.hh" #include "PolynomialRoots.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ @@ -36,6 +38,13 @@ namespace Splines { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + CubicSplineBase::CubicSplineBase( string const & name ) + : Spline(name) + , m_mem_cubic( fmt::format("CubicSplineBase[{}]::m_mem_cubic", name ) ) + {} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + void CubicSplineBase::build( real_type const x[], integer incx, diff --git a/src/SplineHermite.cc b/src/SplineHermite.cc index abdfb3b..71d964e 100644 --- a/src/SplineHermite.cc +++ b/src/SplineHermite.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" #ifdef __clang__ #pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/src/SplineLinear.cc b/src/SplineLinear.cc index a1e628b..da6d205 100644 --- a/src/SplineLinear.cc +++ b/src/SplineLinear.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ @@ -34,6 +36,17 @@ using namespace std; // load standard namspace namespace Splines { + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + LinearSpline::LinearSpline( string const & name ) + : Spline(name) + , m_mem_linear( fmt::format( "LinearSpline[{}]", name ) ) + { + m_curve_extended_constant = true; // by default linear spline extend constant + } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + real_type LinearSpline::id_eval( integer i, real_type x ) const { if ( m_curve_can_extend && m_curve_extended_constant ) { @@ -44,6 +57,8 @@ namespace Splines { return (1-s)*m_Y[i] + s * m_Y[i+1]; } + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + real_type LinearSpline::eval( real_type x ) const { std::pair res(0,x); @@ -51,6 +66,8 @@ namespace Splines { return this->id_eval( res.first, res.second ); } + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + real_type LinearSpline::id_D( integer i, real_type x ) const { if ( m_curve_can_extend && m_curve_extended_constant ) { @@ -59,6 +76,8 @@ namespace Splines { return ( m_Y[i+1] - m_Y[i] ) / ( m_X[i+1] - m_X[i] ); } + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + real_type LinearSpline::D( real_type x ) const { if ( m_curve_can_extend && m_curve_extended_constant ) { diff --git a/src/SplinePchip.cc b/src/SplinePchip.cc index 5c5acae..39617d9 100644 --- a/src/SplinePchip.cc +++ b/src/SplinePchip.cc @@ -19,6 +19,7 @@ #include "Splines.hh" #include "SplinesUtils.hh" +#include "Utils_fmt.hh" #include diff --git a/src/SplineQuintic.cc b/src/SplineQuintic.cc index 2a21279..f51d590 100644 --- a/src/SplineQuintic.cc +++ b/src/SplineQuintic.cc @@ -19,6 +19,8 @@ #include "Splines.hh" #include "SplinesUtils.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ @@ -38,6 +40,13 @@ namespace Splines { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + QuinticSplineBase::QuinticSplineBase( string const & name ) + : Spline(name) + , m_base_quintic( fmt::format( "QuinticSplineBase[{}]", name ) ) + {} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /*\ Sistema lineare da risolvere diff --git a/src/SplineQuinticBase.cc b/src/SplineQuinticBase.cc index 1ae6376..1db2704 100644 --- a/src/SplineQuinticBase.cc +++ b/src/SplineQuinticBase.cc @@ -19,6 +19,8 @@ #include "Splines.hh" #include "PolynomialRoots.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ diff --git a/src/SplineSet.cc b/src/SplineSet.cc index 53564ab..6b0914d 100644 --- a/src/SplineSet.cc +++ b/src/SplineSet.cc @@ -20,6 +20,7 @@ #include "Splines.hh" #include "SplinesUtils.hh" #include "PolynomialRoots.hh" +#include "Utils_fmt.hh" #include #include diff --git a/src/SplineSetGC.cc b/src/SplineSetGC.cc index 4a4b7eb..fe04cb9 100644 --- a/src/SplineSetGC.cc +++ b/src/SplineSetGC.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src/SplineVec.cc b/src/SplineVec.cc index 32222ed..0705c5d 100644 --- a/src/SplineVec.cc +++ b/src/SplineVec.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src/Splines.cc b/src/Splines.cc index c5d3978..ce370dc 100644 --- a/src/Splines.cc +++ b/src/Splines.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "SplinesUtils.hh" +#include "Utils_fmt.hh" #include #include // std::numeric_limits @@ -479,6 +480,48 @@ namespace Splines { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + void + Spline::y_min_max( + integer & i_min_pos, + real_type & x_min_pos, + real_type & y_min, + integer & i_max_pos, + real_type & x_max_pos, + real_type & y_max + ) const { + i_min_pos = i_max_pos = 0; + x_min_pos = y_min = x_max_pos = y_max = 0; + UTILS_ERROR( + "In spline: {} y_min_max not implemented\n", + info() + ); + } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + void + Spline::y_min_max( + vector & i_min_pos, + vector & x_min_pos, + vector & y_min, + vector & i_max_pos, + vector & x_max_pos, + vector & y_max + ) const { + i_min_pos.clear(); + i_max_pos.clear(); + x_min_pos.clear(); + x_max_pos.clear(); + y_min.clear(); + y_max.clear(); + UTILS_ERROR( + "In spline: {} y_min_max not implemented\n", + info() + ); + } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + real_type curvature( real_type s, Spline const & X, Spline const & Y ) { real_type x_1 = X.D(s); diff --git a/src/Splines.hh b/src/Splines.hh index 64959d3..d93c5e9 100644 --- a/src/Splines.hh +++ b/src/Splines.hh @@ -529,14 +529,7 @@ namespace Splines { integer & i_max_pos, real_type & x_max_pos, real_type & y_max - ) const { - i_min_pos = i_max_pos = 0; - x_min_pos = y_min = x_max_pos = y_max = 0; - UTILS_ERROR( - "In spline: {} y_min_max not implemented\n", - info() - ); - } + ) const; //! //! Search the max and min values of `y` along the spline @@ -558,18 +551,7 @@ namespace Splines { vector & i_max_pos, vector & x_max_pos, vector & y_max - ) const { - i_min_pos.clear(); - i_max_pos.clear(); - x_min_pos.clear(); - x_max_pos.clear(); - y_min.clear(); - y_max.clear(); - UTILS_ERROR( - "In spline: {} y_min_max not implemented\n", - info() - ); - } + ) const; ///@} @@ -920,10 +902,7 @@ namespace Splines { //! //! Spline constructor. //! - CubicSplineBase( string const & name = "CubicSplineBase" ) - : Spline(name) - , m_mem_cubic( fmt::format("CubicSplineBase[{}]::m_mem_cubic", name ) ) - {} + CubicSplineBase( string const & name = "CubicSplineBase" ); ~CubicSplineBase() override {} ///@} diff --git a/src/Splines/SplineBiCubic.hxx b/src/Splines/SplineBiCubic.hxx index 6b719c5..976f4e6 100644 --- a/src/Splines/SplineBiCubic.hxx +++ b/src/Splines/SplineBiCubic.hxx @@ -52,10 +52,7 @@ namespace Splines { public: //! spline constructor - BiCubicSplineBase( string const & name = "BiCubicSplineBase" ) - : SplineSurf( name ) - , m_mem_bicubic( fmt::format("BiCubicSplineBase[{}]",name) ) - {} + BiCubicSplineBase( string const & name = "BiCubicSplineBase" ); ~BiCubicSplineBase() override {} diff --git a/src/Splines/SplineConstant.hxx b/src/Splines/SplineConstant.hxx index 3cd723f..6f67276 100644 --- a/src/Splines/SplineConstant.hxx +++ b/src/Splines/SplineConstant.hxx @@ -39,10 +39,7 @@ namespace Splines { using Spline::build; #endif - ConstantSpline( string const & name = "ConstantSpline" ) - : Spline(name) - , m_mem_constant( fmt::format("ConstantSpline[{}]",name) ) - {} + ConstantSpline( string const & name = "ConstantSpline" ); ~ConstantSpline() override {} diff --git a/src/Splines/SplineLinear.hxx b/src/Splines/SplineLinear.hxx index c2c069a..96480e6 100644 --- a/src/Splines/SplineLinear.hxx +++ b/src/Splines/SplineLinear.hxx @@ -39,12 +39,7 @@ namespace Splines { using Spline::build; #endif - LinearSpline( string const & name = "LinearSpline" ) - : Spline(name) - , m_mem_linear( fmt::format( "LinearSpline[{}]", name ) ) - { - m_curve_extended_constant = true; // by default linear spline extend constant - } + LinearSpline( string const & name = "LinearSpline" ); ~LinearSpline() override {} diff --git a/src/Splines/SplineQuinticBase.hxx b/src/Splines/SplineQuinticBase.hxx index 5b7addc..6aebc97 100644 --- a/src/Splines/SplineQuinticBase.hxx +++ b/src/Splines/SplineQuinticBase.hxx @@ -52,10 +52,7 @@ namespace Splines { //! //! Spline constructor //! - QuinticSplineBase( string const & name = "QuinticSplineBase" ) - : Spline(name) - , m_base_quintic( fmt::format( "QuinticSplineBase[{}]", name ) ) - {} + QuinticSplineBase( string const & name = "QuinticSplineBase" ); ~QuinticSplineBase() override {} diff --git a/src/Splines1D.cc b/src/Splines1D.cc index 9798d95..e57c42f 100644 --- a/src/Splines1D.cc +++ b/src/Splines1D.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" #ifdef __clang__ #pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/src/Splines2D.cc b/src/Splines2D.cc index 48733c6..5e0e33f 100644 --- a/src/Splines2D.cc +++ b/src/Splines2D.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" #ifdef __clang__ #pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/src/SplinesBivariate.cc b/src/SplinesBivariate.cc index 23301f0..9a376a8 100644 --- a/src/SplinesBivariate.cc +++ b/src/SplinesBivariate.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src/SplinesCinterface.cc b/src/SplinesCinterface.cc index 8fce8c5..33ca682 100644 --- a/src/SplinesCinterface.cc +++ b/src/SplinesCinterface.cc @@ -30,6 +30,7 @@ #include "Splines.hh" #include "SplinesCinterface.h" +#include "Utils_fmt.hh" #ifdef __clang__ #pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/src/SplinesUtils.cc b/src/SplinesUtils.cc index 1024aa1..98be83f 100644 --- a/src/SplinesUtils.cc +++ b/src/SplinesUtils.cc @@ -18,6 +18,7 @@ \*--------------------------------------------------------------------------*/ #include "SplinesUtils.hh" +#include "Utils_fmt.hh" #ifdef __clang__ #pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/src_tests/test1.cc b/src_tests/test1.cc index e0bddfe..52ea47a 100644 --- a/src_tests/test1.cc +++ b/src_tests/test1.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ diff --git a/src_tests/test10.cc b/src_tests/test10.cc index 811f9ac..e7d6517 100644 --- a/src_tests/test10.cc +++ b/src_tests/test10.cc @@ -17,8 +17,11 @@ | | \*--------------------------------------------------------------------------*/ -#include #include "Splines.hh" +#include "Utils_fmt.hh" + +#include + #include #ifdef __clang__ diff --git a/src_tests/test2.cc b/src_tests/test2.cc index 282a52c..a63404e 100644 --- a/src_tests/test2.cc +++ b/src_tests/test2.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ diff --git a/src_tests/test3.cc b/src_tests/test3.cc index 28e8c97..2568f52 100644 --- a/src_tests/test3.cc +++ b/src_tests/test3.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ diff --git a/src_tests/test4.cc b/src_tests/test4.cc index d88ca3f..03b2eaa 100644 --- a/src_tests/test4.cc +++ b/src_tests/test4.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ diff --git a/src_tests/test5.cc b/src_tests/test5.cc index ffcd59d..7aa2c9d 100644 --- a/src_tests/test5.cc +++ b/src_tests/test5.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #ifdef __clang__ diff --git a/src_tests/test6.cc b/src_tests/test6.cc index 1ea3fc3..f711958 100644 --- a/src_tests/test6.cc +++ b/src_tests/test6.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src_tests/test8.cc b/src_tests/test8.cc index e88c80f..095f904 100644 --- a/src_tests/test8.cc +++ b/src_tests/test8.cc @@ -18,6 +18,8 @@ \*--------------------------------------------------------------------------*/ #include "Splines.hh" +#include "Utils_fmt.hh" + #include #include diff --git a/src_tests/test9.cc b/src_tests/test9.cc index f4bfb75..4834a77 100644 --- a/src_tests/test9.cc +++ b/src_tests/test9.cc @@ -17,8 +17,11 @@ | | \*--------------------------------------------------------------------------*/ -#include #include "Splines.hh" +#include "Utils_fmt.hh" + +#include + #include #ifdef __GNUC__ diff --git a/submodules/GenericContainer b/submodules/GenericContainer index 1be4a0a..98d5c52 160000 --- a/submodules/GenericContainer +++ b/submodules/GenericContainer @@ -1 +1 @@ -Subproject commit 1be4a0a0bcacce1ec1303b1c8fbd729d49f4b2c0 +Subproject commit 98d5c52bd74a6701e23c5eb5ed6cf44b6ba4d0bf diff --git a/submodules/Rakefile b/submodules/Rakefile index 9704496..21d6495 100755 --- a/submodules/Rakefile +++ b/submodules/Rakefile @@ -9,10 +9,8 @@ task :copy_submodules, [:arg] do |t, args| FileUtils.mkdir_p "../lib3rd/dll/" FileUtils.mkdir_p "../lib3rd/bin/" tmp = '_' + args.arg - ["Utils"].each do |base| - FileUtils.cp_r "./#{base}/lib/include/#{base}/.", "../lib3rd/include" - FileUtils.cp_r "./#{base}/lib/.", "../lib3rd" - end + FileUtils.cp_r "./UtilsLite/lib/include/Utils/.", "../lib3rd/include" + FileUtils.cp_r "./UtilsLite/lib/.", "../lib3rd" ["quarticRootsFlocke","GenericContainer"].each do |base| FileUtils.cp_r "./#{base}/lib/.", "../lib3rd/" end @@ -20,7 +18,7 @@ end task :build_common, [:arg] do |t, args| args.with_defaults(:arg => "osx") - FileUtils.cd "Utils" + FileUtils.cd "UtilsLite" sh "rake clean_#{args.arg}" sh "rake build_#{args.arg}" FileUtils.cd "../quarticRootsFlocke" @@ -55,7 +53,7 @@ end task :clean_common, [:arg] do |t, args| args.with_defaults(:arg => "osx") - FileUtils.cd "Utils" + FileUtils.cd "UtilsLite" sh "rake clean_#{args.arg}" FileUtils.cd "../quarticRootsFlocke" sh "rake clean_#{args.arg}" diff --git a/submodules/Utils b/submodules/Utils deleted file mode 160000 index 5f09865..0000000 --- a/submodules/Utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5f098659f32c04b9d3155eedeab581fd5bbf6c0b diff --git a/submodules/UtilsLite b/submodules/UtilsLite new file mode 160000 index 0000000..8045073 --- /dev/null +++ b/submodules/UtilsLite @@ -0,0 +1 @@ +Subproject commit 8045073d088a811c89443b0920bd931b46984f9b diff --git a/submodules/quarticRootsFlocke b/submodules/quarticRootsFlocke index b506c49..f6ca0dc 160000 --- a/submodules/quarticRootsFlocke +++ b/submodules/quarticRootsFlocke @@ -1 +1 @@ -Subproject commit b506c49ea735173211de2d2bbbe65b989efb4acd +Subproject commit f6ca0dc0de9826ff6575416c307449e7cb23125a diff --git a/toolbox/cmake_utils/CMakeLists-utilities.txt b/toolbox/cmake_utils/CMakeLists-utilities.txt index dcf0185..5a3254a 100644 --- a/toolbox/cmake_utils/CMakeLists-utilities.txt +++ b/toolbox/cmake_utils/CMakeLists-utilities.txt @@ -98,24 +98,36 @@ function(utils_add_library_or_submodule MODULE_NAME MODULE_LIB ) # # DEPENDENCIES (TRY TO USE ALREADY COMPILED SUBMODULE IN LARGE PROJECT) # + set(MODULE_DIR ${MODULE_NAME}) + # Cannot use ARGN directly with list() command, + # so copy it to a variable first. + set (extra_args ${ARGN}) + # Did we get any optional args? + list(LENGTH extra_args extra_count) + if (${extra_count} GREATER 0) + list(GET extra_args 0 optional_arg) + set(MODULE_DIR ${optional_arg}) + endif() + set(UPDIR ${CMAKE_CURRENT_SOURCE_DIR}/..) message(STATUS ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") message(STATUS "Search library ${MODULE_NAME}${ARTIFACTS_STATIC_SUFFIX}") - message(STATUS "at ${UPDIR}/${MODULE_NAME}/lib/lib" ) + message(STATUS "at ${UPDIR}/${MODULE_DIR}/lib/lib" ) find_library( ${MODULE_LIB} ${MODULE_NAME}${ARTIFACTS_STATIC_SUFFIX} - HINTS ${UPDIR}/${MODULE_NAME}/lib/lib + HINTS ${UPDIR}/${MODULE_DIR}/lib/lib NO_DEFAULT_PATH ) if( ${MODULE_LIB} ) message(STATUS "Found ${${MODULE_LIB}}") utils_copy_directory( - "${UPDIR}/${MODULE_NAME}/lib" + "${UPDIR}/${MODULE_DIR}/lib" "${CMAKE_CURRENT_SOURCE_DIR}/lib3rd" ) else() message(STATUS "NOT Found ${MODULE_NAME}${ARTIFACTS_STATIC_SUFFIX} use submodule") add_subdirectory(./submodules/${MODULE_NAME}) + include_directories(./submodules/${MODULE_NAME}/include) include_directories(./submodules/${MODULE_NAME}/src) set( ${MODULE_LIB} ${UTILS_NAMESPACE}_${MODULE_NAME}_Static PARENT_SCOPE ) set( UTILS_DEPEND_TARGETS ${UTILS_DEPEND_TARGETS} ${LIB} PARENT_SCOPE ) diff --git a/toolbox/cmake_utils/Rakefile_common.rb b/toolbox/cmake_utils/Rakefile_common.rb index 338ca52..8e27793 100644 --- a/toolbox/cmake_utils/Rakefile_common.rb +++ b/toolbox/cmake_utils/Rakefile_common.rb @@ -214,6 +214,8 @@ def cmake_vs_command( bits, year ) tmp = 'cmake -G "Visual Studio 15 2017' + win32_64 +'" ' + tmp when "2019" tmp = 'cmake -G "Visual Studio 16 2019"' + win32_64_ + tmp + when "2022" + tmp = 'cmake -G "Visual Studio 17 2022"' + win32_64_ + tmp else puts "Visual Studio year #{year} not supported!\n"; return "" diff --git a/toolbox/populate_toolbox.rb b/toolbox/populate_toolbox.rb index 8f8a13d..c3b016f 100644 --- a/toolbox/populate_toolbox.rb +++ b/toolbox/populate_toolbox.rb @@ -9,7 +9,7 @@ FileUtils.cp_r "../cmake_utils/.", "./cmake_utils"; FileUtils.rm_rf "./cmake_utils/.git"; # remove git struture FileUtils.cp_r "../submodules/quarticRootsFlocke/src/.", "./src"; -FileUtils.cp_r "../submodules/Utils/src/.", "./src"; +FileUtils.cp_r "../submodules/UtilsLite/src/.", "./src"; FileUtils.cp_r "../submodules/GenericContainer/src/.", "./src"; FileUtils.cp_r "../submodules/GenericContainer/include/.", "./src"; # elimino dipendenze da Eigen diff --git a/toolbox/src_mex/GenericContainerMatlabInterface.cc b/toolbox/src_mex/GenericContainerMatlabInterface.cc index 01f8ba0..3313e3f 100644 --- a/toolbox/src_mex/GenericContainerMatlabInterface.cc +++ b/toolbox/src_mex/GenericContainerMatlabInterface.cc @@ -426,7 +426,7 @@ namespace GC_namespace { void to_mxArray( mat_int_type const & val, mxArray * & mx ) { - mwSize dims[2] = { mwSize(val.numRows()), mwSize(val.numCols()) }; + mwSize dims[2] = { mwSize(val.num_rows()), mwSize(val.num_cols()) }; mx = mxCreateNumericArray(2,dims,mxINT32_CLASS,mxREAL); int32_t * ptr = static_cast(mxGetData(mx)); mwSize k = 0; @@ -437,7 +437,7 @@ namespace GC_namespace { void to_mxArray( mat_long_type const & val, mxArray * & mx ) { - mwSize dims[2] = { mwSize(val.numRows()), mwSize(val.numCols()) }; + mwSize dims[2] = { mwSize(val.num_rows()), mwSize(val.num_cols()) }; mx = mxCreateNumericArray(2,dims,mxINT64_CLASS,mxREAL); int64_t * ptr = static_cast(mxGetData(mx)); mwSize k = 0; @@ -448,7 +448,7 @@ namespace GC_namespace { void to_mxArray( mat_real_type const & val, mxArray * & mx ) { - mwSize dims[2] = { mwSize(val.numRows()), mwSize(val.numCols()) }; + mwSize dims[2] = { mwSize(val.num_rows()), mwSize(val.num_cols()) }; mx = mxCreateNumericArray(2,dims,mxDOUBLE_CLASS,mxREAL); real_type * ptr = mxGetPr(mx); mwSize k = 0; @@ -459,7 +459,7 @@ namespace GC_namespace { void to_mxArray( mat_complex_type const & val, mxArray * & mx ) { - mwSize dims[2] = { mwSize(val.numRows()), mwSize(val.numCols()) }; + mwSize dims[2] = { mwSize(val.num_rows()), mwSize(val.num_cols()) }; mx = mxCreateNumericArray(2,dims,mxDOUBLE_CLASS,mxCOMPLEX); real_type * ptr = mxGetPr(mx); real_type * pti = mxGetPi(mx); @@ -566,8 +566,8 @@ namespace GC_namespace { break; case GC_type::MAT_INTEGER: { - dims[0] = gc.get_numRows(); - dims[1] = gc.get_numCols(); + dims[0] = gc.num_rows(); + dims[1] = gc.num_cols(); mx = mxCreateNumericArray(2,dims,mxINT32_CLASS,mxREAL); int_type * ptr = static_cast(mxGetData(mx)); mwSize k = 0; @@ -578,8 +578,8 @@ namespace GC_namespace { break; case GC_type::MAT_LONG: { - dims[0] = gc.get_numRows(); - dims[1] = gc.get_numCols(); + dims[0] = gc.num_rows(); + dims[1] = gc.num_cols(); mx = mxCreateNumericArray(2,dims,mxINT64_CLASS,mxREAL); long_type * ptr = static_cast(mxGetData(mx)); mwSize k = 0; @@ -590,8 +590,8 @@ namespace GC_namespace { break; case GC_type::MAT_REAL: { - dims[0] = gc.get_numRows(); - dims[1] = gc.get_numCols(); + dims[0] = gc.num_rows(); + dims[1] = gc.num_cols(); mx = mxCreateNumericArray(2,dims,mxDOUBLE_CLASS,mxREAL); real_type * ptr = mxGetPr(mx); mwSize k = 0; @@ -602,8 +602,8 @@ namespace GC_namespace { break; case GC_type::MAT_COMPLEX: { - dims[0] = gc.get_numRows(); - dims[1] = gc.get_numCols(); + dims[0] = gc.num_rows(); + dims[1] = gc.num_cols(); mx = mxCreateNumericArray(2,dims,mxDOUBLE_CLASS,mxCOMPLEX); real_type * ptr = mxGetPr(mx); real_type * pti = mxGetPi(mx);