Skip to content
Snippets Groups Projects
Commit 41e0f1b4 authored by Vincent Templier's avatar Vincent Templier
Browse files

Add BUILD_CORE_ALONE mode to compile Core library

parent 10d8ec4c
No related branches found
No related tags found
No related merge requests found
# project(Aidge_Core) if (BUILD_CORE_ALONE)
project(Aidge_Core)
cmake_minimum_required(VERSION 3.11)
add_compile_options(-Wall -Wextra -fPIC)
endif()
if (PYBIND) if (PYBIND)
generate_python_binding(aidge_core core) Include(FetchContent)
FetchContent_Declare(
PyBind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.10.4 # or a later release
)
FetchContent_MakeAvailable(PyBind11)
file(GLOB_RECURSE pybind_src_files "python_binding/*.cpp")
pybind11_add_module(aidge_core MODULE ${pybind_src_files} "NO_EXTRAS")
target_include_directories(aidge_core PUBLIC ${pybind11_INCLUDE_DIRS} "python_binding")
target_link_libraries(aidge_core PUBLIC core)
# generate_python_binding(aidge_core core)
endif() endif()
add_library(core STATIC) add_library(core STATIC)
...@@ -21,8 +38,14 @@ if (PYBIND) ...@@ -21,8 +38,14 @@ if (PYBIND)
target_link_libraries(core PRIVATE ${PYTHON_LIBRARIES}) target_link_libraries(core PRIVATE ${PYTHON_LIBRARIES})
endif() endif()
if (NOT BUILD_CORE_ALONE)
# Activate compile time reducer for aidge_core
set_target_properties(core PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
# set_target_properties(n2d2_cpu_lib PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "include/utils/Precompiled.hpp")
cotire(core)
endif()
# Activate compile time reducer for aidge_core if (TESTS)
set_target_properties(core PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) add_subdirectory(tests)
# set_target_properties(n2d2_cpu_lib PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "include/utils/Precompiled.hpp") endif()
cotire(core) \ No newline at end of file
\ No newline at end of file
# This makefile does nothing but delegating the actual building to cmake # This makefile does nothing but delegating the actual building to cmake
BUILDDIR := build BUILDDIR := build
MAKEFLAGS := --no-print-directory MAKEFLAGS := --no-print-directory
\ No newline at end of file
all: core_with_pybind
core_only:
mkdir -p ${BUILDDIR}; \
cd ${BUILDDIR}; \
cmake -DBUILD_CORE_ALONE=ON -DCMAKE_BUILD_TYPE=Release -DPYBIND=OFF -DTESTS=OFF ..; \
${MAKE} ${MAKEFLAGS};
core_tests:
mkdir -p ${BUILDDIR}; \
cd ${BUILDDIR}; \
cmake -DBUILD_CORE_ALONE=ON -DCMAKE_BUILD_TYPE=Debug -DPYBIND=OFF -DTESTS=ON ..; \
${MAKE} ${MAKEFLAGS}; \
cd tests; \
ctest --output-on-failure || true;
core_with_pybind:
mkdir -p ${BUILDDIR}; \
cd ${BUILDDIR}; \
cmake -DBUILD_CORE_ALONE=ON -DCMAKE_BUILD_TYPE=Release -DPYBIND=ON -DTESTS=OFF ..; \
${MAKE} ${MAKEFLAGS};
core_with_pybind_tests:
mkdir -p ${BUILDDIR}; \
cd ${BUILDDIR}; \
cmake -DBUILD_CORE_ALONE=ON -DCMAKE_BUILD_TYPE=Debug -DPYBIND=ON -DTESTS=ON ..; \
${MAKE} ${MAKEFLAGS}; \
cd tests; \
ctest --output-on-failure || true;
clean:
if [ -d "${BUILDDIR}" ]; then rm -rf ${BUILDDIR}; fi
\ No newline at end of file
# Aidge Core library
You can find here the C++ code of the Core library of Aidge.
## Compilation
To only compile the Core library, run
```
make core_only
```
To compile the Core library + the associated unitary tests, run
```
make core_tests
```
To compile the Core library with the python binding, run
```
make core_with_pybind
```
Important: this command can also be run with `make`.
To compile the Core library with the python binding + the associated unitary tests, run
```
make core_with_pybind_tests
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment