]> sigrok.org Git - pulseview.git/commitdiff
Created a CMake build environment
authorJoel Holdsworth <redacted>
Mon, 28 May 2012 21:32:36 +0000 (22:32 +0100)
committerJoel Holdsworth <redacted>
Mon, 3 Sep 2012 12:49:39 +0000 (13:49 +0100)
CMakeLists.txt [new file with mode: 0644]
sigrok-qt2.pro [deleted file]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fd932a2
--- /dev/null
@@ -0,0 +1,68 @@
+cmake_minimum_required(VERSION 2.6)
+include(FindPkgConfig)
+
+project(sigrok-qt2)
+
+find_package(PkgConfig)
+pkg_check_modules(PKGDEPS REQUIRED
+       libsigrokdecode>=0.1.0
+       libsigrok>=0.1.0
+)
+
+find_package(Qt4 REQUIRED)
+
+set(VERSION 0.1.0)
+
+set(sigrok-qt2_SOURCES
+       about.cpp
+       main.cpp
+       mainwindow.cpp
+       sigview.cpp
+)
+
+set(sigrok-qt2_HEADERS
+       about.h
+       mainwindow.h
+       sigview.h
+)
+
+set(sigrok-qt2_FORMS
+       about.ui
+       mainwindow.ui
+)
+
+set(sigrok-qt2_RESOURCES
+       sigrok-qt2.qrc
+)
+
+set(QT_USE_QTOPENGL TRUE)
+
+qt4_wrap_cpp(sigrok-qt2_HEADERS_MOC ${sigrok-qt2_HEADERS})
+qt4_wrap_ui(sigrok-qt2_FORMS_HEADERS ${sigrok-qt2_FORMS})
+qt4_add_resources(sigrok-qt2_RESOURCES_RCC ${sigrok-qt2_RESOURCES})
+
+include(${QT_USE_FILE})
+
+add_definitions(${QT_DEFINITIONS})
+add_definitions(-DAPP_VERSION="${VERSION}")
+
+include_directories(
+       ${include_directories}
+       ${PKGDEPS_INCLUDE_DIRS}
+)
+
+link_directories(
+       ${PKGDEPS_LIBRARY_DIRS}
+)
+
+add_executable(sigrok-qt2
+       ${sigrok-qt2_SOURCES}
+       ${sigrok-qt2_HEADERS_MOC}
+       ${sigrok-qt2_FORMS_HEADERS}
+       ${sigrok-qt2_RESOURCES_RCC}
+)
+
+target_link_libraries(sigrok-qt2
+       ${PKGDEPS_LIBRARIES}
+       ${QT_LIBRARIES}
+)
diff --git a/sigrok-qt2.pro b/sigrok-qt2.pro
deleted file mode 100644 (file)
index 7993c93..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2012-05-10T21:19:20
-#
-#-------------------------------------------------
-
-QT       += core gui opengl
-
-TARGET = sigrok-qt2
-TEMPLATE = app
-
-# The sigrok-qt version number. Define APP_VERSION macro for use in the code.
-VERSION       = 0.1.0
-DEFINES      += APP_VERSION=\\\"$$VERSION\\\"
-
-SOURCES += main.cpp\
-        mainwindow.cpp \
-    about.cpp \
-    sigview.cpp
-
-HEADERS  += mainwindow.h \
-    about.h \
-    sigview.h
-
-FORMS    += mainwindow.ui \
-    about.ui
-
-RESOURCES    += sigrok-qt2.qrc
-
-# libsigrok and libsigrokdecode
-# TODO: Check for the minimum versions of libsigrok/libsigrokdecode we need.
-win32 {
-       # On Windows/MinGW we need to use '--libs --static'.
-       # We also need to strip some stray '\n' characters here.
-       QMAKE_CXXFLAGS += $$system(pkg-config --cflags libsigrokdecode \
-                         libsigrok | sed s/\n//g)
-       LIBS           += $$system(pkg-config --libs --static libsigrokdecode \
-                         libsigrok | sed s/\n//g)
-} else {
-       QMAKE_CXXFLAGS += $$system(pkg-config --cflags libsigrokdecode)
-       QMAKE_CXXFLAGS += $$system(pkg-config --cflags libsigrok)
-       LIBS           += $$system(pkg-config --libs libsigrokdecode)
-       LIBS           += $$system(pkg-config --libs libsigrok)
-}