As a build system, aGrUM uses CMake (http://www.cmake.org). A minimal project with agrum should look like this (for a project foo):
- in the project folder, a sub-folder src,
- in src folder, your *.{cpp|h|etc.} files
- in src folder, a file named CMakeLists.txt like this one :
2 cmake_minimum_required(VERSION 2.8)
4 set (CMAKE_CXX_STANDARD 14)
6 # do not forget to change this line if needed ("act install -d...")
7 set(AGRUM_INSTALLATION_DIRECTORY "/home/phw/usr")
8 set(aGrUM_DIR "${AGRUM_INSTALLATION_DIRECTORY}/lib/cmake/aGrUM/")
13 include_directories(${AGRUM_INCLUDE_DIR})
14 link_directories(${AGRUM_LIB_DIR})
16 message(FATAL_ERROR "Please install aGrUM")
19 # cmake -DCMAKE_BUILD_TYPE=DEBUG
21 # cmake -DCMAKE_BUILD_TYPE=RELEASE
22 # RELEASE is the default option (thanks to the next 3 lines)
23 if( NOT CMAKE_BUILD_TYPE )
24 set( CMAKE_BUILD_TYPE RELEASE)
27 file(GLOB_RECURSE FOO_SOURCE ${FOO_SOURCE_DIR}/*.cpp)
28 file(GLOB_RECURSE FOO_INCLUDE ${FOO_SOURCE_DIR}/*.h)
30 add_executable (foo ${FOO_SOURCE})
32 if (${CMAKE_BUILD_TYPE} STREQUAL "RELEASE") # release : act install release
33 target_link_libraries(foo agrum)
34 else() # debug : act install debug
35 target_link_libraries(foo agrum-dbg)
- a small minimum src/example.cpp :
#include <iostream>
int main() {
std::cout<<h<<std::endl;
}
- to compile the project (from the project folder)
- build/foo is the executable.