GenHQRPkgConfig.cmake 3.81 KB
Newer Older
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
#                          of Tennessee Research Foundation.
#                          All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
#  @file GenPkgConfig.cmake
#
#  @project MORSE
#  MORSE is a software package provided by:
#     Inria Bordeaux - Sud-Ouest,
#     Univ. of Tennessee,
#     King Abdullah Univesity of Science and Technology
#     Univ. of California Berkeley,
#     Univ. of Colorado Denver.
#
#  @version 0.9.1
#  @author Cedric Castagnede
#  @author Emmanuel Agullo
#  @author Mathieu Faverge
#  @author Florent Pruvost
#  @date 10-11-2014
#
###

###
#
# CONVERT_LIBSTYLE_TO_PKGCONFIG: convert a libraries list to follow the pkg-config style
#                                used in CLEAN_LIB_LIST
#
###
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
# macro(CONVERT_LIBSTYLE_TO_PKGCONFIG _liblist)
#     set(${_liblist}_CPY "${${_liblist}}")
#     set(${_liblist} "")
#     foreach(_dep ${${_liblist}_CPY})
#         if (${_dep} MATCHES "^/")
#             get_filename_component(dep_libname ${_dep} NAME)
#             get_filename_component(dep_libdir  ${_dep} DIRECTORY)
#             string(REPLACE "lib"    "" dep_libname "${dep_libname}")
#             string(REPLACE ".so"    "" dep_libname "${dep_libname}")
#             string(REPLACE ".a"     "" dep_libname "${dep_libname}")
#             string(REPLACE ".dylib" "" dep_libname "${dep_libname}")
#             string(REPLACE ".dll"   "" dep_libname "${dep_libname}")
#             list(APPEND ${_liblist} -L${dep_libdir} -l${dep_libname})
#         elseif(NOT ${_dep} MATCHES "^-")
#             list(APPEND ${_liblist} "-l${_dep}")
#         else()
#             list(APPEND ${_liblist} ${_dep})
#         endif()
#     endforeach()
# endmacro(CONVERT_LIBSTYLE_TO_PKGCONFIG)
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
56 57 58 59 60 61 62

###
#
# CLEAN_LIB_LIST: clean libraries lists to follow the pkg-config style
#                 used in GENERATE_PKGCONFIG_FILE
#
###
63 64 65 66 67 68 69 70 71 72 73 74
#macro(CLEAN_LIB_LIST _package)
#    list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS)
#    list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS_PRIVATE)
#    list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED)
#    list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED_PRIVATE)
#    convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS)
#    convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS_PRIVATE)
#    string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS "${${_package}_PKGCONFIG_LIBS}")
#    string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS_PRIVATE "${${_package}_PKGCONFIG_LIBS_PRIVATE}")
#    string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED "${${_package}_PKGCONFIG_REQUIRED}")
#    string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED_PRIVATE "${${_package}_PKGCONFIG_REQUIRED_PRIVATE}")
#endmacro(CLEAN_LIB_LIST)
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
75 76 77

###
#
78
# GENERATE_PKGCONFIG_FILE: generate files hqr.pc
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
79 80
#
###
81
macro(GENERATE_HQR_PKGCONFIG_FILE)
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
82

83 84 85 86
  set(HQR_PKGCONFIG_LIBS "-lhqr")
  set(HQR_PKGCONFIG_LIBS_PRIVATE "-lm")
  set(HQR_PKGCONFIG_REQUIRED "")
  set(HQR_PKGCONFIG_REQUIRED_PRIVATE "")
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
87

88
  #clean_lib_list(HQR)
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
89

90
  set(_output_hqr_file "${CMAKE_BINARY_DIR}/hqr.pc")
91
  configure_file(
92 93
    "${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/hqr.pc.in"
    "${_output_hqr_file}"
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
94 95
    @ONLY
    )
96
  install(
97
    FILES ${_output_hqr_file}
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
98 99
    DESTINATION lib/pkgconfig
    )
100

101
endmacro(GENERATE_HQR_PKGCONFIG_FILE)
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
102

Mathieu Faverge's avatar
Mathieu Faverge committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
###
#
# generate_env_file: generate files pastix.pc
#
###
macro(generate_env_file)

    # Create .sh file
    # ---------------
    configure_file(
      "${CMAKE_CURRENT_SOURCE_DIR}/hqr_env.sh.in"
      "${CMAKE_BINARY_DIR}/bin/hqr_env.sh" @ONLY)

    # installation
    # ------------
    install(FILES "${CMAKE_BINARY_DIR}/bin/hqr_env.sh"
      DESTINATION bin)

endmacro(generate_env_file)

BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
123 124 125
##
## @end file GenPkgConfig.cmake
##