Skip to content

Linux + iPhone Continuity / iMessage / SMS

.desktop entry and proper uninstall

Zack Bartel36053271b930
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b77d5d..035750a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,7 @@ FetchContent_Declare(
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.3
)
+set(JSON_Install OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(json)
FetchContent_Declare(
@@ -24,6 +25,7 @@ FetchContent_Declare(
GIT_TAG release-1.12.1
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE)
@@ -33,3 +35,14 @@ enable_testing()
# subdirectories for the targets
add_subdirectory(src)
add_subdirectory(test)
+
+# Add uninstall target
+if(NOT TARGET uninstall)
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/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()
diff --git a/Makefile b/Makefile
index dc15d3a..b7136cc 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,9 @@ test: debug
install: release
cmake --install build/release
+uninstall:
+ cmake --build build/release --target uninstall
+
run-daemon: debug
./build/debug/tetherd
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..62ae94b
--- /dev/null
+++ b/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
+endif()
+
+file(READ "@CMAKE_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()
+ else()
+ message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+ endif()
+endforeach()
diff --git a/src/gtk/CMakeLists.txt b/src/gtk/CMakeLists.txt
index 02361e1..f40668b 100644
--- a/src/gtk/CMakeLists.txt
+++ b/src/gtk/CMakeLists.txt
@@ -12,5 +12,13 @@ target_compile_options(tether-gtk PRIVATE ${GTK3_CFLAGS_OTHER})
# Output into root build dir instead of nested build/src/gtk
set_target_properties(tether-gtk PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
+include(GNUInstallDirs)
+
install(TARGETS tether-gtk
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+install(FILES tether-gtk.desktop
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
+
+install(FILES tether.png
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/1024x1024/apps)
diff --git a/src/gtk/tether-gtk.desktop b/src/gtk/tether-gtk.desktop
new file mode 100644
index 0000000..34fab75
--- /dev/null
+++ b/src/gtk/tether-gtk.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Tether
+GenericName=Device Synchronization
+Comment=Pair devices and synchronize clipboard across the network
+Exec=tether-gtk
+Icon=tether
+Terminal=false
+Type=Application
+Categories=Network;Utility;
diff --git a/src/gtk/tether.png b/src/gtk/tether.png
new file mode 100644
index 0000000..ed8737b
Binary files /dev/null and b/src/gtk/tether.png differ