CMakeLists.txt 2.36 KB
Newer Older
EXT Valentin Touzeau's avatar
EXT Valentin Touzeau committed
1 2 3 4 5 6 7

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# configuration
set(PLUGIN	"lrusecurity")	# plugin name
set(NAMESPACE	"")		# namespace
set(SOURCES	"src/lrusecurity.cpp"
8 9 10 11
  "src/lrusecurity_SecurityCatBuilder.cpp"
  "src/Prev/lrusecurity_ExistHitPrevAnalysis.cpp"
  "src/Prev/lrusecurity_ExistHitPrevDomain.cpp"
  "src/Prev/lrusecurity_ExistHitPrevAdapter.cpp"
12 13 14
  "src/Prev_Over/lrusecurity_ExistHitPrevOAnalysis.cpp"
  "src/Prev_Over/lrusecurity_ExistHitPrevOAdapter.cpp"
  "src/Prev_Over/lrusecurity_ExistHitPrevODomain.cpp"
15 16 17
  "src/Prev_Under/lrusecurity_ExistHitPrevUAnalysis.cpp"
  "src/Prev_Under/lrusecurity_ExistHitPrevUDomain.cpp"
  "src/Prev_Under/lrusecurity_ExistHitPrevUAdapter.cpp"
18
  "src/lrusecurity_Displayer.cpp"
Julien Balette-Pape's avatar
Julien Balette-Pape committed
19
  "src/Graphic/AccMatching.cpp"                        # Modification for Dot
Julien Balette-Pape's avatar
Julien Balette-Pape committed
20
  "src/Graphic/DotModificator.cpp"
EXT Valentin Touzeau's avatar
EXT Valentin Touzeau committed
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
)

# script
project(${PLUGIN})

# look for OTAWA
if(NOT OTAWA_CONFIG)
    find_program(OTAWA_CONFIG otawa-config DOC "path to otawa-config")
    if(NOT OTAWA_CONFIG)
        message(FATAL_ERROR "ERROR: otawa-config is required !")
    endif()
endif()

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${PLUGIN}.eld DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)

message(STATUS "otawa-config found at ${OTAWA_CONFIG}")
execute_process(COMMAND "${OTAWA_CONFIG}" --cflags
		OUTPUT_VARIABLE OTAWA_CFLAGS
		WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
		OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${OTAWA_CONFIG}" --libs --make-plug ${PLUGIN} -r
		OUTPUT_VARIABLE OTAWA_LDFLAGS
		WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
		OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${OTAWA_CONFIG}" --prefix
		OUTPUT_VARIABLE OTAWA_PREFIX
		WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
		OUTPUT_STRIP_TRAILING_WHITESPACE)

# plugin definition
set(ORIGIN $ORIGIN)
add_library(${PLUGIN} SHARED ${SOURCES})
set_property(TARGET ${PLUGIN} PROPERTY PREFIX "")
set_property(TARGET ${PLUGIN} PROPERTY COMPILE_FLAGS "${OTAWA_CFLAGS} --std=c++11 -g -Wall -Wextra")
target_include_directories(${PLUGIN} PUBLIC "${CMAKE_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN} ${OTAWA_LDFLAGS})

# installation
set(PLUGIN_PATH "${OTAWA_PREFIX}/lib/otawa/${NAMESPACE}")
install(TARGETS ${PLUGIN} LIBRARY DESTINATION ${PLUGIN_PATH})
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/lrusecurity" DESTINATION "${OTAWA_PREFIX}/include/")
install(FILES ${PLUGIN}.eld DESTINATION ${PLUGIN_PATH})