Closed BlueNoise closed 2 years ago
If I use cmake instead with the proposed fix in #29, it generates this:
.
├── include
│ ├── Clothoids
│ │ ├── AABBtree.hxx
│ │ ├── BaseCurve.hxx
│ │ ├── BaseCurve_using.hxx
│ │ ├── Biarc.hxx
│ │ ├── BiarcList.hxx
│ │ ├── Circle.hxx
│ │ ├── ClothoidAsyPlot.hxx
│ │ ├── Clothoid.hxx
│ │ ├── ClothoidList.hxx
│ │ ├── Fresnel.hxx
│ │ ├── G2lib.hxx
│ │ ├── Line.hxx
│ │ ├── PolyLine.hxx
│ │ └── Triangle2D.hxx
│ └── Clothoids.hh
└── lib
└── libClothoids_linux_static.a
I checked on OSX and LINUX and it will compile correctly producing the right pattern of files. Probably your problems depends on something else.
I am willing to accept I am doing something wrong, but right now I am following the steps that are presented in the documentation and it doesn't produce the expected files. Is there a specific build order with make as well? If so, which order?
The correct compilation was obtained with the command
rake builld_[osx/linux/win]
the Makefile was not aligned for the copy of the headers. Now I have patched the makefile in such a way after
make
you find:
lib
├── include
│ ├── Clothoids
│ │ ├── AABBtree.hxx
│ │ ├── BaseCurve.hxx
│ │ ├── BaseCurve_using.hxx
│ │ ├── Biarc.hxx
│ │ ├── BiarcList.hxx
│ │ ├── Circle.hxx
│ │ ├── Clothoid.hxx
│ │ ├── ClothoidAsyPlot.hxx
│ │ ├── ClothoidList.hxx
│ │ ├── Fresnel.hxx
│ │ ├── G2lib.hxx
│ │ ├── Line.hxx
│ │ ├── PolyLine.hxx
│ │ └── Triangle2D.hxx
│ ├── Clothoids.hh
│ └── Utils
└── lib
├── libClothoids_osx.dylib
└── libClothoids_osx_static.a
I added the tag install_all, include_local_all which install include also the submodules as you like. For example using
make
make include_local_all
you find
lib
├── include
│ ├── Clothoids
│ │ ├── AABBtree.hxx
│ │ ├── BaseCurve.hxx
│ │ ├── BaseCurve_using.hxx
│ │ ├── Biarc.hxx
│ │ ├── BiarcList.hxx
│ │ ├── CPUinfo.hh
│ │ ├── Circle.hxx
│ │ ├── Clothoid.hxx
│ │ ├── ClothoidAsyPlot.hxx
│ │ ├── ClothoidList.hxx
│ │ ├── Fresnel.hxx
│ │ ├── G2lib.hxx
│ │ ├── Line.hxx
│ │ ├── PolyLine.hxx
│ │ ├── PolynomialRoots-Utils.hh
│ │ ├── PolynomialRoots.hh
│ │ ├── Triangle2D.hxx
│ │ ├── Utils
│ │ │ ├── Console.hxx
│ │ │ ├── Malloc.hxx
│ │ │ ├── Numbers.hxx
│ │ │ ├── Quaternion.hxx
│ │ │ ├── Table.hxx
│ │ │ ├── ThreadPool.hxx
│ │ │ ├── TicToc.hxx
│ │ │ ├── Trace.hxx
│ │ │ ├── Utils.hxx
│ │ │ ├── fmt
│ │ │ │ ├── chrono.h
│ │ │ │ ├── color.h
│ │ │ │ ├── compile.h
│ │ │ │ ├── core.h
│ │ │ │ ├── fmt_LICENSE.rst
│ │ │ │ ├── format-inl.h
│ │ │ │ ├── format.cc
│ │ │ │ ├── format.h
│ │ │ │ ├── locale.h
│ │ │ │ ├── os.cc
│ │ │ │ ├── os.h
│ │ │ │ ├── ostream.h
│ │ │ │ ├── posix.h
│ │ │ │ ├── printf.h
│ │ │ │ └── ranges.h
│ │ │ ├── mingw-std-threads
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── cmake_stdheaders_generator
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── template.cpp
│ │ │ │ ├── mingw.condition_variable.h
│ │ │ │ ├── mingw.future.h
│ │ │ │ ├── mingw.invoke.h
│ │ │ │ ├── mingw.mutex.h
│ │ │ │ ├── mingw.shared_mutex.h
│ │ │ │ ├── mingw.thread.h
│ │ │ │ ├── tests
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── tests.cpp
│ │ │ │ └── utility_scripts
│ │ │ │ ├── Generate-StdLikeHeaders.ps1
│ │ │ │ ├── generate_std_like_headers.bat
│ │ │ │ └── generate_std_like_headers_interactive.bat
│ │ │ ├── rang.hxx
│ │ │ └── zstream
│ │ │ ├── README.md
│ │ │ ├── izstream.hpp
│ │ │ ├── izstream_impl.hpp
│ │ │ ├── ozstream.hpp
│ │ │ ├── ozstream_impl.hpp
│ │ │ └── zstream_common.hpp
│ │ ├── Utils.hh
│ │ └── Utils_zstream.hh
│ ├── Clothoids.hh
│ └── Utils
└── lib
├── libClothoids_osx.dylib
├── libClothoids_osx_static.a
├── libQuartic_osx_static.a
└── libUtils_osx_static.a
check the last version.
Ideally, it would work with CMake as this is the build system generator we are using at the time. It still doesn't build if I do the exact steps below:
git clone https://github.com/ebertolazzi/Clothoids.git
cd Clothoids
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make
Even if I build each submodule (i.e. GenericContainer, quarticRootsFlocke and Utils) prior to building the Clothoids project, it still doesn't build and I still have the same issue as presented in #26 and #27, which is:
In file included from Clothoids/src/Fresnel.cc:20:0:
Clothoids/src/Clothoids.hh:33:20: fatal error: Utils.hh: No such file or directory
To compile using cmake you must use cmake+rake:
rake build_linux
the command perform all the extra task you need:
task :copy_submodules, [:arg] do |t, args|
args.with_defaults(:arg => "osx")
FileUtils.mkdir_p "../lib3rd/"
FileUtils.mkdir_p "../lib3rd/lib/"
FileUtils.mkdir_p "../lib3rd/dll/"
FileUtils.mkdir_p "../lib3rd/bin/"
FileUtils.mkdir_p "../lib3rd/include/"
tmp = '_' + args.arg
["./Utils/","./quarticRootsFlocke/", "./GenericContainer/"].each do |base|
FileUtils.cp_r base + "lib/lib/.", "../lib3rd/lib" if Dir.exist?(base + "lib/lib")
FileUtils.cp_r base + "lib/dll/.", "../lib3rd/dll" if Dir.exist?(base + "lib/dll")
FileUtils.cp_r base + "lib/bin/.", "../lib3rd/bin" if Dir.exist?(base + "lib/bin")
FileUtils.cp_r base + "lib/include/.", "../lib3rd/include"
end
end
otherwise you need to copy the corresponding files to the required directories using extra commands. I normally use rake+cmake because it is easy to organize a big project (bigger than Clothoids). You can add the extra commands to CMakeFiles.txt. However is shorter to use
rake build_linux
instead of
mkdir build
cd build
cmake ..
make
(after the patching of CMakeLists.tzt).
I've done as you recommended and added this to the CMakeLists.txt:
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/submodules/Utils/src/
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib3rd/include/Utils/)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/submodules/quarticRootsFlocke/src/
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib3rd/include/)
just above this line
INCLUDE_DIRECTORIES( src lib3rd/include lib3rd/include/Utils )
This now builds successfully with the following output in the lib folder using only cmake:
.
├── include
│ ├── Clothoids
│ │ ├── AABBtree.hxx
│ │ ├── BaseCurve.hxx
│ │ ├── BaseCurve_using.hxx
│ │ ├── Biarc.hxx
│ │ ├── BiarcList.hxx
│ │ ├── Circle.hxx
│ │ ├── ClothoidAsyPlot.hxx
│ │ ├── Clothoid.hxx
│ │ ├── ClothoidList.hxx
│ │ ├── Fresnel.hxx
│ │ ├── G2lib.hxx
│ │ ├── Line.hxx
│ │ ├── PolyLine.hxx
│ │ └── Triangle2D.hxx
│ └── Clothoids.hh
└── lib
└── libClothoids_linux_static.a
Would you like me to create a PR for this? I would prefer if your version works with CMake without rake as I wouldn't need to fork. Otherwise, if its too much work I can simply fork and make my own modifications.
Added workaound to CMakeLists.txt as you suggested.
Thank you Enrico!
When I run make, it builds, but the process only provides this in the lib folder.
Is that what is expected? From the documentation, I see that it should look like this instead: