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
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ environment, you can alter the path to the installation directory:
```bash
export INSTALL_BASEDIR="${HOME}/dev/deliveries"
export RMOL_VER="1.00.12"
if [ -d /usr/lib64 ]; then LIBSUFFIX="64"; fi
export LIBSUFFIX_4_CMAKE="-DLIB_SUFFIX=$LIBSUFFIX"
```

Then, as usual:
Expand All @@ -92,8 +90,7 @@ Then, as usual:
-DWITH_STDAIR_PREFIX=${INSTALL_BASEDIR}/stdair-stable \
-DWITH_AIRRAC_PREFIX=${INSTALL_BASEDIR}/airrac-stable \
-DCMAKE_BUILD_TYPE:STRING=Debug -DENABLE_TEST:BOOL=ON -DINSTALL_DOC:BOOL=ON \
-DRUN_GCOV:BOOL=OFF ${LIBSUFFIX_4_CMAKE} ..
${LIBSUFFIX_4_CMAKE} ..
-DRUN_GCOV:BOOL=OFF ..
```
* To build the project, type:
```bash
Expand Down
9 changes: 1 addition & 8 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,11 @@ cat >> configure << _EOF
fi
done

#
LIB_OPTION=""
if [ -d /usr/lib64 ]
then
LIB_OPTION="-DLIB_SUFFIX=64"
fi

#
BUILD_OPTION="-DCMAKE_BUILD_TYPE:STRING=Debug"

#
CMAKE_CMD="cmake \${PREFIX_OPTION} \${STDAIR_OPTION} \${AIRRAC_OPTION} \${LIB_OPTION} \${BUILD_OPTION} \${DOC_OPTION} \${SOURCE_DIR}"
CMAKE_CMD="cmake \${PREFIX_OPTION} \${STDAIR_OPTION} \${AIRRAC_OPTION} \${BUILD_OPTION} \${DOC_OPTION} \${SOURCE_DIR}"

# Trace on
set -x
Expand Down
6 changes: 3 additions & 3 deletions config/devhelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

# Configure helper (e.g., to easily retrieve the version and compilation flags)
set (CFG_SCRIPT ${PROJECT_NAME}-config)
set (CFG_SCRIPT_PATH bin)
set (CFG_SCRIPT_PATH ${INSTALL_BIN_DIR})

