diff options
author | Pasi Petäjäjärvi <pasi.petajajarvi@qt.io> | 2021-08-20 14:48:26 +0300 |
---|---|---|
committer | Janne Juntunen <janne.juntunen@qt.io> | 2021-09-13 07:11:43 +0000 |
commit | d9978f10a0ef60563fdff8f8eadcb5a678b9a5b1 (patch) | |
tree | f35ba5e9dbfbb7698f8e2fe2863a636fb1e62b3c | |
parent | 474fa4b7aee62e704158d213d9e67eba74c69401 (diff) |
Add cmake support
Task-number: QTBUG-86119
Change-Id: I858cdcc75e8b26007c244f9ef4efebb5da9cd66a
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
-rw-r--r-- | .cmake.conf | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | appcontroller.pro | 40 | ||||
-rw-r--r-- | main.cpp | 2 |
4 files changed, 28 insertions, 41 deletions
diff --git a/.cmake.conf b/.cmake.conf new file mode 100644 index 0000000..16ecb3d --- /dev/null +++ b/.cmake.conf @@ -0,0 +1 @@ +add_compile_definitions(APPCONTROLLER_VERSION="1.0.0") diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7c96b7c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.16) +include(.cmake.conf) + +project(appcontroller LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_AUTOMOC ON) + +find_package(Qt6 COMPONENTS Network) + +qt6_add_executable(appcontroller + main.cpp + process.cpp + portlist.cpp + perfprocesshandler.cpp +) + +target_link_libraries(appcontroller PUBLIC + Qt::Network +) + +install(TARGETS appcontroller + RUNTIME DESTINATION bin +) diff --git a/appcontroller.pro b/appcontroller.pro deleted file mode 100644 index 97b208e..0000000 --- a/appcontroller.pro +++ /dev/null @@ -1,40 +0,0 @@ -QT-=gui -QT+=network -HEADERS=\ - process.h \ - portlist.h \ - perfprocesshandler.h - -SOURCES=\ - main.cpp \ - process.cpp \ - portlist.cpp \ - perfprocesshandler.cpp - -android { - target.path = $$[INSTALL_ROOT]/system/bin -} else { - target.path = $$[INSTALL_ROOT]/usr/bin -} -INSTALLS+=target - -# Find out git hash -exists(.git) { - unix:system(which git):HAS_GIT=TRUE - win32:system(where git.exe):HAS_GIT=TRUE - contains(HAS_GIT, TRUE) { - GIT_HASH=$$system(git log -1 --format=%H) - !system(git diff-index --quiet HEAD): GIT_HASH="$$GIT_HASH-dirty" - GIT_VERSION=$$system(git describe --tags --exact-match) - isEmpty(GIT_VERSION) : GIT_VERSION="unknown" - } -} else { - GIT_HASH="unknown" - GIT_VERSION="unknown" -} - -isEmpty(GIT_VERSION) : error("No suitable tag found") -isEmpty(GIT_HASH) : error("No hash available") - -DEFINES+="GIT_HASH=\\\"$$GIT_HASH\\\"" -DEFINES+="GIT_VERSION=\\\"$$GIT_VERSION\\\"" @@ -452,7 +452,7 @@ int main(int argc, char **argv) else return 1; } else if (arg == "--version") { - printf("Appcontroller version: " GIT_VERSION "\nGit revision: " GIT_HASH "\nFeatures: " FEATURES "\n"); + printf("Appcontroller version: " APPCONTROLLER_VERSION "\nFeatures: " FEATURES "\n"); return 0; } else if (arg == "--detach") { detach = true; |