You can install frugally-deep using cmake as shown below, or (if you prefer) download the code (and the code of FunctionalPlus), extract it and tell your compiler to use the include
directories.
git clone https://github.com/Dobiasd/FunctionalPlus
cd FunctionalPlus
mkdir -p build && cd build
cmake ..
make && sudo make install
cd ../..
sudo apt install mercurial
hg clone https://bitbucket.org/eigen/eigen/
cd eigen
mkdir -p build && cd build
cmake ..
make && sudo make install
sudo ln -s /usr/local/include/eigen3/Eigen /usr/local/include/Eigen
cd ../..
git clone https://github.com/nlohmann/json
cd json
git checkout v3.1.2
mkdir -p build && cd build
cmake ..
make && sudo make install
cd ../..
git clone https://github.com/Dobiasd/frugally-deep
cd frugally-deep
mkdir -p build && cd build
cmake ..
make && sudo make install
cd ../..
Building the tests (optional) requires doctest. Unit Tests are disabled by default – they are enabled and executed by:
# install doctest
git clone https://github.com/onqtam/doctest.git
cd doctest
mkdir -p build && cd build
cmake .. -DDOCTEST_WITH_TESTS=OFF -DDOCTEST_WITH_MAIN_IN_STATIC_LIB=OFF
make && sudo make install
cd ../..
# build unit tests
cd frugally-deep
mkdir -p build && cd build
cmake -DFDEEP_BUILD_UNITTEST=ON ..
make unittest
cd ../..
Or if you would like to test exhaustively (and have plenty of time):
cmake -DFDEEP_BUILD_UNITTEST=ON -DFDEEP_BUILD_FULL_TEST=ON ..
make unittest
Installation using Conan C/C++ package manager
Just add a conanfile.txt with frugally-deep as a requirement and chose the generator for your project.
[requires]
frugally-deep/v0.8.1-p0@dobiasd/stable
[generators]
cmake
Then install it:
$ conan install conanfile.txt
Installation using the Hunter CMake package manager
The First Step section of the Hunter documentation shows how to get started.
Since the version of the package on hunter is out of date, the procedure below covers installation using a locally hosted version of the repo (through submodules). A sample project using this to run VGG16 is available at https://github.com/kmader/fd_demo
The basic idea is to use the standard hunter setup but to add a git submodule to your repository containing frugally-deep. Hunter will then use the code in that submodule to build the library (https://docs.hunter.sh/en/latest/user-guides/hunter-user/git-submodule.html?highlight=GIT_SUBMODULE).
Your CMakeLists.txt should look something like
cmake_minimum_required(VERSION 3.0) # minimum requirement for Hunter
include("cmake/HunterGate.cmake") # teach your project about Hunter (before project())
HunterGate( # Latest release shown here: https://github.com/ruslo/hunter/releases
URL "https://github.com/ruslo/hunter/archive/v0.20.17.tar.gz"
SHA1 "d7d1d5446bbf20b78fa5ac1b52ecb67a01c3790e"
LOCAL # <----- load cmake/Hunter/config.cmake
)
project(sample-frugally-deep)
hunter_add_package(frugally-deep)
find_package(frugally-deep CONFIG REQUIRED)
add_executable(foo foo.cpp)
target_link_libraries(foo PUBLIC frugally-deep::fdeep) # add frugally-deep and dependencies (libs/includes/flags/definitions)
You will then need to create a cmake/
directory with the HunterGate script in it
mkdir -p cmake
wget https://raw.githubusercontent.com/hunter-packages/gate/master/cmake/HunterGate.cmake -O cmake/HunterGate.cmake
Finally you will need a Hunter/config.cmake
to link to the submodule
mkdir -p cmake/Hunter
echo 'hunter_config(frugally-deep GIT_SUBMODULE "lib/frugally-deep")' > cmake/Hunter/config.cmake