# (Debian) Packaging helper
set (PKGCFG_SCRIPT ${PROJECT_NAME}.pc)
set (PKGCFG_SCRIPT_PATH ${LIBDIR}/pkgconfig)
set (PKGCFG_SCRIPT_PATH ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

# GNU Autotools helper (M4 macro file)
set (M4_MACROFILE ${PROJECT_NAME}.m4)
set (M4_MACROFILE_PATH share/aclocal)
set (M4_MACROFILE_PATH ${CMAKE_INSTALL_DATADIR}/aclocal)

# Convert the developer script utilities (basically, just replace
# the @<variable>@ variables)
Expand Down
103 changes: 63 additions & 40 deletions config/project_config_embeddable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
## Date: July 2011
#######################################################################


###################################################################
## Project Configuration ##
###################################################################
Expand Down Expand Up @@ -93,6 +92,8 @@ macro (set_project_options _build_doc _enable_tests _run_gcov)
set (CMAKE_INSTALL_PREFIX "/usr")
endif()

include(GNUInstallDirs)

# Unit tests (thanks to CMake/CTest)
option (ENABLE_TEST "Set to OFF to skip build/check unit tests"
${_enable_tests})
Expand All @@ -110,34 +111,22 @@ macro (set_project_options _build_doc _enable_tests _run_gcov)
set (MAN_ALL_TARGETS)
set (NEED_PYTHON OFF)

# Set the library installation directory (either 32 or 64 bits)
set (LIBDIR "lib${LIB_SUFFIX}" CACHE PATH
"Library directory name, either lib or lib64")

# Offer the user the choice of overriding the installation directories
set (INSTALL_LIB_DIR ${LIBDIR} CACHE PATH
set (INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH
"Installation directory for libraries")
set (INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set (INSTALL_LIBEXEC_DIR CACHE PATH
set (INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Installation directory for executables")
set (INSTALL_LIBEXEC_DIR ${CMAKE_INSTALL_LIBEXECDIR} CACHE PATH
"Installation directory for internal executables")
set (INSTALL_INCLUDE_DIR include CACHE PATH
set (INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH
"Installation directory for header files")
set (INSTALL_DATA_DIR share CACHE PATH "Installation directory for data files")
set (INSTALL_SAMPLE_DIR share/${PROJECT_NAME}/samples CACHE PATH
set (INSTALL_DATA_DIR ${CMAKE_INSTALL_DATADIR} CACHE PATH "Installation directory for data files")
set (INSTALL_SAMPLE_DIR ${INSTALL_DATA_DIR}/${PROJECT_NAME}/samples CACHE PATH
"Installation directory for (CSV) sample files")
set (INSTALL_ETC_DIR etc CACHE PATH "Installation directory for Config files")
set (INSTALL_ETC_DIR ${CMAKE_INSTALL_SYSCONFDIR} CACHE PATH "Installation directory for Config files")

# GCOV
option (RUN_GCOV "Set to OFF to skip code coverage" ${_run_gcov})

# Make relative paths absolute (needed later on)
foreach (_path_type LIB PY_LIB BIN LIBEXEC INCLUDE DATA SAMPLE)
set (var INSTALL_${_path_type}_DIR)
if (NOT IS_ABSOLUTE "${${var}}")
set (${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif ()
endforeach (_path_type)

# When the install directory is not the canonical one (i.e., /usr),
# the run-path/rpath must be set in all the (executable and library)
# binaries, so that the dynamic loader can find the dependencies
Expand Down Expand Up @@ -891,7 +880,7 @@ macro (get_xapian)

# The first check is to get Xapian installation details
if (${CMAKE_VERSION} VERSION_LESS 2.8.0)
set (Xapian_DIR /usr/${LIBDIR}/cmake/xapian)
set (Xapian_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/xapian)
endif (${CMAKE_VERSION} VERSION_LESS 2.8.0)
find_package (Xapian)

Expand Down Expand Up @@ -1581,18 +1570,40 @@ endmacro (init_build)
macro (set_install_directories)
set (prefix ${CMAKE_INSTALL_PREFIX})
set (exec_prefix ${prefix})
set (bindir ${exec_prefix}/bin)
set (libdir ${exec_prefix}/${LIBDIR})
set (pylibdir ${libdir}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/py${PACKAGE})
set (libexecdir ${exec_prefix}/libexec)
set (sbindir ${exec_prefix}/sbin)
set (sysconfdir ${prefix}/etc)
set (includedir ${prefix}/include)
set (datarootdir ${prefix}/share)
set (datadir ${datarootdir})
set (pkgdatadir ${datarootdir}/${PACKAGE})
set (sampledir ${STDAIR_SAMPLE_DIR})
set (docdir ${datarootdir}/doc/${PACKAGE}-${PACKAGE_VERSION})
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir BINDIR)
endif()
GNUInstallDirs_get_absolute_install_dir(bindir INSTALL_BIN_DIR BINDIR)
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir LIBDIR)
endif()
GNUInstallDirs_get_absolute_install_dir(libdir INSTALL_LIB_DIR LIBDIR)
set(pylibdir ${INSTALL_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/py${PACKAGE})
GNUInstallDirs_get_absolute_install_dir(pylibdir pylibdir LIBDIR)
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir LIBEXECDIR)
endif()
GNUInstallDirs_get_absolute_install_dir(libexecdir INSTALL_LIBEXEC_DIR LIBEXECDIR)
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir SBINDIR)
endif()
GNUInstallDirs_get_absolute_install_dir(sbindir CMAKE_INSTALL_SBINDIR SBINDIR)
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir SYSCONFDIR)
endif()
GNUInstallDirs_get_absolute_install_dir(sysconfdir INSTALL_ETC_DIR SYSCONFDIR)
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir INCLUDEDIR)
endif()
GNUInstallDirs_get_absolute_install_dir(includedir INSTALL_INCLUDE_DIR INCLUDEDIR)
if(CMAKE_VERSION VERSION_LESS 3.20)
set(dir DATADIR)
endif()
GNUInstallDirs_get_absolute_install_dir(datadir INSTALL_DATA_DIR DATADIR)
set (datarootdir ${datadir})
set (pkgdatadir ${datadir}/${PACKAGE})
GNUInstallDirs_get_absolute_install_dir(sampledir STDAIR_SAMPLE_DIR DATADIR)
set (docdir ${datadir}/doc/${PACKAGE}-${PACKAGE_VERSION})
set (htmldir ${docdir}/html)
set (pdfdir ${htmldir})
set (mandir ${datarootdir}/man)
Expand Down Expand Up @@ -1630,7 +1641,7 @@ macro (add_modules)
set (_embedded_components ${ARGV})
set (LIB_DEPENDENCY_EXPORT ${PROJECT_NAME}-library-depends)
set (PY_LIB_DEPENDENCY_EXPORT ${PROJECT_NAME}-python-library-depends)
set (LIB_DEPENDENCY_EXPORT_PATH "${INSTALL_DATA_DIR}/${PROJECT_NAME}/CMake")
set (LIB_DEPENDENCY_EXPORT_PATH "${INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}")
#
foreach (_embedded_comp ${_embedded_components})
#
Expand Down Expand Up @@ -2160,11 +2171,11 @@ endmacro (module_script_add)
# can refer to it (for libraries, header files and binaries)
macro (module_export_install)
install (EXPORT ${LIB_DEPENDENCY_EXPORT}
DESTINATION "${INSTALL_DATA_DIR}/${PACKAGE}/CMake" COMPONENT devel)
DESTINATION "${INSTALL_LIB_DIR}/cmake/${PACKAGE}" COMPONENT devel)

if (NEED_PYTHON)
install (EXPORT ${PY_LIB_DEPENDENCY_EXPORT}
DESTINATION "${INSTALL_DATA_DIR}/${PACKAGE}/CMake" COMPONENT python-devel)
DESTINATION "${INSTALL_LIB_DIR}/cmake/${PACKAGE}" COMPONENT python-devel)
endif (NEED_PYTHON)
endmacro (module_export_install)

Expand Down Expand Up @@ -2636,25 +2647,37 @@ macro (install_dev_helper_files)
# Create a ${PROJECT_NAME}-config.cmake file for the use from
# the install tree and install it
module_export_install()
include(CMakePackageConfigHelpers)
set (${PACKAGE_NAME}_INCLUDE_DIRS "${INSTALL_INCLUDE_DIR}")
set (${PACKAGE_NAME}_BIN_DIR "${INSTALL_BIN_DIR}")
set (${PACKAGE_NAME}_LIB_DIR "${INSTALL_LIB_DIR}")
set (${PACKAGE_NAME}_LIBEXEC_DIR "${INSTALL_LIBEXEC_DIR}")
set (${PACKAGE_NAME}_PY_LIB_DIR "${INSTALL_PY_LIB_DIR}")
set (${PACKAGE_NAME}_CMAKE_DIR "${LIB_DEPENDENCY_EXPORT_PATH}")
configure_package_config_file(
${PROJECT_NAME}-config.cmake.in
${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${${PACKAGE_NAME}_CMAKE_DIR}
PATH_VARS
${PACKAGE_NAME}_INCLUDE_DIRS
${PACKAGE_NAME}_BIN_DIR
${PACKAGE_NAME}_LIB_DIR
${PACKAGE_NAME}_LIBEXEC_DIR
)
write_basic_package_version_file(
${PROJECT_NAME}-config-version.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
)
# When the project is OpenTREP, OPENTREP_SAMPLE_DIR has
# already been defined before
if (NOT "${PROJECT_NAME}" STREQUAL "opentrep")
set (${PACKAGE_NAME}_SAMPLE_DIR "${INSTALL_SAMPLE_DIR}")
endif (NOT "${PROJECT_NAME}" STREQUAL "opentrep")
configure_file (${PROJECT_NAME}-config.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" @ONLY)
if (NEED_PYTHON)
configure_file (${PROJECT_NAME}-config-python.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-python.cmake" @ONLY)
endif (NEED_PYTHON)
configure_file (${PROJECT_NAME}-config-version.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" @ONLY)
install (FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
Expand Down
13 changes: 0 additions & 13 deletions rmol-config-version.cmake.in

This file was deleted.

10 changes: 6 additions & 4 deletions rmol-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@PACKAGE_INIT@

#
# Config file for the RMOL package. It defines the following variables:
# RMOL_VERSION - version of RMOL
Expand All @@ -11,10 +13,10 @@

# Tell the user project where to find RMOL headers and libraries
set (RMOL_VERSION "@PACKAGE_VERSION@")
set (RMOL_BINARY_DIRS "@RMOL_BIN_DIR@")
set (RMOL_INCLUDE_DIRS "@RMOL_INCLUDE_DIRS@")
set (RMOL_LIBRARY_DIRS "@RMOL_LIB_DIR@")
set (RMOL_LIBEXEC_DIR "@RMOL_LIBEXEC_DIR@")
set (RMOL_BINARY_DIRS "@PACKAGE_RMOL_BIN_DIR@")
set (RMOL_INCLUDE_DIRS "@PACKAGE_RMOL_INCLUDE_DIRS@")
set (RMOL_LIBRARY_DIRS "@PACKAGE_RMOL_LIB_DIR@")
set (RMOL_LIBEXEC_DIR "@PACKAGE_RMOL_LIBEXEC_DIR@")

# Library dependencies for RMOL (contains definitions for the RMOL IMPORTED
# targets)
Expand Down
6 changes: 5 additions & 1 deletion rmol-config.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/usr/bin/sh

# NOTE: This is not properly constructed to be relocatable
# e.g. `sysconfdir` does not relocate outside of ${prefix} according to the
# GNUInstallDirs rules.

prefix=@prefix@
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib@LIB_SUFFIX@
libdir=${exec_prefix}/@INSTALL_LIB_DIR@
libexecdir=${exec_prefix}/libexec
sbindir=${exec_prefix}/sbin
sysconfdir=${prefix}/etc
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
cmake_args = [
'-DINSTALL_DOC:BOOL=OFF',
'-DRUN_GCOV:BOOL=OFF',
'-DLIB_SUFFIX=',
f'-DWITH_STDAIR_PREFIX={install_dir}/stdair',
f'-DWITH_AIRRAC_PREFIX={install_dir}/airrac'
] + (
Expand Down