Skip to content

Commit

Permalink
Now use submodules Utils+Flocke+GC
Browse files Browse the repository at this point in the history
  • Loading branch information
ebertolazzi committed Oct 25, 2020
1 parent 4d98e67 commit baedd97
Show file tree
Hide file tree
Showing 41 changed files with 1,170 additions and 1,383 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "submodules/quarticRootsFlocke"]
path = submodules/quarticRootsFlocke
url = https://github.com/ebertolazzi/quarticRootsFlocke
[submodule "submodules/GenericContainer"]
path = submodules/GenericContainer
url = https://github.com/ebertolazzi/GenericContainer.git
[submodule "submodules/Utils"]
path = submodules/Utils
url = https://github.com/ebertolazzi/Utils.git
21 changes: 3 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@ matrix:
- COMPILER="CC=gcc-5 && CXX=g++-5"
before_install: eval "${COMPILER}"
script: make travis
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
- gcc-6
env:
- COMPILER="CC=gcc-6 && CXX=g++-6"
before_install: eval "${COMPILER}"
script: make travis
- os: linux
addons:
apt:
Expand All @@ -45,10 +33,10 @@ matrix:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
- gcc-8
- g++-9
- gcc-9
env:
- COMPILER="CC=gcc-8 && CXX=g++-8"
- COMPILER="CC=gcc-9 && CXX=g++-9"
before_install: eval "${COMPILER}"
script: make travis
- os: linux
Expand All @@ -59,9 +47,6 @@ matrix:
- os: osx
osx_image: xcode10
script: make travis
- os: windows
install: choco install mingw
script: mingw32-make travis
- os: windows
env:
- CMAKE_PATH="/c/Program Files/CMake/bin"
Expand Down
32 changes: 21 additions & 11 deletions CMakeLists-cflags.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@

SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
SET( CMAKE_VERBOSE_MAKEFILE TRUE )

# /Gd Uses the __cdecl calling convention (x86 only).
# /Gr Uses the __fastcall calling convention (x86 only).
# /Gv Uses the __vectorcall calling convention. (x86 and x64 only)
# /Gz Uses the __stdcall calling convention (x86 only).
# /Gr Uses the __fastcall calling convention (x86 only).
# /Gv Uses the __vectorcall calling convention. (x86 and x64 only)
# /Gz Uses the __stdcall calling convention (x86 only).

SET( CXX_WARN "-Wall -Wno-float-equal -Wno-padded ")
SET( CLANG_WARN "-Weverything -Wno-alloca -Wno-cast-align -Wno-cast-qual -Wno-conversion -Wno-c++2a-compat -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-documentation -Wno-float-equal -Wno-padded -Wno-reserved-id-macro -Wno-unreachable-code-break -Wno-unused-macros -Wno-switch-enum -Wno-sign-conversion -Wno-signed-enum-bitfield -Wno-weak-vtables ")
SET( VS_WARN "")

