diff --git a/Makefile b/Makefile index f31564bc5..112654a14 100644 --- a/Makefile +++ b/Makefile @@ -878,9 +878,8 @@ help: @$(ECHO) " [Tool Installers]" @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain" @$(ECHO) " qt_sdk_install - Install the QT development tools" - @$(ECHO) " mingw_install - Install the MinGW toolchain (Windows only)" - @$(ECHO) " python_install - Install the Python interpreter (Windows only)" @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)" + @$(ECHO) " sdl_install - Install the SDL library (Windows only)" @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)" @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier" @$(ECHO) " doxygen_install - Install the Doxygen documentation generator" diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index 2b5980d7e..a60b7b8a6 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -28,7 +28,6 @@ GCS_LIBRARY_PATH libQt5MultimediaWidgets.so.5 \ libQt5Quick.so.5 \ libQt5Qml.so.5 \ - libQt5V8.so.5 \ libQt5DBus.so.5 \ libQt5QuickParticles.so.5 \ libicui18n.so.51 \ @@ -117,10 +116,8 @@ GCS_LIBRARY_PATH data_copy.target = FORCE QMAKE_EXTRA_TARGETS += data_copy } - # Windows release only, no debug target DLLs ending with 'd' - # It is assumed that SDL.dll can be found in the same directory as mingw32-make.exe - win32 { + win32 { # set debug suffix if needed CONFIG(debug, debug|release):DS = "d" @@ -145,7 +142,6 @@ GCS_LIBRARY_PATH Qt5MultimediaWidgets$${DS}.dll \ Qt5Quick$${DS}.dll \ Qt5Qml$${DS}.dll \ - Qt5V8$${DS}.dll \ icuin51.dll \ icudt51.dll \ icuuc51.dll @@ -231,12 +227,6 @@ GCS_LIBRARY_PATH data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() } - # copy MinGW DLLs - MINGW_DLLS = SDL.dll - for(dll, MINGW_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$(QTMINGW)/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() - } - # copy OpenSSL DLLs OPENSSL_DLLS = \ ssleay32.dll \ diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro b/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro new file mode 100644 index 000000000..1f99c0a48 --- /dev/null +++ b/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro @@ -0,0 +1,18 @@ +equals(copydata, 1) { + + win32 { + # copy SDL DLL + SDL_DLLS = \ + SDL.dll + for(dll, SDL_DLLS) { + data_copy.commands += $(COPY_FILE) $$targetPath(\"$$(SDL_DIR)/bin/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + } + + # add make target + POST_TARGETDEPS += copydata + + data_copy.target = copydata + QMAKE_EXTRA_TARGETS += data_copy + } + +} diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp index a2fb03ed5..811bbf7ce 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp @@ -21,6 +21,25 @@ /**********************************************************************/ #include "sdlgamepad.h" +#include +//#undef main + +class SDLGamepadPrivate +{ +public: + SDLGamepadPrivate() : gamepad(0) + { + } + + /** + * SDL_Joystick object. + * + * This represents the currently opened SDL_Joystick object. + */ + SDL_Joystick *gamepad; + +}; + /**********************************************************************/ SDLGamepad::SDLGamepad() { @@ -29,7 +48,7 @@ SDLGamepad::SDLGamepad() index = -1; loop = false; tick = MIN_RATE; - gamepad = 0; + priv = new SDLGamepadPrivate; } /**********************************************************************/ @@ -37,11 +56,13 @@ SDLGamepad::~SDLGamepad() { loop = false; - if (gamepad) { - SDL_JoystickClose(gamepad); + if (priv->gamepad) { + SDL_JoystickClose(priv->gamepad); } SDL_Quit(); + + delete priv; } /**********************************************************************/ @@ -84,14 +105,14 @@ bool SDLGamepad::setGamepad(qint16 index) { if (index != this->index) { if (SDL_JoystickOpened(this->index)) { - SDL_JoystickClose(gamepad); + SDL_JoystickClose(priv->gamepad); } - gamepad = SDL_JoystickOpen(index); + priv->gamepad = SDL_JoystickOpen(index); - if (gamepad) { - buttons = SDL_JoystickNumButtons(gamepad); - axes = SDL_JoystickNumAxes(gamepad); + if (priv->gamepad) { + buttons = SDL_JoystickNumButtons(priv->gamepad); + axes = SDL_JoystickNumAxes(priv->gamepad); if (axes >= 4) { this->index = index; @@ -122,12 +143,12 @@ void SDLGamepad::setTickRate(qint16 ms) /**********************************************************************/ void SDLGamepad::updateAxes() { - if (gamepad) { + if (priv->gamepad) { QListInt16 values; SDL_JoystickUpdate(); for (qint8 i = 0; i < axes; i++) { - qint16 value = SDL_JoystickGetAxis(gamepad, i); + qint16 value = SDL_JoystickGetAxis(priv->gamepad, i); if (value > -NULL_RANGE && value < NULL_RANGE) { value = 0; @@ -143,11 +164,11 @@ void SDLGamepad::updateAxes() /**********************************************************************/ void SDLGamepad::updateButtons() { - if (gamepad) { + if (priv->gamepad) { SDL_JoystickUpdate(); for (qint8 i = 0; i < buttons; i++) { - qint16 state = SDL_JoystickGetButton(gamepad, i); + qint16 state = SDL_JoystickGetButton(priv->gamepad, i); if (buttonStates.at(i) != state) { if (state > 0) { diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h index 217f9465f..0c77f947c 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h @@ -20,18 +20,13 @@ * mail.nalla@gmail.com */ -/**********************************************************************/ #ifndef SDLGAMEPAD_H #define SDLGAMEPAD_H -/**********************************************************************/ -#include -#undef main - -/**********************************************************************/ -#include #include "sdlgamepad_global.h" +#include + /** * The Axis range that is treated as null. * @@ -114,6 +109,8 @@ enum ButtonNumber { */ typedef QList QListInt16; +class SDLGamepadPrivate; + /** * A class for communication with a sdl gamepad. * @@ -226,17 +223,6 @@ public slots: private: - /** - * Variable to control thread. - * - * This class member variable is false at construction time. If - * the sdl init was successfull it will be set to true. The quit - * slot will false it again. - * - * @see quit() - */ - bool loop; - /** * Get new axes information from the SDL system. * @@ -261,6 +247,17 @@ private: */ void updateButtons(); + /** + * Variable to control thread. + * + * This class member variable is false at construction time. If + * the SDL init was successful it will be set to true. The quit + * slot will false it again. + * + * @see quit() + */ + bool loop; + /** * Number of buttons. * @@ -295,20 +292,18 @@ private: */ qint16 index; - /** - * SDL_Joystick object. - * - * This represents the currently opend SDL_Joystick object. - */ - SDL_Joystick *gamepad; - /** * A QList to store the current button states. * - * This list stores the current states of all avaliable buttons. + * This list stores the current states of all available buttons. */ QList buttonStates; + /** + * Variable that holds private members. + */ + SDLGamepadPrivate *priv; + signals: /** @@ -354,5 +349,4 @@ signals: void axesValues(QListInt16 values); }; -/**********************************************************************/ #endif // SDLGAMEPAD_H diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro index 44e954565..1a6a2a60d 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro @@ -18,11 +18,14 @@ # mail.nalla@gmail.com # -TEMPLATE = lib -TARGET = sdlgamepad -DEFINES += SDLGAMEPAD_LIBRARY +TEMPLATE = lib +TARGET = sdlgamepad +DEFINES += SDLGAMEPAD_LIBRARY + +include(../../openpilotgcslibrary.pri) + macx { - # Workaround to ensure that SDL framework and associated header files are found + # Ensures that SDL framework and header files are found when compiled with Qt5.2.1 INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers SDL = -F/Library/Frameworks # Add SDL to CFLAGS fixes build problems on mac @@ -30,18 +33,27 @@ macx { QMAKE_CXXFLAGS += $$SDL # Let the linker know where to find the frameworks LIBS += $$SDL + LIBS += -framework OpenGL -framework SDL -framework Cocoa } -include(../../openpilotgcslibrary.pri) +win32 { + INCLUDEPATH += $(SDL_DIR)/include + LIBS += -L$(SDL_DIR)/lib +} -SOURCES += sdlgamepad.cpp -HEADERS += sdlgamepad.h \ - sdlgamepad_global.h +!mac:LIBS += -lSDL -macx:LIBS += -framework OpenGL -framework SDL -framework Cocoa -!macx:LIBS += -lSDL +SOURCES += \ + sdlgamepad.cpp -OTHER_FILES += COPYING \ - README \ - sdlgamepad.dox \ - sdlgamepad.doc +HEADERS += \ + sdlgamepad.h \ + sdlgamepad_global.h + +OTHER_FILES += \ + COPYING \ + README \ + sdlgamepad.dox \ + sdlgamepad.doc + +include(copydata.pro) diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro index be6c80eae..57fb56136 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro @@ -1,45 +1,35 @@ TEMPLATE = lib -TARGET = GCSControl -QT += svg -QT += opengl -QT += network +TARGET = GCSControl -include(../../openpilotgcsplugin.pri) -include(../../plugins/coreplugin/coreplugin.pri) +QT += svg opengl network + +include(../../openpilotgcsplugin.pri) +include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/uavobjects/uavobjects.pri) include(../../libs/sdlgamepad/sdlgamepad.pri) -macx { - # Ensures that SDL framework and header files are found when compiled with Qt5.1.1 - INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers - SDL = -F/Library/Frameworks - # Add SDL to CFLAGS fixes build problems on mac - QMAKE_CFLAGS += $$SDL - QMAKE_CXXFLAGS += $$SDL - # Let the linker know where to find the frameworks - LIBS += $$SDL -} - - -HEADERS += gcscontrolgadget.h \ +HEADERS += \ + gcscontrolgadget.h \ gcscontrolgadgetconfiguration.h \ - gcscontrolgadgetoptionspage.h -HEADERS += joystickcontrol.h -HEADERS += gcscontrolgadgetwidget.h -HEADERS += gcscontrolgadgetfactory.h -HEADERS += gcscontrolplugin.h + gcscontrolgadgetoptionspage.h \ + gcscontrolgadgetwidget.h \ + gcscontrolgadgetfactory.h \ + gcscontrolplugin.h \ + joystickcontrol.h -SOURCES += gcscontrolgadget.cpp \ +SOURCES += \ + gcscontrolgadget.cpp \ gcscontrolgadgetconfiguration.cpp \ - gcscontrolgadgetoptionspage.cpp -SOURCES += gcscontrolgadgetwidget.cpp -SOURCES += gcscontrolgadgetfactory.cpp -SOURCES += gcscontrolplugin.cpp -SOURCES += joystickcontrol.cpp + gcscontrolgadgetoptionspage.cpp \ + gcscontrolgadgetwidget.cpp \ + gcscontrolgadgetfactory.cpp \ + gcscontrolplugin.cpp \ + joystickcontrol.cpp OTHER_FILES += GCSControl.pluginspec -FORMS += gcscontrol.ui \ +FORMS += \ + gcscontrol.ui \ gcscontrolgadgetoptionspage.ui RESOURCES += gcscontrol.qrc diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h index d2f5be894..b2bf7910c 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h @@ -31,7 +31,6 @@ #include "coreplugin/dialogs/ioptionspage.h" #include "gcscontrolplugin.h" #include "sdlgamepad/sdlgamepad.h" -#include #include #include diff --git a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp index f279a84c8..219065c8f 100644 --- a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp +++ b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp @@ -33,8 +33,8 @@ bool isFirstRun = true; QString debugInfo(DBG_BUFFER_MAX_SIZE, ' '); -QString pluginFolder(MAX_PATH, ' '); -QString outputFolder(MAX_PATH, ' '); +QString pluginFolder(_MAX_PATH, ' '); +QString outputFolder(_MAX_PATH, ' '); QList videoModes; QTime ledTimer; diff --git a/make/scripts/win_sdk_install.sh b/make/scripts/win_sdk_install.sh index b6b3c1ce1..af9c3d3c0 100644 --- a/make/scripts/win_sdk_install.sh +++ b/make/scripts/win_sdk_install.sh @@ -27,14 +27,19 @@ SCRIPT_NAME="`basename \"$SCRIPT_PATH\"`" SCRIPT_DIR="`dirname \"$SCRIPT_PATH\"`" ROOT_DIR="`pushd \"$SCRIPT_DIR/../..\" >/dev/null && pwd && popd >/dev/null`" TOOLS_DIR="$ROOT_DIR/tools" +if [ -x "$1" ]; then + TOOLS_DIR="$1" +fi # Tools URLs to fetch WGET_URL="http://wiki.openpilot.org/download/attachments/18612236/wget.exe" MAKE_URL="http://wiki.openpilot.org/download/attachments/18612236/make.exe" +SEVENZIP_URL="http://wiki.openpilot.org/download/attachments/18612236/7za.exe" # Expected tools paths WGET="$TOOLS_DIR/bin/`basename \"$WGET_URL\"`" MAKE="$TOOLS_DIR/bin/`basename \"$MAKE_URL\"`" +SEVENZIP="$TOOLS_DIR/bin/`basename \"$SEVENZIP_URL\"`" # wget is necessary to fetch other files WGET_NAME="`basename \"$WGET\"`" @@ -78,7 +83,6 @@ EOF fi # make is necessary to fetch all SDKs -MAKE_NAME="`basename \"$MAKE\"`" if [ ! -x "$MAKE" ]; then echo "$SCRIPT_NAME: $MAKE_NAME not found, fetching from $MAKE_URL" MAKE_DIR="`dirname \"$MAKE\"`" @@ -86,10 +90,24 @@ if [ ! -x "$MAKE" ]; then $WGET -N --content-disposition -P "$MAKE_DIR" "$MAKE_URL" if [ $? -ne 0 ]; then echo "$SCRIPT_NAME: $MAKE_NAME fetch error, hope it's in the path..." + MAKE_NAME="`basename \"$MAKE\"`" MAKE="$MAKE_NAME" fi fi +# 7-Zip is necessary to install some SDKs +if [ ! -x "$SEVENZIP" ]; then + echo "$SCRIPT_NAME: $SEVENZIP_NAME not found, fetching from $SEVENZIP_URL" + SEVENZIP_DIR="`dirname \"$SEVENZIP\"`" + mkdir -p "$SEVENZIP_DIR" + $WGET -N --content-disposition -P "$SEVENZIP_DIR" "$SEVENZIP_URL" + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME: $SEVENZIP_NAME fetch error, hope it's in the path..." + SEVENZIP_NAME="`basename \"$SEVENZIP\"`" + SEVENZIP="$SEVENZIP_NAME" + fi +fi + # Finally we can fetch all SDKs using top level Makefile cd "$ROOT_DIR" echo "Run 'tools/bin/make all_sdk_install' to install the other tools" diff --git a/make/tools.mk b/make/tools.mk index dc22f195f..ec06abb0e 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -12,6 +12,7 @@ # mingw_install (Windows only - NOT USED for Qt-5.1.x) # python_install (Windows only - NOT USED for Qt-5.1.x) # nsis_install (Windows only) +# sdl_install (Windows only) # openssl_install (Windows only) # uncrustify_install # doxygen_install @@ -58,13 +59,13 @@ endif ifeq ($(UNAME), Linux) ifeq ($(ARCH), x86_64) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-amd64.tar.bz2 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.1/5.1.1/qt-linux-opensource-5.1.1-x86_64-offline.run - QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-linux-opensource-5.1.1-x86_64-offline.run.md5 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-linux-x64-5.2.1.run.md5 QT_SDK_ARCH := gcc_64 else ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-i686.tar.bz2 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.1/5.1.1/qt-linux-opensource-5.1.1-x86-offline.run - QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-linux-opensource-5.1.1-x86-offline.run.md5 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x86-5.2.1.run + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-linux-x86-5.2.1.run.md5 QT_SDK_ARCH := gcc endif UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60.tar.gz @@ -76,8 +77,11 @@ else ifeq ($(UNAME), Darwin) DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1.src.tar.gz else ifeq ($(UNAME), Windows) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-windows.tar.bz2 - QT_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-5.1.1-windows.tar.bz2 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-windows-x86-mingw48_opengl-5.2.1.exe + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-windows-x86-mingw48_opengl-5.2.1.exe.md5 + QT_SDK_ARCH := mingw48_32 NSIS_URL := http://wiki.openpilot.org/download/attachments/18612236/nsis-2.46-unicode.tar.bz2 + SDL_URL := http://wiki.openpilot.org/download/attachments/18612236/SDL-devel-1.2.15-mingw32.tar.gz OPENSSL_URL := http://wiki.openpilot.org/download/attachments/18612236/openssl-1.0.1e-win32.tar.bz2 UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60-windows.tar.bz2 DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1-windows.tar.bz2 @@ -87,10 +91,11 @@ GTEST_URL := http://wiki.openpilot.org/download/attachments/18612236/gtest-1.6.0 # Changing PYTHON_DIR, also update it in ground/openpilotgcs/src/python.pri ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1 -QT_SDK_DIR := $(TOOLS_DIR)/qt-5.1.1 +QT_SDK_DIR := $(TOOLS_DIR)/qt-5.2.1 MINGW_DIR := $(QT_SDK_DIR)/Tools/mingw48_32 PYTHON_DIR := $(QT_SDK_DIR)/Tools/mingw48_32/opt/bin NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode +SDL_DIR := $(TOOLS_DIR)/SDL-1.2.15 OPENSSL_DIR := $(TOOLS_DIR)/openssl-1.0.1e-win32 UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60 DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1 @@ -106,7 +111,7 @@ QT_SDK_PREFIX := $(QT_SDK_DIR) BUILD_SDK_TARGETS := arm_sdk qt_sdk ifeq ($(UNAME), Windows) - BUILD_SDK_TARGETS += mingw python nsis openssl + BUILD_SDK_TARGETS += mingw sdl python nsis openssl endif ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen @@ -145,9 +150,14 @@ OPENSSL := openssl ANT := ant JAVAC := javac JAR := jar -SEVENZIP := 7z CD := cd GREP := grep +ifneq ($(UNAME), Windows) + SEVENZIP := 7zr +else + SEVENZIP := 7za.exe +endif + # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases. # It does not work if make started under msysGit installed into a path with spaces. ifneq ($(UNAME), Windows) @@ -255,7 +265,6 @@ define DOWNLOAD_TEMPLATE ) endef - ############################## # # Common tool install template @@ -298,6 +307,73 @@ $(1)_distclean: endef +############################## +# +# Windows QT install template +# $(1) = tool temp extract/build directory +# $(2) = tool install directory +# $(3) = tool distribution URL +# $(4) = tool distribution .md5 URL +# $(5) = tool distribution file +# $(6) = QT architecture +# $(7) = optional extra build recipes template +# $(8) = optional extra clean recipes template +# +############################## + +define WIN_QT_INSTALL_TEMPLATE + +.PHONY: $(addprefix qt_sdk_, install clean distclean) + +qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) + $(V1) if ! $(SEVENZIP) >/dev/null 2>&1; then \ + $(ECHO) $(MSG_NOTICE) "Missing 7zip. Run ./make/scripts/win_sdk_install.sh [] to get it." && \ + exit 1; \ + fi + $(call DOWNLOAD_TEMPLATE,$(3),$(5),"$(4)") +# Explode .run file into install packages + @$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(1)) + $(V1) $(MKDIR) -p $$(call toprel, $(dir $(1))) + $(V1) chmod +x $(DL_DIR)/$(5) + $(V1) $(DL_DIR)/$(5) --dump-binary-data -o $(1) +# Extract packages under tool directory + $(V1) $(MKDIR) -p $$(call toprel, $(dir $(2))) + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0qt-project-url.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/1.0.0ThirdPartySoftware_Listing.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0readme.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.essentials/5.2.1mingw48_essentials.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.essentials/5.2.1x32-4.8.0-release-posix-dwarf-rev2-runtime.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.essentials/5.2.1icu_51_1_mingw_builds_4_8_0_posix_dwarf_32.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.addons/5.2.1mingw48_addons.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.tools.win32_mingw48/4.8.0-1-1x32-4.8.0-release-posix-dwarf-rev2.7z" | grep -v Extracting +# Run patcher + @$(ECHO) + @$(ECHO) "Executing QtPatch in" $$(call toprel, $(QT_SDK_PREFIX)) + $(V1) $(CD) $(QT_SDK_PREFIX) + $(V1) $(DL_DIR)/$(5) --runoperation QtPatch windows $(QT_SDK_PREFIX) qt5 + +# Execute post build templates + $(7) + +# Clean up temporary files + @$(ECHO) $(MSG_CLEANING) $$(call toprel, $(1)) + $(V1) [ ! -d "$(1)" ] || $(RM) -rf "$(1)" + +qt_sdk_clean: + @$(ECHO) $(MSG_CLEANING) $$(call toprel, $(1)) + $(V1) [ ! -d "$(1)" ] || $(RM) -rf "$(1)" + @$(ECHO) $(MSG_CLEANING) $$(call toprel, "$(2)") + $(V1) [ ! -d "$(2)" ] || $(RM) -rf "$(2)" + + $(8) + +qt_sdk_distclean: + @$(ECHO) $(MSG_DISTCLEANING) $$(call toprel, $(DL_DIR)/$(5)) + $(V1) [ ! -f "$(DL_DIR)/$(5)" ] || $(RM) "$(DL_DIR)/$(5)" + $(V1) [ ! -f "$(DL_DIR)/$(5).md5" ] || $(RM) "$(DL_DIR)/$(5).md5" + +endef + ############################## # # Linux QT install template @@ -317,7 +393,10 @@ define LINUX_QT_INSTALL_TEMPLATE .PHONY: $(addprefix qt_sdk_, install clean distclean) qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) - + $(V1) if ! $(SEVENZIP) >/dev/null 2>&1; then \ + $(ECHO) $(MSG_NOTICE) "Please install the p7zip for your distribution. i.e.: sudo apt-get install p7zip." && \ + exit 1; \ + fi $(call DOWNLOAD_TEMPLATE,$(3),$(5),"$(4)") # Explode .run file into install packages @$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(1)) @@ -329,16 +408,16 @@ qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0qt-project-url.7z" | grep -v Extracting $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/1.0.0ThirdPartySoftware_Listing.7z" | grep -v Extracting $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0readme.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1$(6)_qt5_essentials.7z" | grep -v Extracting - $(V1) if [ -f "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_64.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_64.7z" | grep -v Extracting; fi - $(V1) if [ -f "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_32.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_32.7z" | grep -v Extracting; fi - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1icu_path_patcher.sh.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).addons/5.1.1$(6)_qt5_addons.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1$(6)_qt5_essentials.7z" | grep -v Extracting + $(V1) if [ -f "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_64.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_64.7z" | grep -v Extracting; fi + $(V1) if [ -f "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_32.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_32.7z" | grep -v Extracting; fi +# $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_path_patcher.sh.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).addons/5.2.1$(6)_qt5_addons.7z" | grep -v Extracting # go to OpenPilot/tools/5.1.1/gcc_64 and call patcher.sh @$(ECHO) @$(ECHO) "Running patcher in" $$(call toprel, $(QT_SDK_PREFIX)) $(V1) $(CD) $(QT_SDK_PREFIX) - $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX) +# $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX) # call qmake patcher @$(ECHO) "Executing QtPatch in" $$(call toprel, $(QT_SDK_PREFIX)) $(V1) $(DL_DIR)/$(5) --runoperation QtPatch linux $(QT_SDK_PREFIX) qt5 @@ -398,26 +477,28 @@ endef # # Qt SDK # -# Windows: native binary package has been provided -# Linux: user should install native Qt SDK package # Mac OS X: user should install native Qt SDK package # ############################## ifeq ($(UNAME), Windows) -QT_SDK_PREFIX := $(QT_SDK_DIR)/5.1.1/mingw48_32 +QT_SDK_PREFIX := $(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH) +# This additional configuration step should not be necessary +# but it is needed as a workaround to https://bugreports.qt-project.org/browse/QTBUG-33254 define QT_SDK_CONFIGURE_TEMPLATE @$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(QT_SDK_DIR)) $(V1) $(ECHO) $(QUOTE)[Paths]$(QUOTE) > $(QT_SDK_PREFIX)/bin/qt.conf $(V1) $(ECHO) $(QUOTE)Prefix = $(QT_SDK_PREFIX)$(QUOTE) >> $(QT_SDK_PREFIX)/bin/qt.conf endef - $(eval $(call TOOL_INSTALL_TEMPLATE,qt_sdk,$(QT_SDK_DIR),$(QT_SDK_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_CONFIGURE_TEMPLATE))) +QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD + $(eval $(call WIN_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH),$(QT_SDK_CONFIGURE_TEMPLATE))) else ifeq ($(UNAME), Linux) -QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.1.1/$(QT_SDK_ARCH)" + +QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH)" QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD $(eval $(call LINUX_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH))) @@ -428,7 +509,7 @@ QT_SDK_PREFIX := $(QT_SDK_DIR) .PHONY: qt_sdk_install qt_sdk_install: @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- - @$(ECHO) $(MSG_NOTICE) Please install native Qt 5.1.x SDK using package manager + @$(ECHO) $(MSG_NOTICE) Please install native Qt 5.2.x SDK using package manager @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- .PHONY: qt_sdk_clean @@ -466,62 +547,40 @@ qt_sdk_version: ifeq ($(UNAME), Windows) -#$(eval $(call TOOL_INSTALL_TEMPLATE,mingw,$(MINGW_DIR),$(MINGW_URL),$(notdir $(MINGW_URL)))) -mingw_install: -mingw_clean: -mingw_distclean: - ifeq ($(shell [ -d "$(MINGW_DIR)" ] && $(ECHO) "exists"), exists) # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename) export QTMINGW := $(MINGW_DIR)/bin export PATH := $(QTMINGW):$(PATH) else # not installed, use host gcc compiler - # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found (make mingw_install), using system PATH) + # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH) endif .PHONY: mingw_version -mingw_version: - -$(V1) gcc --version | head -n1 - -.PHONY: gcc_version -gcc_version: mingw_version +mingw_version: gcc_version else # Linux or Mac all_sdk_version: gcc_version +endif + .PHONY: gcc_version gcc_version: -$(V1) gcc --version | head -n1 -endif - ############################## # # Python # ############################## -ifeq ($(UNAME), Windows) - -#$(eval $(call TOOL_INSTALL_TEMPLATE,python,$(PYTHON_DIR),$(PYTHON_URL),$(notdir $(PYTHON_URL)))) -python_install: -python_clean: -python_distclean: - -else # Linux or Mac - -all_sdk_version: python_version - -endif - ifeq ($(shell [ -d "$(PYTHON_DIR)" ] && $(ECHO) "exists"), exists) export PYTHON := $(PYTHON_DIR)/python export PATH := $(PYTHON_DIR):$(PATH) else # not installed, hope it's in the path... - # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found (make python_install), using system PATH) + # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH) export PYTHON := python endif @@ -553,6 +612,29 @@ nsis_version: endif +############################## +# +# SDL (Windows only) +# +############################## + +ifeq ($(UNAME), Windows) + +$(eval $(call TOOL_INSTALL_TEMPLATE,sdl,$(SDL_DIR),$(SDL_URL),$(notdir $(SDL_URL)))) + +ifeq ($(shell [ -d "$(SDL_DIR)" ] && $(ECHO) "exists"), exists) + export SDL_DIR := $(SDL_DIR) +else + # not installed, hope it's in the path... + $(info $(EMPTY) WARNING $(call toprel, $(SDL_DIR)) not found (make sdl_install), using system PATH) +endif + +.PHONY: sdl_version +sdl_version: + -$(V1) $(ECHO) "SDL 1.2.15" + +endif + ############################## # # OpenSSL (Windows only) @@ -574,6 +656,7 @@ endif .PHONY: openssl_version openssl_version: -$(V1) $(ECHO) "OpenSSL `$(OPENSSL) version`" + endif ############################## diff --git a/package/linux/deb_common/rules b/package/linux/deb_common/rules index e3fed4f80..4ee22cc13 100644 --- a/package/linux/deb_common/rules +++ b/package/linux/deb_common/rules @@ -36,7 +36,6 @@ install: cp -arp build/openpilotgcs_release/bin debian/openpilot/usr/local/OpenPilot cp -arp build/openpilotgcs_release/lib debian/openpilot/usr/local/OpenPilot cp -arp build/openpilotgcs_release/share debian/openpilot/usr/local/OpenPilot - cp -arp build/openpilotgcs_release/.obj debian/openpilot/usr/local/OpenPilot cp -arp package/linux/qt.conf debian/openpilot/usr/local/OpenPilot/bin cp -arp package/linux/openpilot.desktop debian/openpilot/usr/share/applications cp -arp package/linux/openpilot.png debian/openpilot/usr/share/pixmaps