Development with Eclipse/ru
From Openmoko
GreyCardinal (Talk | contribs) m (→Установка конфигурации создания Freerunner) |
(A little bit more Russian-like) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Languages| Development with Eclipse}} | {{Languages| Development with Eclipse}} | ||
− | + | Графические приложения Openmoko снованы на среде Gnome. Их легко создавать, запускать и отлаживать как программы для настольных ПК, а загружать в мобильный телефон только на финальной стадии отладки. Используя мобильный телефон, для манипуляции им и большего удобства работы можно задействовать экран, клавиатуру и мышь настольного комьютера. Данная статья предоставляет инструкции для Debian, но они подходят и для любых Linux-дистрибутивов. | |
− | Eclipse | + | Eclipse включает в себя модуль для разработки на C/C++. Вам необходима последняя версия Eclipse, плагин для C/C++ и, возможно, обновление пакета разработчика GTK. Самый лёгкий способ заставить простое приложение выполняться - это создать проект C и добавить во флаги компилятора и линковщика флаги `pkg-config --cflags --libs gtk+-2.0`. После этого зайдите на страницу [http://library.gnome.org/devel/gtk-tutorial/stable/ GTK tutorial] и, следуя данным там инструкциям, создайте простое приложение. |
− | + | Данное решение не только сокращает время разработки, но также позволяет использовать отладчик Eclipse для разработки на C. | |
− | + | Исполняемый файл для мобильного телефона обычно создаётся из тех же самых исходных кодов, что и при отдадке на настольном компьютере, с использованием [[Toolchain|средств разработки Openmoko]]. Так как процессы сборки под настольный компьютер и под телефон Openmoko различаются, самым лучшим вариантом является создание двух окружений разработки и создание символических ссылок для них. | |
After producing the Openmoko executable, it may be reasonable to try it via X, using the keyboard, mouse and screen of the desktop computer. All you need is to use the -X option in the ssh command when you log in into the connected mobile phone. After that, you should be able to run the application inside the phone but have its X window on a screen of the desktop machine. This way you can check the actual execution speed and have access to the mobile phone devices that are not present on PC. | After producing the Openmoko executable, it may be reasonable to try it via X, using the keyboard, mouse and screen of the desktop computer. All you need is to use the -X option in the ssh command when you log in into the connected mobile phone. After that, you should be able to run the application inside the phone but have its X window on a screen of the desktop machine. This way you can check the actual execution speed and have access to the mobile phone devices that are not present on PC. | ||
Line 12: | Line 12: | ||
Eclipse allows to add the custom builder to the project. These builders can be either Ant scripts or the executable shell scripts. These possibilities can be used to force the Openmoko toolchain to produce the phone executable without leaving the Eclipse IDE. | Eclipse allows to add the custom builder to the project. These builders can be either Ant scripts or the executable shell scripts. These possibilities can be used to force the Openmoko toolchain to produce the phone executable without leaving the Eclipse IDE. | ||
− | == Установка конфигурации создания Freerunner== | + | == Установка конфигурации создания Freerunner== |
− | # | + | # Установите [[Toolchain]] |
− | # | + | # Откройте 'Properties' для вашего проекта C или C++ |
− | # | + | # Выберите 'C/C++ Build'->'Tool Settings' |
− | # | + | # Выберите 'Configuration'->'Manage' и создайте новую конфигурацию, например "Freerunner" (скопируйте настройки с конфигурации 'Release') |
# измените GCC C||C++||Assembler Compiler command на /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as | # измените GCC C||C++||Assembler Compiler command на /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as | ||
# измените GCC Linker Command на /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc (g++ для проектов C++) | # измените GCC Linker Command на /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc (g++ для проектов C++) | ||
− | # | + | # Перейдите в 'Build Steps' и добавьте ". /usr/local/openmoko/arm/setup-env" к 'Pre-build step' |
− | # | + | # Щелкните на Ok и выберите 'Freerunner' в 'Active Build Configuration' для вашего проекта |
− | + | ---- | |
+ | Поправки для Eclipse Ganymede (3.4) | ||
− | + | There are three places where you have to change settings as above in Project Properties -> C/C++ Build -> Settings -> Tool Settings | |
+ | #GCC C Compiler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc | ||
+ | #GCC C Linker -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc | ||
+ | #GCC Assembler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as | ||
− | + | --[[User:Perty|Perty]] 20:22, 18 September 2008 (UTC) | |
+ | ---- | ||
− | + | Вы можеет скопировать свои бинарники на Freerunner через добавление команды Post-Build в 'Build Steps': | |
− | + | ||
+ | scp ${имя_проекта} root@neo:/home/root/dev_app/ | ||
+ | |||
+ | или же запустить ваше приложение на Freerunner, добавив в конфигурацию Run: | ||
+ | |||
+ | C/C++ Application: /usr/bin/ssh | ||
+ | Arguments: root@neo "cd dev_app && DISPLAY=:0 ./${project_name}" | ||
--[[User:PipBoy2000|PipBoy2000]] 22:30, 9 September 2008 (UTC) | --[[User:PipBoy2000|PipBoy2000]] 22:30, 9 September 2008 (UTC) | ||
− | [[ | + | ==Настройка Eclipse для разработки с Qt4== |
− | [[Category: | + | |
+ | ===Настройка Environment и Libraries=== | ||
+ | |||
+ | * Установите [[Toolchain]] | ||
+ | * Установите Eclipse с C/C++ development plug-in | ||
+ | * Добавьте Anstrom Repository в '''Host'''-toolchain и также '''FreeRunner''' | ||
+ | ** Добавьте Anstrom Repository в '''Host'''-toolchain: | ||
+ | <pre> | ||
+ | echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf | ||
+ | echo src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf | ||
+ | </pre> | ||
+ | |||
+ | Затем: | ||
+ | |||
+ | <pre> | ||
+ | opkg-target update | ||
+ | opkg-target install qt4-x11-free | ||
+ | opkg-target install qt4-x11-free-dev qt4-designer qt4-assistant | ||
+ | </pre> | ||
+ | |||
+ | **Также добавьте [[Users Repositories|Anstrom Repository]] в '''FreeRunner''', после чего выполните: | ||
+ | <pre> | ||
+ | opkg update | ||
+ | opkg install qt4-x11-free | ||
+ | </pre> | ||
+ | |||
+ | ===Конфигурирование проекта Eclipse === | ||
+ | Project - Properties --> C/C++ Build -- Закладка "Tool Settings" | ||
+ | |||
+ | ====Конфигурация: Debug==== | ||
+ | |||
+ | *GCC c++ compiler -> Directories - добавить "/usr/include/qt4" и "/usr/include/qt4/QtGui" | ||
+ | *GCC C++ Linker -> Libraries - установить: | ||
+ | **Libraries (-l): "QtCore" и "QtGui" | ||
+ | **Library search path (-L): "/usr/lib" | ||
+ | |||
+ | ====Конфигурация: Freerunner==== | ||
+ | |||
+ | Project - Properties --> C/C++ Build -- Закладка "Tool Settings" | ||
+ | |||
+ | Создаём конфигурацию "Freerunner", выбрав 'Configuration'->'Manage' и создав новую конфигурацию, например "Freerunner" (скопируйте настройки из конфигурации 'Release') | ||
+ | |||
+ | *GCC C++ Compiler | ||
+ | <pre> | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++ | ||
+ | </pre> | ||
+ | *GCC C++ Compiler -> Directories | ||
+ | <pre> | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtCore | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtGui | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4 | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/arm-angstrom-linux-gnueabi | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2 | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/backward | ||
+ | </pre> | ||
+ | *GCC C++ Linker | ||
+ | <pre> | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++ | ||
+ | </pre> | ||
+ | *GCC C++ Linker -> Libraries --- add | ||
+ | **Libraries (-l): "QtCore" и "QtGui" | ||
+ | **Library search path (-L): "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib" | ||
+ | * GCC Assembler | ||
+ | <pre> | ||
+ | /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/as | ||
+ | </pre> | ||
+ | |||
+ | Затем переходим к закладке 'Build Steps' и добавляем ". /usr/local/openmoko/arm/setup-env" к 'Pre-build step' | ||
+ | |||
+ | ====workaround to deal with .ui файлы с Qt-Designer==== | ||
+ | |||
+ | Если у кого-то есть решение получше, не держите это в себе, расскажите здесь о нём! | ||
+ | |||
+ | Создайте новый проект с вышеперечисленными свойствами. | ||
+ | Для компилирования вашего проекта вызовите терминал в Project - Folder и введите: | ||
+ | <pre> | ||
+ | qmake-qt4 -project | ||
+ | qmake-qt4 | ||
+ | make | ||
+ | </pre> | ||
+ | и собирайте ваш проект с конфигурацией "Freerunner". | ||
+ | |||
+ | [[Category:Application Developer/ru]] |
Latest revision as of 10:47, 6 November 2008
Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
Графические приложения Openmoko снованы на среде Gnome. Их легко создавать, запускать и отлаживать как программы для настольных ПК, а загружать в мобильный телефон только на финальной стадии отладки. Используя мобильный телефон, для манипуляции им и большего удобства работы можно задействовать экран, клавиатуру и мышь настольного комьютера. Данная статья предоставляет инструкции для Debian, но они подходят и для любых Linux-дистрибутивов.
Eclipse включает в себя модуль для разработки на C/C++. Вам необходима последняя версия Eclipse, плагин для C/C++ и, возможно, обновление пакета разработчика GTK. Самый лёгкий способ заставить простое приложение выполняться - это создать проект C и добавить во флаги компилятора и линковщика флаги `pkg-config --cflags --libs gtk+-2.0`. После этого зайдите на страницу GTK tutorial и, следуя данным там инструкциям, создайте простое приложение.
Данное решение не только сокращает время разработки, но также позволяет использовать отладчик Eclipse для разработки на C.
Исполняемый файл для мобильного телефона обычно создаётся из тех же самых исходных кодов, что и при отдадке на настольном компьютере, с использованием средств разработки Openmoko. Так как процессы сборки под настольный компьютер и под телефон Openmoko различаются, самым лучшим вариантом является создание двух окружений разработки и создание символических ссылок для них.
After producing the Openmoko executable, it may be reasonable to try it via X, using the keyboard, mouse and screen of the desktop computer. All you need is to use the -X option in the ssh command when you log in into the connected mobile phone. After that, you should be able to run the application inside the phone but have its X window on a screen of the desktop machine. This way you can check the actual execution speed and have access to the mobile phone devices that are not present on PC.
Eclipse allows to add the custom builder to the project. These builders can be either Ant scripts or the executable shell scripts. These possibilities can be used to force the Openmoko toolchain to produce the phone executable without leaving the Eclipse IDE.
Contents |
[edit] Установка конфигурации создания Freerunner
- Установите Toolchain
- Откройте 'Properties' для вашего проекта C или C++
- Выберите 'C/C++ Build'->'Tool Settings'
- Выберите 'Configuration'->'Manage' и создайте новую конфигурацию, например "Freerunner" (скопируйте настройки с конфигурации 'Release')
- измените GCC C||C++||Assembler Compiler command на /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as
- измените GCC Linker Command на /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc (g++ для проектов C++)
- Перейдите в 'Build Steps' и добавьте ". /usr/local/openmoko/arm/setup-env" к 'Pre-build step'
- Щелкните на Ok и выберите 'Freerunner' в 'Active Build Configuration' для вашего проекта
Поправки для Eclipse Ganymede (3.4)
There are three places where you have to change settings as above in Project Properties -> C/C++ Build -> Settings -> Tool Settings
- GCC C Compiler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
- GCC C Linker -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
- GCC Assembler -> Command: /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc||g++||as
--Perty 20:22, 18 September 2008 (UTC)
Вы можеет скопировать свои бинарники на Freerunner через добавление команды Post-Build в 'Build Steps':
scp ${имя_проекта} root@neo:/home/root/dev_app/
или же запустить ваше приложение на Freerunner, добавив в конфигурацию Run:
C/C++ Application: /usr/bin/ssh Arguments: root@neo "cd dev_app && DISPLAY=:0 ./${project_name}"
--PipBoy2000 22:30, 9 September 2008 (UTC)
[edit] Настройка Eclipse для разработки с Qt4
[edit] Настройка Environment и Libraries
- Установите Toolchain
- Установите Eclipse с C/C++ development plug-in
- Добавьте Anstrom Repository в Host-toolchain и также FreeRunner
- Добавьте Anstrom Repository в Host-toolchain:
echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf echo src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
Затем:
opkg-target update opkg-target install qt4-x11-free opkg-target install qt4-x11-free-dev qt4-designer qt4-assistant
- Также добавьте Anstrom Repository в FreeRunner, после чего выполните:
opkg update opkg install qt4-x11-free
[edit] Конфигурирование проекта Eclipse
Project - Properties --> C/C++ Build -- Закладка "Tool Settings"
[edit] Конфигурация: Debug
- GCC c++ compiler -> Directories - добавить "/usr/include/qt4" и "/usr/include/qt4/QtGui"
- GCC C++ Linker -> Libraries - установить:
- Libraries (-l): "QtCore" и "QtGui"
- Library search path (-L): "/usr/lib"
[edit] Конфигурация: Freerunner
Project - Properties --> C/C++ Build -- Закладка "Tool Settings"
Создаём конфигурацию "Freerunner", выбрав 'Configuration'->'Manage' и создав новую конфигурацию, например "Freerunner" (скопируйте настройки из конфигурации 'Release')
- GCC C++ Compiler
/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
- GCC C++ Compiler -> Directories
/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtCore /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4/QtGui /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4 /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/arm-angstrom-linux-gnueabi /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2 /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/c++/4.1.2/backward
- GCC C++ Linker
/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
- GCC C++ Linker -> Libraries --- add
- Libraries (-l): "QtCore" и "QtGui"
- Library search path (-L): "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib"
- GCC Assembler
/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/as
Затем переходим к закладке 'Build Steps' и добавляем ". /usr/local/openmoko/arm/setup-env" к 'Pre-build step'
[edit] workaround to deal with .ui файлы с Qt-Designer
Если у кого-то есть решение получше, не держите это в себе, расскажите здесь о нём!
Создайте новый проект с вышеперечисленными свойствами. Для компилирования вашего проекта вызовите терминал в Project - Folder и введите:
qmake-qt4 -project qmake-qt4 make
и собирайте ваш проект с конфигурацией "Freerunner".