CMakeLists.txt 3.26 KB
Newer Older
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
#                          of Tennessee Research Foundation.
#                          All rights reserved.
# @copyright (c) 2012-2015 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
#  @file CMakeLists.txt
#
#  @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.0
#  @author Florent Pruvost
#  @date 14-09-2015
#
###

cmake_minimum_required(VERSION 2.8)

if (NOT EZTRACE_FOUND)
    find_package(EZTRACE)
endif()

if (EZTRACE_FOUND AND EZTRACE_DIR_FOUND)

    set(EZTRACE_eztrace_create_plugin_DIR "EZTRACE_eztrace_create_plugin_DIR-NOTFOUND")
    find_path(EZTRACE_eztrace_create_plugin_DIR
      NAMES eztrace_create_plugin
      HINTS ${EZTRACE_DIR_FOUND}/bin)

    if (EZTRACE_eztrace_create_plugin_DIR)

        set(EZTRACE_CREATE_PLUGIN "${EZTRACE_eztrace_create_plugin_DIR}/eztrace_create_plugin")
        add_custom_command(
            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output
            COMMAND ${EZTRACE_CREATE_PLUGIN}
            ARGS ${CMAKE_CURRENT_SOURCE_DIR}/lapacke_eztrace_module
            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lapacke_eztrace_module
            )
        add_custom_target(
            eztrace-module-lapacke-dir ALL
            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output
            )
        set(LAPACKE_H_DIR ${CMAKE_SOURCE_DIR}/coreblas/include)
        set(LAPACKE_H_FILE_TO_COPY 
            "${LAPACKE_H_DIR}/lapacke_config.h"
            "${LAPACKE_H_DIR}/lapacke_mangling.h"
            "${LAPACKE_H_DIR}/lapacke.h")
        add_custom_command(
            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output/lapacke.h
            COMMAND cp
            ARGS ${LAPACKE_H_FILE_TO_COPY} ${CMAKE_CURRENT_BINARY_DIR}/output
            DEPENDS ${LAPACKE_H_FILE_TO_COPY} ${CMAKE_CURRENT_BINARY_DIR}/output
            )
        add_custom_target(
            eztrace-module-lapacke-headers ALL
            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output/lapacke.h
            )
        add_custom_command(
            OUTPUT libeztrace-autostart-lapacke.so libeztrace-lapacke.so libeztrace-convert-lapacke.so
            COMMAND make
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output
            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output/lapacke.h
            )
        add_custom_target(
            eztrace-module-lapacke-libs ALL
            DEPENDS libeztrace-autostart-lapacke.so libeztrace-lapacke.so libeztrace-convert-lapacke.so
            )
        # installation
        # ------------
        install(
            FILES
            ${CMAKE_CURRENT_BINARY_DIR}/output/libeztrace-autostart-lapacke.so
            ${CMAKE_CURRENT_BINARY_DIR}/output/libeztrace-lapacke.so
            ${CMAKE_CURRENT_BINARY_DIR}/output/libeztrace-convert-lapacke.so
            DESTINATION ${EZTRACE_LIBRARY_DIRS}
            )

    endif (EZTRACE_eztrace_create_plugin_DIR)

endif (EZTRACE_FOUND AND EZTRACE_DIR_FOUND)

###
### END CMakeLists.txt
###