Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GNA] Remove old GNA1 library from Cmake scripts #1686

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 4 additions & 34 deletions inference-engine/cmake/FindlibGNA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,20 @@ endif ()

set(libGNA_FOUND TRUE)

set(GNA_KERNEL_LIB_NAME gna CACHE STRING "" FORCE)
set(GNA_LIBS_LIST
"libGNA::API"
"libGNA::KERNEL")

if (GNA_LIBRARY_VERSION STREQUAL "GNA1")
# use old version of GNA Library from gna_20181120
if (WIN32)
set(GNA_LIB_DIR x64 CACHE STRING "" FORCE)
else ()
list(APPEND GNA_LIBS_LIST
"libGNA::OLD_API_LIB")
set(GNA_LIB_DIR lib CACHE STRING "" FORCE)
set(GNA_KERNEL_LIB_NAME gna_kernel CACHE STRING "" FORCE)
endif()
set(libGNA_INCLUDE_DIRS "${GNA}/${GNA_PLATFORM_DIR}/include" CACHE STRING "" FORCE)
else()
# use current version of GNA library
set(GNA_LIB_DIR x64 CACHE STRING "" FORCE)
set(libGNA_INCLUDE_DIRS "${GNA}/include" CACHE STRING "" FORCE)
endif()
set(libGNA_LIBRARIES_BASE_PATH ${GNA}/${GNA_PLATFORM_DIR}/${GNA_LIB_DIR} CACHE STRING "" FORCE)
set(libGNA_LIBRARIES_BASE_PATH "${GNA}/${GNA_PLATFORM_DIR}/x64" CACHE STRING "" FORCE)

add_library(libGNA::KERNEL SHARED IMPORTED)
find_library(GNA_KERNEL_LIBRARY
${GNA_KERNEL_LIB_NAME}
gna
HINTS
${libGNA_LIBRARIES_BASE_PATH})
set_target_properties(libGNA::KERNEL PROPERTIES IMPORTED_LOCATION ${GNA_KERNEL_LIBRARY})

if ((GNA_LIBRARY_VERSION STREQUAL "GNA1") AND (NOT WIN32))
add_library(libGNA::OLD_API_LIB SHARED IMPORTED)
find_library(GNA_API_LIBRARY
gna_api
HINTS
${libGNA_LIBRARIES_BASE_PATH})
set_target_properties(libGNA::OLD_API_LIB PROPERTIES IMPORTED_LOCATION ${GNA_API_LIBRARY})
target_link_libraries(libGNA::OLD_API_LIB INTERFACE libGNA::KERNEL)
set_target_properties(libGNA::OLD_API_LIB PROPERTIES IMPORTED_NO_SONAME TRUE)
set_target_properties(libGNA::KERNEL PROPERTIES IMPORTED_NO_SONAME TRUE)
endif()

add_library(libGNA::API INTERFACE IMPORTED)
set_property(TARGET libGNA::API PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${libGNA_INCLUDE_DIRS})
set_property(TARGET libGNA::API PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GNA}/include")

add_library(libGNA INTERFACE IMPORTED)
foreach(_lib_name ${GNA_LIBS_LIST})
Expand All @@ -75,6 +45,6 @@ endforeach(_lib_name)
if (WIN32)
set_target_properties(libGNA::KERNEL PROPERTIES
IMPORTED_IMPLIB ${GNA_KERNEL_LIBRARY})
elseif(NOT GNA_LIBRARY_VERSION STREQUAL "GNA1")
else()
set_target_properties(libGNA PROPERTIES INTERFACE_LINK_OPTIONS "-Wl,-rpath-link,${libGNA_LIBRARIES_BASE_PATH}")
endif ()
5 changes: 0 additions & 5 deletions inference-engine/cmake/check_features_ie.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ endif()

if (ENABLE_GNA)
add_definitions(-DENABLE_GNA)

if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
message(WARNING "${GNA_LIBRARY_VERSION} is not supported on GCC version ${CMAKE_CXX_COMPILER_VERSION}. Fallback to GNA1")
set(GNA_LIBRARY_VERSION GNA1)
endif()
endif()

if (ENABLE_SPEECH_DEMO)
Expand Down
24 changes: 9 additions & 15 deletions inference-engine/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,16 @@ if (ENABLE_GNA)
GNA_LIB_DIR
libGNA_INCLUDE_DIRS
libGNA_LIBRARIES_BASE_PATH)
if (GNA_LIBRARY_VERSION STREQUAL "GNA1")
RESOLVE_DEPENDENCY(GNA
ARCHIVE_UNIFIED "GNA/gna_20181120.zip"
TARGET_PATH "${TEMP}/gna")
else()
if(GNA_LIBRARY_VERSION STREQUAL "GNA1_1401")
set(GNA_VERSION "01.00.00.1401")
endif()
if(GNA_LIBRARY_VERSION STREQUAL "GNA2")
set(GNA_VERSION "02.00.00.0925")
endif()
RESOLVE_DEPENDENCY(GNA
ARCHIVE_UNIFIED "GNA/GNA_${GNA_VERSION}.zip"
TARGET_PATH "${TEMP}/gna_${GNA_VERSION}"
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+.[0-9]+).*")
if(GNA_LIBRARY_VERSION STREQUAL "GNA1_1401")
set(GNA_VERSION "01.00.00.1401")
endif()
if(GNA_LIBRARY_VERSION STREQUAL "GNA2")
set(GNA_VERSION "02.00.00.0925")
endif()
RESOLVE_DEPENDENCY(GNA
ARCHIVE_UNIFIED "GNA/GNA_${GNA_VERSION}.zip"
TARGET_PATH "${TEMP}/gna_${GNA_VERSION}"
VERSION_REGEX ".*_([0-9]+.[0-9]+.[0-9]+.[0-9]+).*")
update_deps_cache(GNA "${GNA}" "Path to GNA root folder")
debug_message(STATUS "gna=" ${GNA})
endif()
Expand Down
13 changes: 4 additions & 9 deletions inference-engine/cmake/features_ie.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,13 @@ if (NOT THREADING STREQUAL "TBB" AND
endif()

if (ENABLE_GNA)
if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
set (DEFAULT_GNA_LIB GNA1)
else()
set (DEFAULT_GNA_LIB GNA2)
endif()
set (DEFAULT_GNA_LIB GNA2)
set(GNA_LIBRARY_VERSION "${DEFAULT_GNA_LIB}" CACHE STRING "GNAVersion")
set_property(CACHE GNA_LIBRARY_VERSION PROPERTY STRINGS "GNA1" "GNA1_1401" "GNA2")
set_property(CACHE GNA_LIBRARY_VERSION PROPERTY STRINGS "GNA1_1401" "GNA2")
list (APPEND IE_OPTIONS GNA_LIBRARY_VERSION)
if (NOT GNA_LIBRARY_VERSION STREQUAL "GNA1" AND
NOT GNA_LIBRARY_VERSION STREQUAL "GNA1_1401" AND
if (NOT GNA_LIBRARY_VERSION STREQUAL "GNA1_1401" AND
NOT GNA_LIBRARY_VERSION STREQUAL "GNA2")
message(FATAL_ERROR "GNA_LIBRARY_VERSION should be set to GNA1, GNA1_1401 or GNA2. Default option is ${DEFAULT_GNA_LIB}")
message(FATAL_ERROR "GNA_LIBRARY_VERSION should be set to GNA1_1401 or GNA2. Default option is ${DEFAULT_GNA_LIB}")
endif()
endif()

Expand Down