2020-11-16 12:57:03 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10) # bionic's cmake version
|
|
|
|
|
|
|
|
# Has to be set before `project()`, and ignored on non-macos:
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "macOS deployment target (Apple clang only)")
|
|
|
|
|
|
|
|
find_program(CCACHE_PROGRAM ccache)
|
|
|
|
if(CCACHE_PROGRAM)
|
|
|
|
foreach(lang C CXX)
|
|
|
|
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/ccache")
|
|
|
|
message(STATUS "Enabling ccache for ${lang}")
|
|
|
|
set(CMAKE_${lang}_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2020-11-18 21:54:29 +00:00
|
|
|
set(PROJECT_NAME lokinet-uninstaller)
|
|
|
|
project(${PROJECT_NAME}
|
2020-11-16 12:57:03 +00:00
|
|
|
VERSION 0.0.1
|
|
|
|
DESCRIPTION "lokinet uninstaller for macos"
|
|
|
|
LANGUAGES CXX)
|
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
main.cpp)
|
|
|
|
|
|
|
|
find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
|
|
"-framework Security"
|
|
|
|
Qt5::Core Qt5::Widgets)
|
|
|
|
|
|
|
|
set_target_properties(${PROJECT_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
CXX_STANDARD 17
|
|
|
|
CXX_EXTENSIONS OFF
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
set(MACOS_SIGN ""
|
|
|
|
CACHE STRING "enable codesigning -- use a 'Apple Distribution' key (or key description) from `security find-identity -v`")
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mk-icns.sh ${CMAKE_CURRENT_SOURCE_DIR}/icon.svg ${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon.svg ${CMAKE_CURRENT_SOURCE_DIR}/mk-icns.sh)
|
|
|
|
|
|
|
|
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns)
|
|
|
|
|
|
|
|
set_target_properties(${PROJECT_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
OUTPUT_NAME UninstallLokinet
|
2020-11-16 13:11:45 +00:00
|
|
|
RESOURCE "${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns")
|
2020-11-16 12:57:03 +00:00
|
|
|
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_NAME UninstallLokinet)
|
|
|
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.lokinet.lokinet-uninstaller)
|
|
|
|
set(MACOSX_BUNDLE_INFO_STRING "Lokinet uninstaller")
|
2020-11-18 21:54:29 +00:00
|
|
|
set(MACOSX_BUNDLE_ICON_FILE lokinet-uninstall.icns)
|
2020-11-16 12:57:03 +00:00
|
|
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION})
|
|
|
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
|
|
|
|
set(MACOSX_BUNDLE_COPYRIGHT "© 2020, The Loki Project")
|
|
|
|
|
2020-11-16 13:07:25 +00:00
|
|
|
get_target_property(uic_location Qt5::uic IMPORTED_LOCATION)
|
|
|
|
get_filename_component(qt_dir ${uic_location} DIRECTORY)
|
|
|
|
|
2020-11-16 12:57:03 +00:00
|
|
|
if(MACOS_SIGN)
|
|
|
|
add_custom_command(TARGET ${PROJECT_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND echo "Running qt magic macos deploy script"
|
|
|
|
COMMAND "${qt_dir}/macdeployqt" UninstallLokinet.app -always-overwrite
|
|
|
|
COMMAND echo "Signing app bundle and everything inside it"
|
2020-11-18 11:08:56 +00:00
|
|
|
COMMAND codesign -s "${MACOS_SIGN}" --deep --strict --options runtime --force -vvv UninstallLokinet.app
|
2020-11-16 12:57:03 +00:00
|
|
|
)
|
|
|
|
else()
|
2020-11-16 12:58:44 +00:00
|
|
|
add_custom_command(TARGET ${PROJECT_NAME}
|
2020-11-16 12:57:03 +00:00
|
|
|
POST_BUILD
|
|
|
|
COMMAND echo "Running qt magic macos deploy script"
|
|
|
|
COMMAND "${qt_dir}/macdeployqt" UninstallLokinet.app -always-overwrite
|
|
|
|
)
|
|
|
|
endif()
|
2020-11-16 13:10:40 +00:00
|
|
|
|
2020-11-18 21:54:29 +00:00
|
|
|
install(TARGETS lokinet-uninstaller
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
BUNDLE DESTINATION .
|
|
|
|
RESOURCE DESTINATION .)
|