Commit 52aff4ea authored by Arnaud Le Meillour's avatar Arnaud Le Meillour
Browse files

Fix Cmake function

parent 8af8f8c2
Pipeline #76085 waiting for manual action with stage
......@@ -7,8 +7,10 @@ include(init-project)
###############################################################################
# Local Tango Classes build in this project
addTangoClasses(Serial)
# Local Tango Servers build in this project
addTangoServers(Serial)
\ No newline at end of file
# Configure local tango Targets (Classes & Servers)
addTangoTarget(
DEVICE_CLASSES
Serial
DEVICE_SERVERS
Serial
)
\ No newline at end of file
message("# LOAD USER CONFIGURATION - user-config.cmake")
set(USER_PREFIX "ESRF")
set(USER_REPOSITORY "/opt/os_dev")
OPTION(BUILD_SHARED_LIBS "Make Tango classes as Shared libraries" YES)
# Set the build type as Release (with debug info) if no Debug mode is requested
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILD_TYPE_DIR "debug")
else()
set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(BUILD_TYPE_DIR "release")
endif()
# Set specific search directories for find_package() cmd
set(USER_REPO_TANGO_DIRS
${USER_REPOSITORY}/${BUILD_TYPE_DIR}/lib/cmake
${CMAKE_INSTALL_PREFIX}/lib/cmake
)
message(STATUS "${USER_PREFIX}::Add Tango lib search dir: ${USER_TANGO_DIRS}")
set(USER_REPO_LIB_DIRS
${USER_REPOSITORY}/${BUILD_TYPE_DIR}/lib/classes
${CMAKE_INSTALL_PREFIX}/lib/classes
)
message(STATUS "${USER_PREFIX}::Add Tango classes lib search dir: ${USER_LIB_DIRS}")
# Check if execute from GitLab
if(DEFINED ENV{CI_COMMIT_SHA})
set(IN_GITLAB YES)
message(STATUS "${USER_PREFIX}::Build type: ${CMAKE_BUILD_TYPE} (GitLab)")
else()
set(IN_GITLAB NO)
message(STATUS "${USER_PREFIX}::Build type: ${CMAKE_BUILD_TYPE} (interactive)")
endif()
# Set intallation directory path
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/classes)
# Set installation files PERMISSIONS
set(DEFAULT_PERMISSIONS_CONF
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ
)
set(DEFAULT_PERMISSIONS_LIB
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ
)
set(DEFAULT_PERMISSIONS_BIN
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
......@@ -122,50 +122,6 @@ macro(addDependencies)
endmacro()
############################################
#
#
#
macro(addTangoClasses TARGETS_LIST)
foreach(_TARGET IN ITEMS ${TARGETS_LIST})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/classes/${_TARGET}/CMakeLists.txt)
msg("\n-------------------------------------------------------------")
msg("CONFIGURE TANGO CLASS TARGET : ${_TARGET}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/classes/${_TARGET})
else()
include(debug)
msg(FATAL_ERROR "Fail to add target ${_TARGET}")
endif()
endforeach()
endmacro()
############################################
#
#
#
macro(addTangoServers TARGETS_LIST)
foreach(_TARGET IN ITEMS ${TARGETS_LIST})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/servers/${_TARGET}/CMakeLists.txt)
msg("\n-------------------------------------------------------------")
msg("CONFIGURE TANGO SERVER TARGET : ${_TARGET}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/servers/${_TARGET})
else()
include(debug)
msg(FATAL_ERROR "Fail to add target ${_TARGET}")
endif()
endforeach()
endmacro()
#########################################################################################################
#########################################################################################################
......@@ -641,3 +597,42 @@ endfunction()
############################################
#
#
#
function(addTangoTarget)
# Parse the parameters
set(ARGS_OPTIONS )
set(ARGS_ONE_VALUE )
set(ARGS_MULTI_VALUE DEVICE_CLASSES DEVICE_SERVERS)
cmake_parse_arguments(_TARGET "${ARGS_OPTIONS}" "${ARGS_ONE_VALUE}" "${ARGS_MULTI_VALUE}" ${ARGN})
foreach(_TARGET IN ITEMS ${_TARGET_DEVICE_CLASSES})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/classes/${_TARGET}/CMakeLists.txt)
msg("\n-------------------------------------------------------------")
msg("CONFIGURE TANGO CLASS TARGET : ${_TARGET}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/classes/${_TARGET})
else()
include(debug)
msg(FATAL_ERROR "Fail to add target ${_TARGET}")
endif()
endforeach()
foreach(_TARGET IN ITEMS ${_TARGET_DEVICE_SERVERS})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/servers/${_TARGET}/CMakeLists.txt)
msg("\n-------------------------------------------------------------")
msg("CONFIGURE TANGO SERVER TARGET : ${_TARGET}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/servers/${_TARGET})
else()
include(debug)
msg(FATAL_ERROR "Fail to add target ${_TARGET}")
endif()
endforeach()
endfunction()
\ No newline at end of file
......@@ -2,15 +2,6 @@
include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
<<<<<<< HEAD
set(@PROJECT_NAME@_SYSCONFIG_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@-@PROJECT_VERSION@/cmake" )
set(@PROJECT_NAME@_LIB "@PROJECT_NAME@" )
set(@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@-@PROJECT_VERSION@/lib" )
set(@PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@-@PROJECT_VERSION@/include" )
#set_and_check(@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@-@PROJECT_VERSION@/lib" )
#set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@-@PROJECT_VERSION@/include" )
=======
set(@PROJECT_NAME@_LIB "@PROJECT_NAME@")
set(@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@")
set(@PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")
......@@ -20,4 +11,3 @@ set(@PROJECT_NAME@_CMAKE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_CMAKEDIR@
check_required_components(@PROJECT_NAME@)
set_and_check(@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@")
set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")
>>>>>>> develop
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