Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ jobs:
sudo apt update
sudo apt -y install zlib1g-dev libcurl4-openssl-dev libproj-dev libssl-dev libturbojpeg0-dev \
libjpeg-dev libc6-dev libboost-log-dev libboost-filesystem-dev libboost-system-dev \
libsqlite3-dev libpng-dev libtiff5-dev libopenjp2-7-dev librados-dev \
libsqlite3-dev libpng-dev libtiff5-dev libopenjp2-7-dev librados-dev libjemalloc-dev \
gettext build-essential cmake libcppunit-dev doxygen graphviz

- name: Build packages
run: |
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_VERSION=${{ github.ref_name }} -DCPACK_SYSTEM_NAME="ubuntu-24.04" ..
cmake -DCMAKE_INSTALL_PREFIX=/usr -DALLOCATOR=jemalloc -DBUILD_VERSION=${{ github.ref_name }} -DCPACK_SYSTEM_NAME="ubuntu-24.04" ..
make -j2
make package
cmake -DCEPH_ENABLED=1 ..
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Le format est basé sur [Keep a Changelog](https://keepachangelog.com/) et ce pr

## [Unreleased]

## [5.0.2] - 2026-11-10

### Added

- Possibilité de compiler en changeant l'allocateur mémoire (`tcmalloc` et `jemalloc` disponibles)

## [5.0.1] - 2026-10-16

### Fixed
Expand Down Expand Up @@ -268,6 +274,7 @@ Les librairies sont gérées de manière indépendantes, conditionnées pour êt
[1.0.3]: https://github.com/rok4/core-cpp/releases/tag/1.0.3

[Unreleased]: https://github.com/rok4/core-cpp/compare/5.0.0...HEAD
[5.0.2]: https://github.com/rok4/core-cpp/compare/5.0.0...5.0.0
[5.0.0]: https://github.com/rok4/core-cpp/compare/4.1.0...5.0.0
[4.1.0]: https://github.com/rok4/core-cpp/compare/4.0.0...4.1.0
[4.0.0]: https://github.com/rok4/core-cpp/compare/3.1.0...4.0.0
Expand Down
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation location")
set(BUILD_VERSION "0.0.0" CACHE STRING "Build version")
set(CEPH_ENABLED 0 CACHE BOOL "Build with ceph storage")
set(ALLOCATOR "" CACHE STRING "Build with allocator")
set(KDU_ENABLED 0 CACHE BOOL "Build with kakadu")
set(UNITTEST_ENABLED 1 CACHE BOOL "Unit tests compilation")
set(DOC_ENABLED 1 CACHE BOOL "Documentation compilation")
Expand All @@ -32,6 +33,7 @@ configure_file(config.h.in config.h ESCAPE_QUOTES @ONLY)

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
Expand Down Expand Up @@ -85,6 +87,13 @@ if(CEPH_ENABLED)
include_directories(${RADOS_INCLUDE_DIR})
endif(CEPH_ENABLED)


IF(ALLOCATOR STREQUAL "jemalloc")
include_directories(${JEMALLOC_INCLUDE_DIR})
ELSEIF(ALLOCATOR STREQUAL "tcmalloc")
include_directories(${TCMALLOC_INCLUDE_DIR})
ENDIF()

add_library(${PROJECT_NAME} SHARED ${LIBROK4_SRCS})

target_include_directories(${PROJECT_NAME} PRIVATE
Expand All @@ -108,6 +117,12 @@ if(CEPH_ENABLED)
target_link_libraries(${PROJECT_NAME} PUBLIC rados)
endif(CEPH_ENABLED)

IF(ALLOCATOR STREQUAL "jemalloc")
target_link_libraries(${PROJECT_NAME} PUBLIC jemalloc)
ELSEIF(ALLOCATOR STREQUAL "tcmalloc")
target_link_libraries(${PROJECT_NAME} PUBLIC tcmalloc)
ENDIF()

################### TESTS UNITAIRES

if(UNITTEST_ENABLED)
Expand Down Expand Up @@ -197,6 +212,11 @@ if(CPACK_SYSTEM_NAME AND CPACK_SYSTEM_NAME STREQUAL "ubuntu-20.04" OR CPACK_SYST
if(CEPH_ENABLED)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, librados-dev")
endif(CEPH_ENABLED)
IF(ALLOCATOR STREQUAL "jemalloc")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjemalloc-dev")
ELSEIF(ALLOCATOR STREQUAL "tcmalloc")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libtcmalloc-minimal4t64")
ENDIF()
set(CPACK_BINARY_DEB "ON")
endif()

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Rok4" DEFAULT_MSG ROK4_INCLUDE_DIR ROK4_LIBR
### Variables CMake

* `CEPH_ENABLED` : active la compilation la classe de gestion du stockage Ceph. Valeur par défaut : `0`, `1` pour activer.
* `ALLOCATOR` : modifie l'implémentation des fonctions d'allocation. Valeurs possibles : `jemalloc`, `tcmalloc`. Valeur par défaut : ``
* `UNITTEST_ENABLED` : active la compilation des tests unitaires. Valeur par défaut : `1`, `0` pour désactiver.
* `DOC_ENABLED` : active la compilation de la documentation. Valeur par défaut : `1`, `0` pour désactiver.
* `BUILD_VERSION` : version de la librairie compilée. Valeur par défaut : `0.0.0`. Utile pour la compilation de la documentation.
Expand Down
26 changes: 26 additions & 0 deletions cmake/modules/FindJemalloc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

# CMake module to search for Jemalloc library
#
# If it's found it sets JEMALLOC_FOUND to TRUE
# and following variables are set:
# JEMALLOC_INCLUDE_DIR
# JEMALLOC_LIBRARY

FIND_PATH(JEMALLOC_INCLUDE_DIR jemalloc.h
/usr/local/include
/usr/include
/usr/include/jemalloc
c:/msys/local/include
)

FIND_LIBRARY(JEMALLOC_LIBRARY NAMES libjemalloc.so PATHS
/usr/local/lib
/usr/lib
/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
c:/msys/local/lib
)

INCLUDE( "FindPackageHandleStandardArgs" )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Jemalloc" DEFAULT_MSG JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY )
18 changes: 18 additions & 0 deletions cmake/modules/FindTcmalloc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# CMake module to search for Tcmalloc library
#
# If it's found it sets TCMALLOC_FOUND to TRUE
# and following variables are set:
# TCMALLOC_LIBRARY

FIND_LIBRARY(TCMALLOC_LIBRARY NAMES libtcmalloc.so PATHS
/usr/local/lib
/usr/lib
/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
c:/msys/local/lib
)

INCLUDE( "FindPackageHandleStandardArgs" )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Tcmalloc" DEFAULT_MSG TCMALLOC_LIBRARY )
16 changes: 16 additions & 0 deletions cmake/modules/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,22 @@ IF(CEPH_ENABLED)
endif(NOT TARGET rados)
ENDIF(CEPH_ENABLED)

IF(ALLOCATOR STREQUAL "jemalloc")
if(NOT TARGET jemalloc)
find_package(Jemalloc)
if(NOT JEMALLOC_FOUND)
message(FATAL_ERROR "Cannot find extern library jemalloc")
endif()
endif(NOT TARGET jemalloc)
ELSEIF(ALLOCATOR STREQUAL "tcmalloc")
if(NOT TARGET tcmalloc)
find_package(Tcmalloc)
if(NOT TCMALLOC_FOUND)
message(FATAL_ERROR "Cannot find extern library tcmalloc")
endif()
endif(NOT TARGET tcmalloc)
ENDIF()

# Statique

if(UNITTEST_ENABLED)
Expand Down
Loading