Commit 2a865c5d authored by Arnaud Le Meillour's avatar Arnaud Le Meillour
Browse files

update CI/CD files

parent fc559a11
Pipeline #53749 failed with stage
in 22 seconds
set(HOME_PREFIX ESRF)
###############################################################################
# All the classes available for project servers
# List of TANGO device servers to build (from defined classes below)
set(DEVICE_SERVERS
Serial
)
# Shared libraries of TANGO classes needed on this project
set(PROJECT_CLASSES_SHARED
)
# Local libraries of TANGO classes needed on this project
set(PROJECT_CLASSES_LOCAL
Serial
)
# Global dependencies (C++, Tango...)
set(GLOBAL_LIB_EXT tango;COS4;omniORB4;omniDynamic4;omnithread;zmq)
set(GLOBAL_LIB_LOC dl;pthread)
# Default repository
set(DEV_REPOSITORY "/opt/os_dev")
#######################################
# CMake configuration
......@@ -19,9 +28,6 @@ set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_SKIP_RPATH true)
message("")
set(HOME_PREFIX ESRF)
set(HOME_DEV_REPO "/opt/os_dev")
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "${HOME_PREFIX}::In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there." )
endif()
......@@ -31,7 +37,7 @@ endif()
project(Root)
#######################################
# Set build type as Release if no Debug requested
# Set the build type as Release if no Debug mode is requested
message("BUILD CONFIG ##############################")
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_BUILD_TYPE Release)
......@@ -47,54 +53,74 @@ else()
message(STATUS "${HOME_PREFIX}::Build ${CMAKE_BUILD_TYPE} (interactive)")
endif()
######################################
# Set local CMAKE_INSTALL_PREFIX
if(HOME_PREFIX STREQUAL ESRF)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
unset(CMAKE_INSTALL_PREFIX CACHE)
set(CMAKE_INSTALL_PREFIX "${HOME_DEV_REPO}/${CMAKE_BUILD_TYPE}")
message(STATUS "${HOME_PREFIX}::Change default CMAKE_INSTALL_PREFIX (${_CMAKE_INSTALL_PREFIX}) to ${CMAKE_INSTALL_PREFIX}")
else()
set(_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
unset(CMAKE_INSTALL_PREFIX CACHE)
set(CMAKE_INSTALL_PREFIX "${_CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}")
message(STATUS "${HOME_PREFIX}::Change requested CMAKE_INSTALL_PREFIX (${_CMAKE_INSTALL_PREFIX}) to ${CMAKE_INSTALL_PREFIX}")
endif()
set(CMAKE_PREFIX_PATH ${HOME_DEV_REPO}/${CMAKE_BUILD_TYPE})
endif()
#######################################
# load lib
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(./cmake/lib.cmake)
######################################
# Set local CMAKE_INSTALL_PREFIX to our ref repository if specific install DIR done
# Add build type [Release, Debug] subdirectory to the install DIR
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
unset(CMAKE_INSTALL_PREFIX CACHE)
set(CMAKE_INSTALL_PREFIX "${DEV_REPOSITORY}/${CMAKE_BUILD_TYPE}")
message(STATUS "${HOME_PREFIX}::Change default CMAKE_INSTALL_PREFIX (${_CMAKE_INSTALL_PREFIX}) to ${CMAKE_INSTALL_PREFIX}")
else()
set(_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
unset(CMAKE_INSTALL_PREFIX CACHE)
set(CMAKE_INSTALL_PREFIX "${_CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}")
message(STATUS "${HOME_PREFIX}::Change requested CMAKE_INSTALL_PREFIX (${_CMAKE_INSTALL_PREFIX}) to ${CMAKE_INSTALL_PREFIX}")
endif()
set(CMAKE_PREFIX_PATH ${HOME_DEV_REPO}/${CMAKE_BUILD_TYPE})
#######################################
# Debud info
#include(${CMAKE_SOURCE_DIR}/cmake/env.cmake)
#######################################
# Tango resources
message("TANGO LIB RESOURCES ##############################")
include(${CMAKE_SOURCE_DIR}/cmake/add-tango.cmake)
# Load global resources
message("GLOBAL LIB RESOURCES ##############################")
foreach(LIB IN ITEMS ${GLOBAL_LIB_EXT})
#set(CMAKE_FIND_DEBUG_MODE TRUE)
find_package(${LIB} REQUIRED
PATHS
${DEV_REPOSITORY}/${CMAKE_BUILD_TYPE}/lib/cmake
${CMAKE_PREFIX_PATH}/lib/cmake
)
#set(CMAKE_FIND_DEBUG_MODE FALSE)
message(STATUS "${HOME_PREFIX}::Registering the global ${LIB} library ...")
message(STATUS "${HOME_PREFIX}:: - ${LIB}_LIB = ${${LIB}_LIB}")
message(STATUS "${HOME_PREFIX}:: - ${LIB}_LIB_DIR = ${${LIB}_LIB_DIR}")
message(STATUS "${HOME_PREFIX}:: - ${LIB}_INCLUDE_DIR = ${${LIB}_INCLUDE_DIR}")
list(APPEND GLOBAL_LIB ${${LIB}_LIB})
list(APPEND GLOBAL_LIB_DIR ${${LIB}_LIB_DIR})
list(APPEND GLOBAL_INCLUDE_DIR ${${LIB}_INCLUDE_DIR})
endforeach()
list(APPEND GLOBAL_LIB ${GLOBAL_LIB_LOC})
message(STATUS "${HOME_PREFIX}::GLOBAL libraries: ${GLOBAL_LIB}")
#######################################
# Project classes
# Project TANGO classes
message("TANGO CLASSES RESOURCES ##############################")
if(PROJECT_CLASSES_SHARED)
message("## Get shared class env info...")
message("## Management of shared TANGO classes ...")
set(_PROJECT_CLASSES_SHARED ${PROJECT_CLASSES_SHARED})
while(_PROJECT_CLASSES_SHARED)
list(POP_FRONT _PROJECT_CLASSES_SHARED CLASS_NAME CLASS_VERSION)
#set(CMAKE_FIND_DEBUG_MODE TRUE)
find_package(${CLASS_NAME} ${CLASS_VERSION} REQUIRED)
find_package(${CLASS_NAME} ${CLASS_VERSION} REQUIRED
PATHS
${DEV_REPOSITORY}/${CMAKE_BUILD_TYPE}/lib/classes
${CMAKE_INSTALL_PREFIX}/lib/classes
${CMAKE_PREFIX_PATH}/lib/classes
)
#set(CMAKE_FIND_DEBUG_MODE FALSE)
message(STATUS "${HOME_PREFIX}::Load shared class ${CLASS_NAME} in version ${CLASS_VERSION}")
message(STATUS "${HOME_PREFIX}::Registering the shared ${CLASS_NAME} library in version ${CLASS_VERSION}")
message(STATUS "${HOME_PREFIX}:: - ${CLASS_NAME}_LIB = ${${CLASS_NAME}_LIB}")
message(STATUS "${HOME_PREFIX}:: - ${CLASS_NAME}_LIB_DIR = ${${CLASS_NAME}_LIB_DIR}")
message(STATUS "${HOME_PREFIX}:: - ${CLASS_NAME}_INCLUDE_DIR = ${${CLASS_NAME}_INCLUDE_DIR}")
......@@ -102,7 +128,7 @@ if(PROJECT_CLASSES_SHARED)
endif()
if(PROJECT_CLASSES_LOCAL)
message("## Building static local classes ...")
message("## Management of local TANGO classes ...")
unset(CLASS CACHE)
foreach(CLASS IN ITEMS ${PROJECT_CLASSES_LOCAL})
add_subdirectory(./classes/${CLASS})
......@@ -110,13 +136,13 @@ if(PROJECT_CLASSES_LOCAL)
endif()
#######################################
# Build device servers binary
# Project TANGO device servers
message("TANGO DEVICE SERVERS ##############################")
if(DEVICE_SERVERS)
message("## Building binary device servers ...")
unset(DS CACHE)
foreach(DS IN ITEMS ${DEVICE_SERVERS})
add_subdirectory(servers/${DS})
if(PROJECT_DEVICE_SERVERS)
message("## Management of TANGO device servers ...")
unset(DEVICE_SERVER CACHE)
foreach(DEVICE_SERVER IN ITEMS ${PROJECT_DEVICE_SERVERS})
add_subdirectory(servers/${DEVICE_SERVER})
endforeach()
endif()
endif()
\ No newline at end of file
......@@ -10,21 +10,21 @@ project(Serial
set(PROJECT_DEPENDENCIES )
set(BUILD_SHARED YES)
message(STATUS "${HOME_PREFIX}::Prepare build(s) for TANGO class ${PROJECT_NAME} in version ${PROJECT_VERSION}")
message(STATUS "${HOME_PREFIX}::Build preparation for TANGO class ${PROJECT_NAME} in version ${PROJECT_VERSION}")
# If your build need more specific directives, replace include file by it's containt and custom your build.
#######################################
# Add project source files
unset(_SOURCE_FILES)
set(_SOURCE_FILES
unset(SOURCE_FILES)
set(SOURCE_FILES
src/${PROJECT_NAME}.cpp
src/${PROJECT_NAME}Class.cpp
src/${PROJECT_NAME}StateMachine.cpp
)
if(WIN32)
List(APPEND _SOURCE_FILES src/SerialWin32.cpp)
List(APPEND SOURCE_FILES src/SerialWin32.cpp)
elseif(UNIX)
List(APPEND _SOURCE_FILES src/SerialLinux.cpp)
List(APPEND SOURCE_FILES src/SerialLinux.cpp)
endif()
#######################################
......@@ -39,5 +39,5 @@ include(${CMAKE_SOURCE_DIR}/cmake/build-static.cmake)
# Build Shared Lib
if(BUILD_SHARED STREQUAL YES)
include(${CMAKE_SOURCE_DIR}/cmake/build-shared.cmake)
endif(BUILD_SHARED STREQUAL YES)
endif()
unset(_SOURCE_FILES)
AUX_SOURCE_DIRECTORY(./src _SOURCE_FILES)
\ No newline at end of file
unset(SOURCE_FILES)
AUX_SOURCE_DIRECTORY(./src SOURCE_FILES)
\ No newline at end of file
set(EXT_LIB tango;COS4;omniORB4;omniDynamic4;omnithread;zmq)
set(LOC_LIB dl;pthread)
foreach(LIB IN ITEMS ${EXT_LIB})
#set(CMAKE_FIND_DEBUG_MODE TRUE)
find_package(${LIB} REQUIRED
PATHS ${CMAKE_PREFIX_PATH}/lib/cmake
)
#set(CMAKE_FIND_DEBUG_MODE FALSE)
message(STATUS "${HOME_PREFIX}::Load TANGO lib ${LIB}...")
message(STATUS "${HOME_PREFIX}:: - ${LIB}_LIB = ${${LIB}_LIB}")
message(STATUS "${HOME_PREFIX}:: - ${LIB}_LIB_DIR = ${${LIB}_LIB_DIR}")
message(STATUS "${HOME_PREFIX}:: - ${LIB}_INCLUDE_DIR = ${${LIB}_INCLUDE_DIR}")
list(APPEND TANGO_LIB ${${LIB}_LIB})
list(APPEND TANGO_LIB_DIR ${${LIB}_LIB_DIR})
list(APPEND TANGO_INCLUDE_DIR ${${LIB}_INCLUDE_DIR})
endforeach(LIB IN_LIST )
list(APPEND TANGO_LIB ${LOC_LIB})
message(STATUS "${HOME_PREFIX}::TANGO libraries: ${TANGO_LIB}")
#message(STATUS "${HOME_PREFIX}::TANGO libraries dir: \n${TANGO_LIB_DIR}")
#message(STATUS "${HOME_PREFIX}::TANGO libraries include dir: \n${TANGO_INCLUDE_DIR}")
set(BINARY_TARGET ${PROJECT_NAME}_binary)
add_executable(${BINARY_TARGET})
message(STATUS "${HOME_PREFIX}:: - built binary via target ${BINARY_TARGET}")
message(STATUS "${HOME_PREFIX}:: - building binary ${PROJECT_NAME} via target ${BINARY_TARGET}")
include(${CMAKE_SOURCE_DIR}/cmake/conf.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/conf-build.cmake)
target_sources(${BINARY_TARGET}
PRIVATE
${_SOURCE_FILES}
${SOURCE_FILES}
)
target_link_libraries(${BINARY_TARGET}
PRIVATE
${TANGO_LIB}
${GLOBAL_LIB}
${CLASSES_SHARED}
${CLASSES_LOCAL_TARGET}
)
target_link_directories(${BINARY_TARGET}
PRIVATE
${TANGO_LIB_DIR}
${GLOBAL_LIB_DIR}
${CLASSES_SHARED_LIB_DIR}
)
target_include_directories(${BINARY_TARGET}
PRIVATE
${TANGO_INCLUDE_DIR}
${GLOBAL_INCLUDE_DIR}
${CLASSES_SHARED_INCLUDE_DIR}
${CLASSES_LOCAL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
......@@ -32,24 +32,9 @@ target_include_directories(${BINARY_TARGET}
${CMAKE_CURRENT_SOURCE_DIR}/include
)
unset(_COMPILE_OPTIONS)
if(BATCH STREQUAL YES)
set(_COMPILE_OPTIONS
-W # Inhibit all warning messages.
)
else()
set(_COMPILE_OPTIONS
#-Werror # Make all warnings into errors.
-Wall # This enables all the warnings.
-Wextra # This enables some extra warning flags.
-Wpedantic # Issue all the warnings demanded by strict ISO C and ISO C++
-Wnon-virtual-dtor # warns whenever a class with virtual function does not declare a virtual destructor.
-Wshadow # Warn whenever a local variable or type declaration shadows another variable
)
endif()
target_compile_options(${BINARY_TARGET}
PRIVATE
${_COMPILE_OPTIONS}
${COMPILE_OPTIONS}
)
target_compile_features(${BINARY_TARGET}
......
set(SHARED_TARGET ${PROJECT_NAME}_shared)
add_library(${SHARED_TARGET} SHARED)
message(STATUS "${HOME_PREFIX}:: - built shared via target ${SHARED_TARGET}")
message(STATUS "${HOME_PREFIX}:: - building shared library ${PROJECT_NAME} via target ${SHARED_TARGET}")
include(${CMAKE_SOURCE_DIR}/cmake/conf.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/conf-build.cmake)
unset(PUBLIC_HEADER)
GET_HEADER_FILES(_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include)
......@@ -12,26 +12,26 @@ endforeach()
target_sources(${SHARED_TARGET}
PRIVATE
${_SOURCE_FILES}
${SOURCE_FILES}
)
target_link_libraries(${SHARED_TARGET}
PRIVATE
${TANGO_LIB}
${CLASSES_LOCAL_TARGET}
${GLOBAL_LIB}
PUBLIC
${CLASSES_SHARED}
${CLASSES_SHARED}
${CLASSES_LOCAL_TARGET}
)
target_link_directories(${SHARED_TARGET}
PRIVATE
${TANGO_LIB_DIR}
${GLOBAL_LIB_DIR}
${CLASSES_SHARED_LIB_DIR}
)
target_include_directories(${SHARED_TARGET}
PRIVATE
${TANGO_INCLUDE_DIR}
${GLOBAL_INCLUDE_DIR}
${CLASSES_SHARED_INCLUDE_DIR}
${CLASSES_LOCAL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
......@@ -40,24 +40,9 @@ target_include_directories(${SHARED_TARGET}
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>${INSTALL_INCLUDEDIR}>
)
unset(_COMPILE_OPTIONS)
if(BATCH STREQUAL YES)
set(_COMPILE_OPTIONS
-W # Inhibit all warning messages.
)
else()
set(_COMPILE_OPTIONS
#-Werror # Make all warnings into errors.
-Wall # This enables all the warnings.
-Wextra # This enables some extra warning flags.
-Wpedantic # Issue all the warnings demanded by strict ISO C and ISO C++
-Wnon-virtual-dtor # warns whenever a class with virtual function does not declare a virtual destructor.
-Wshadow # Warn whenever a local variable or type declaration shadows another variable
)
endif()
target_compile_options(${SHARED_TARGET}
PRIVATE
${_COMPILE_OPTIONS}
${COMPILE_OPTIONS}
)
target_compile_features(${SHARED_TARGET}
......@@ -93,7 +78,6 @@ write_basic_package_version_file(
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
unset(SOURCES)
GET_HEADER_FILES(_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src)
foreach(_HEADER IN ITEMS ${_HEADERS})
......@@ -112,7 +96,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
PERMISSIONS
${DEFAULT_PERMISSIONS_LIB}
)
endif()
install(
......@@ -124,6 +107,7 @@ install(
PERMISSIONS
${DEFAULT_PERMISSIONS_LIB}
)
install(EXPORT ${SHARED_TARGET}_export
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
......
......@@ -2,29 +2,29 @@ set(STATIC_TARGET ${PROJECT_NAME}_static)
add_library(${STATIC_TARGET} STATIC)
message(STATUS "${HOME_PREFIX}:: - built static via target ${STATIC_TARGET}")
include(${CMAKE_SOURCE_DIR}/cmake/conf.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/conf-build.cmake)
target_sources(${STATIC_TARGET}
PRIVATE
${_SOURCE_FILES}
${SOURCE_FILES}
)
target_link_libraries(${STATIC_TARGET}
PRIVATE
${TANGO_LIB}
${GLOBAL_LIB}
${CLASSES_SHARED}
${CLASSES_LOCAL_TARGET}
)
target_link_directories(${STATIC_TARGET}
PRIVATE
${TANGO_LIB_DIR}
${GLOBAL_LIB_DIR}
${CLASSES_SHARED_LIB_DIR}
)
target_include_directories(${STATIC_TARGET}
PRIVATE
${TANGO_INCLUDE_DIR}
${GLOBAL_INCLUDE_DIR}
${CLASSES_SHARED_INCLUDE_DIR}
${CLASSES_LOCAL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
......@@ -32,24 +32,9 @@ target_include_directories(${STATIC_TARGET}
${CMAKE_CURRENT_SOURCE_DIR}/include
)
unset(_COMPILE_OPTIONS)
if(BATCH STREQUAL YES)
set(_COMPILE_OPTIONS
-W # Inhibit all warning messages.
)
else()
set(_COMPILE_OPTIONS
#-Werror # Make all warnings into errors.
-Wall # This enables all the warnings.
-Wextra # This enables some extra warning flags.
-Wpedantic # Issue all the warnings demanded by strict ISO C and ISO C++
-Wnon-virtual-dtor # warns whenever a class with virtual function does not declare a virtual destructor.
-Wshadow # Warn whenever a local variable or type declaration shadows another variable
)
endif()
target_compile_options(${STATIC_TARGET}
PRIVATE
${_COMPILE_OPTIONS}
${COMPILE_OPTIONS}
)
target_compile_features(${STATIC_TARGET}
......@@ -62,8 +47,11 @@ set_target_properties(${STATIC_TARGET}
OUTPUT_NAME ${PROJECT_NAME}-${PROJECT_VERSION}
)
install(TARGETS ${STATIC_TARGET} EXPORT ${STATIC_TARGET}_export
ARCHIVE DESTINATION "${INSTALL_LIBDIR}"
PERMISSIONS ${DEFAULT_PERMISSIONS_LIB}
)
if(BUILD_SHARED STREQUAL YES)
install(TARGETS ${STATIC_TARGET} EXPORT ${STATIC_TARGET}_export
ARCHIVE DESTINATION "${INSTALL_LIBDIR}"
PERMISSIONS ${DEFAULT_PERMISSIONS_LIB}
)
endif()
#######################################
# Compilation warning if interactive
unset(COMPILE_OPTIONS)
if(BATCH STREQUAL YES)
set(COMPILE_OPTIONS
-W # Inhibit all warning messages.
)
else()
set(COMPILE_OPTIONS
#-Werror # Make all warnings into errors.
-Wall # This enables all the warnings.
-Wextra # This enables some extra warning flags.
-Wpedantic # Issue all the warnings demanded by strict ISO C and ISO C++
-Wnon-virtual-dtor # warns whenever a class with virtual function does not declare a virtual destructor.
-Wshadow # Warn whenever a local variable or type declaration shadows another variable
)
endif()
#######################################
# Set installation DESTINATION
set(FULL_MINOR_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
......
......@@ -11,7 +11,7 @@ set(PROJECT_DEPENDENCIES
Serial
)
message(STATUS "${HOME_PREFIX}::Prepare build(s) for TANGO device server ${PROJECT_NAME} in version ${PROJECT_VERSION}")
message(STATUS "${HOME_PREFIX}::Build preparation for TANGO device server ${PROJECT_NAME} in version ${PROJECT_VERSION}")
# If your build need more specific directives, replace include file by it's containt and custom your build.
#######################################
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment