From bf880512d3b9b4325b0c31fbbb9ca699d1c9fc7e Mon Sep 17 00:00:00 2001 From: mgrova Date: Mon, 15 Jun 2020 09:48:39 +0200 Subject: [PATCH 1/3] Fixed installation path and add uninstall --- CMakeLists.txt | 17 +++++++++++++---- cmake/cmake_uninstall.cmake.in | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 cmake/cmake_uninstall.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a64372a..4fa9e9eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,16 +113,25 @@ add_executable(demo demo/demo/demo.cpp) target_link_libraries(demo tkDNN) #------------------------------------------------------------------------------- -# Install +# Install and Uninstall #------------------------------------------------------------------------------- #if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" # CACHE PATH "default install path" FORCE) #endif() message("install dir:" ${CMAKE_INSTALL_PREFIX}) -install(DIRECTORY include/ DESTINATION include/) +install(DIRECTORY include DESTINATION include) install(TARGETS tkDNN kernels DESTINATION lib) -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" # source directory - DESTINATION "share/tkDNN/cmake/" # target directory +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake" # source directory + DESTINATION "share/tkDNN/cmake" # target directory ) +# uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() \ No newline at end of file diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 00000000..8a44fd21 --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,21 @@ +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) \ No newline at end of file From 5a1b93ff62d609254a7b0ee2416908488937eaf6 Mon Sep 17 00:00:00 2001 From: mgrova Date: Mon, 15 Jun 2020 12:07:08 +0200 Subject: [PATCH 2/3] fixed cmake installation path --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fa9e9eb..6c2fbe02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,7 @@ message("install dir:" ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY include DESTINATION include) install(TARGETS tkDNN kernels DESTINATION lib) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake" # source directory - DESTINATION "share/tkDNN/cmake" # target directory + DESTINATION "share/tkDNN" # target directory ) # uninstall target From d60ddb62272e187f38df4227a8f6c4a7ed5b6818 Mon Sep 17 00:00:00 2001 From: mgrova Date: Mon, 15 Jun 2020 12:45:07 +0200 Subject: [PATCH 3/3] removed extra include in installation path --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c2fbe02..925d0dfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ target_link_libraries(demo tkDNN) # CACHE PATH "default install path" FORCE) #endif() message("install dir:" ${CMAKE_INSTALL_PREFIX}) -install(DIRECTORY include DESTINATION include) +install(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX}) install(TARGETS tkDNN kernels DESTINATION lib) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake" # source directory DESTINATION "share/tkDNN" # target directory