IF( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
SET( CMAKE_CXX_FLAGS "-std=c++11 " )
SET( CMAKE_CXX_FLAGS_RELEASE "-fPIC -Wall -Wno-float-equal -Wno-padded -funroll-loops -O2 -g " )
SET( CMAKE_CXX_FLAGS_DEBUG "-fPIC -Wall -Wno-float-equal -Wno-padded -O0 -g -DMECHATRONIX_DEBUG -DDEBUG " )
SET( CMAKE_CXX_FLAGS "-std=c++11 " )
SET( CMAKE_CXX_FLAGS_RELEASE "-fPIC -fopenmp -O2 -g -floop-interchange -floop-block -funroll-loops ${CXX_WARN}" )
SET( CMAKE_CXX_FLAGS_DEBUG "-fPIC -fopenmp -O0 -g -DMECHATRONIX_DEBUG -DDEBUG ${CXX_WARN}" )
ELSEIF( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
SET( CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ " )
SET( CMAKE_CXX_FLAGS_RELEASE "-fPIC -Weverything -Wno-weak-vtables -Wno-implicit-fallthrough -Wno-documentation-unknown-command -Wno-float-equal -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-reserved-id-macro -Wno-documentation -funroll-loops -O2 -g " )
SET( CMAKE_CXX_FLAGS_DEBUG "-fPIC -Weverything -Wno-weak-vtables -Wno-implicit-fallthrough -Wno-documentation-unknown-command -Wno-float-equal -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-reserved-id-macro -Wno-documentation -O0 -gfull -DMECHATRONIX_DEBUG -DDEBUG " )
SET( CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ " )
SET( CMAKE_CXX_FLAGS_RELEASE "-fPIC -Os -g -finline-functions -finline-hint-functions -funroll-loops -fcolor-diagnostics ${CLANG_WARN}" )
SET( CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -gfull -fcolor-diagnostics -DMECHATRONIX_DEBUG -DDEBUG ${CLANG_WARN}" )
ELSEIF( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
SET( CMAKE_CXX_FLAGS_RELEASE "/nologo /GS /W3 /WX- /Gm- /fp:precise /EHsc /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /O2 /MD " )
SET( CMAKE_CXX_FLAGS_DEBUG "/nologo /GS /W3 /WX- /Gm- /fp:precise /EHsc /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /Od /Ob0 /MDd /Z7 /RTC1 /D_DEBUG /DMECHATRONIX_DEBUG " )
SET( CMAKE_CXX_FLAGS "" )
SET( CMAKE_CXX_FLAGS_RELEASE "/nologo /GS /W3 /WX- /EHsc /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /O2 /MD ${VS_WARN}" )
SET( CMAKE_CXX_FLAGS_DEBUG "/nologo /GS /W3 /WX- /EHsc /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /Od /Ob0 /MDd /RTC1 /guard:cf /Zi /D_DEBUG /DMECHATRONIX_DEBUG ${VS_WARN}" )
ELSE()
MESSAGE( FATAL_ERROR "Unsupported compiler ${CMAKE_CXX_COMPILER_ID}")
ENDIF()

MESSAGE( STATUS "Compiler used: ${CMAKE_CXX_COMPILER_ID}")

SET( CMAKE_C_FLAGS "" )
SET( CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )
SET( CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )

# select LAPACK library to be used
SET( PINS_USE_ACCELERATE true )
27 changes: 6 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OS=$(shell uname -s)
PWD=$(shell pwd)

INC = -I./src -I./include -Isubmodules/quarticRootsFlocke/src
INC = -I./src -I./include -Isubmodules/Utils/src -Isubmodules/quarticRootsFlocke/src -Isubmodules/GenericContainer/src
DEFS =
STATIC_EXT = .a
DYNAMIC_EXT = .so
Expand Down Expand Up @@ -52,26 +52,11 @@ endif

.SUFFIXES: .o

SRCS = \
src/AABBtree.cc \
src/Biarc.cc \
src/BiarcList.cc \
src/Circle.cc \
src/Clothoid.cc \
src/ClothoidAsyPlot.cc \
src/ClothoidDistance.cc \
src/ClothoidG2.cc \
src/ClothoidList.cc \
src/Fresnel.cc \
src/G2lib.cc \
src/G2lib_intersect.cc \
src/Line.cc \
src/PolyLine.cc \
src/Triangle2D.cc \
submodules/quarticRootsFlocke/src/PolynomialRoots-1-Quadratic.cc \
submodules/quarticRootsFlocke/src/PolynomialRoots-2-Cubic.cc \
submodules/quarticRootsFlocke/src/PolynomialRoots-3-Quartic.cc \
submodules/quarticRootsFlocke/src/PolynomialRoots-Utils.cc
SRCS = $(shell echo src/*.cc) \
$(shell echo submodules/Utils/src/*.cc) \
$(shell echo submodules/Utils/src/fmt/*.cc) \
$(shell echo submodules/quarticRootsFlocke/src/*.cc) \
$(shell echo submodules/GenericContainer/src/*.cc)

OBJS = $(SRCS:.cc=.o)
DEPS = src/Clothoid.hh src/CubicRootsFlocke.hh
Expand Down
92 changes: 69 additions & 23 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ require_relative "./Rakefile_common.rb"

task :default => [:build]

task :mkl, [:year, :bits] do |t, args|
args.with_defaults(:year => "2017", :bits => "x64" )
sh "'C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/bin/compilervars.bat' -arch #{args.bits} vs#{args.year}shell"
end

TESTS = [
"testBiarc",
"testDistance",
Expand Down Expand Up @@ -52,11 +47,11 @@ end

desc "compile for Visual Studio [default year=2017, bits=x64]"
task :build_win, [:year, :bits] do |t, args|
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'

args.with_defaults( :year => "2017", :bits => "x64" )

Rake::Task[:win_3rd].invoke(args.year,args.bits,args.lapack)

dir = "vs_#{args.year}_#{args.bits}"

FileUtils.rm_rf dir
Expand Down Expand Up @@ -91,57 +86,108 @@ task :build_win, [:year, :bits] do |t, args|
FileUtils.cd '..'
end

desc 'compile for OSX'
task :build_osx do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
desc "compile for OSX"
task :build, [:os] do |t, args|

args.with_defaults( :os => "osx" )

case args.os
when 'osx'
Rake::Task[:osx_3rd].invoke()
when 'linux'
Rake::Task[:linux_3rd].invoke()
end

dir = "build"

FileUtils.rm_rf dir
FileUtils.mkdir_p dir
FileUtils.cd dir

cmake_cmd = 'cmake '
cmake_cmd = "cmake "

if COMPILE_EXECUTABLE then
cmake_cmd += ' -DBUILD_EXECUTABLE:VAR=true '
cmake_cmd += '-DBUILD_EXECUTABLE:VAR=true '
else
cmake_cmd += ' -DBUILD_EXECUTABLE:VAR=false '
cmake_cmd += '-DBUILD_EXECUTABLE:VAR=false '
end
if COMPILE_DYNAMIC then
cmake_cmd += ' -DBUILD_SHARED:VAR=true '
cmake_cmd += '-DBUILD_SHARED:VAR=true '
else
cmake_cmd += ' -DBUILD_SHARED:VAR=false '
cmake_cmd += '-DBUILD_SHARED:VAR=false '
end

if COMPILE_DEBUG then
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Debug --loglevel=WARNING ..'
sh cmake_cmd + '-DCMAKE_BUILD_TYPE:VAR=Debug .. ' #--loglevel=WARNING ..'
sh 'cmake --build . --config Debug --target install '+PARALLEL+QUIET
else
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Release --loglevel=WARNING ..'
sh cmake_cmd + '-DCMAKE_BUILD_TYPE:VAR=Release .. ' #--loglevel=WARNING ..'
sh 'cmake --build . --config Release --target install '+PARALLEL+QUIET
end

FileUtils.cd '..'
end

desc "compile for LINUX"
task :build_linux do
Rake::Task[:build].invoke("linux")
end

desc "compile for OSX"
task :build_osx do
Rake::Task[:build].invoke("osx")
end

desc 'install third parties for osx'
task :osx_3rd do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/Utils/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/quarticRootsFlocke/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/GenericContainer/CMakeLists-cflags.txt'
FileUtils.cd 'submodules'
puts "\n\nSUBMODULES (for SPLINES)\n\n".green
sh "rake build_osx"
FileUtils.cd '..'
end

desc 'compile for LINUX'
task :build_linux => [ :build_osx ] do
desc 'install third parties for linux'
task :linux_3rd do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/Utils/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/quarticRootsFlocke/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/GenericContainer/CMakeLists-cflags.txt'
FileUtils.cd 'submodules'
puts "\n\nSUBMODULES (for SPLINES)\n\n".green
sh "rake build_linux"
FileUtils.cd '..'
end

desc "compile for Visual Studio [default year=2017, bits=x64]"
task :win_3rd, [:year, :bits] do |t, args|
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/Utils/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/quarticRootsFlocke/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/GenericContainer/CMakeLists-cflags.txt'
args.with_defaults( :year => "2017", :bits => "x64" )
FileUtils.cd 'submodules'
puts "\n\nSUBMODULES (for SPLINES)\n\n".green
sh "rake build_win[#{args.year},#{args.bits}]"
FileUtils.cd '..'
end

desc "clean for OSX"
task :clean_osx do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
end

desc "clean for LINUX"
task :clean_linux do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
end

desc "clean for WINDOWS"
task :clean_win do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
Expand Down
13 changes: 5 additions & 8 deletions src/AABBtree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,12 @@ namespace G2lib {
void
AABBtree::print( ostream_type & stream, int level ) const {
if ( empty() ) {
stream
<< "[EMPTY AABB tree]\n";
stream << "[EMPTY AABB tree]\n";
} else {
stream
<< "BBOX xmin = " << setw(12) << pBBox->m_xmin
<< " ymin = " << setw(12) << pBBox->m_ymin
<< " xmax = " << setw(12) << pBBox->m_xmax
<< " ymax = " << setw(12) << pBBox->m_ymax
<< " level = " << level << "\n";
fmt::print( stream,
"BBOX xmin={:<12.4)} ymin={:<12.4)} xmax={:<12.4)} ymax={:<12.4)} level={}\n",
pBBox->m_xmin, pBBox->m_ymin, pBBox->m_xmax, pBBox->m_ymax
);
vector<PtrAABB>::const_iterator it;
for ( it = children.begin(); it != children.end(); ++it )
(*it)->print( stream, level+1 );
Expand Down
8 changes: 4 additions & 4 deletions src/AABBtree.hh
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ namespace G2lib {

void
print( ostream_type & stream ) const {
stream
<< "BBOX (xmin,ymin,xmax,ymax) = ( " << m_xmin
<< ", " << m_ymin << ", " << m_xmax << ", " << m_ymax
<< " )\n";
fmt::print( stream,
"BBOX (xmin,ymin,xmax,ymax) = ( {}, {}, {}, {} )\n",
m_xmin, m_ymin, m_xmax, m_ymax
);
}

friend class AABBtree;
Expand Down
Loading

0 comments on commit baedd97

Please sign in to comment.