Difference between revisions of "Building Plugins:HelloMyth"

From MythTV Official Wiki
Jump to: navigation, search
(Creating Your First Plugin: Hello Myth)
(Creating Your First Plugin: Hello Myth)
Line 7: Line 7:
 
To start, download the mythplugin directory from [http://svn.mythtv.org/trac/ SVN].  Now create the following directory tree within the mythplugin directory:
 
To start, download the mythplugin directory from [http://svn.mythtv.org/trac/ SVN].  Now create the following directory tree within the mythplugin directory:
  
<nowiki>
 
 
<pre>
 
<pre>
 
mythplugin/
 
mythplugin/
Line 13: Line 12:
 
     mythhello/
 
     mythhello/
 
</pre>
 
</pre>
</nowiki>
 
  
 
=== mythhello.pro Files ===
 
=== mythhello.pro Files ===
Line 20: Line 18:
  
 
1) Create a file called mythhello.pro in the first mythhello directory:
 
1) Create a file called mythhello.pro in the first mythhello directory:
<nowiki>
 
 
<pre>
 
<pre>
 
TEMPLATE = subdirs
 
TEMPLATE = subdirs
Line 27: Line 24:
 
SUBDIRS = <strong>mythhello</strong>
 
SUBDIRS = <strong>mythhello</strong>
 
</pre>
 
</pre>
</nowiki>
 
  
 
"mythhello" refers to the second mythhello directory.
 
"mythhello" refers to the second mythhello directory.
  
 
2) Create another file called mythhello.pro in the second mythhello directory
 
2) Create another file called mythhello.pro in the second mythhello directory
<nowiki>
 
 
<pre>
 
<pre>
 
include ( ../../mythconfig.mak )
 
include ( ../../mythconfig.mak )
Line 39: Line 34:
 
TEMPLATE = lib
 
TEMPLATE = lib
 
CONFIG += plugin thread
 
CONFIG += plugin thread
TARGET = <b>mythhello</b>
+
TARGET = mythhello
 
target.path = $${LIBDIR}/mythtv/plugins
 
target.path = $${LIBDIR}/mythtv/plugins
 
INSTALLS += target
 
INSTALLS += target
  
 
uifiles.path = $${PREFIX}/share/mythtv/themes/default
 
uifiles.path = $${PREFIX}/share/mythtv/themes/default
uifiles.files = <b>hello-ui.xml</b>
+
uifiles.files = hello-ui.xml
 
installfiles.path = $${PREFIX}/share/mythtv
 
installfiles.path = $${PREFIX}/share/mythtv
installfiles.files = <b>hello-ui.xml</b>
+
installfiles.files = hello-ui.xml
  
 
INSTALLS += uifiles
 
INSTALLS += uifiles
  
 
# Input
 
# Input
HEADERS += <b>mythhello.h</b>
+
HEADERS += mythhello.h
SOURCES += <b>main.cpp mythhello.cpp</b>
+
SOURCES += main.cpp mythhello.cpp
  
 
macx {
 
macx {
Line 58: Line 53:
 
}
 
}
 
</pre>
 
</pre>
</nowiki>
 
  
All things in '''bold''' are specific to your plugin.  Be sure that $${LIBDIR} and $${PREFIX} are set in mythplugins/mythconfig.mak to be the mythtv install prefix and library directory.  Mine are set to:
+
 
<nowiki>
+
The following items are specific to your plugin: uifiles.files, installfiles.files, HEADERS, SOURCES.  Be sure that $${LIBDIR} and $${PREFIX} are set in mythplugins/mythconfig.mak to be the mythtv install prefix and library directory.  Mine are set to:
 
<pre>
 
<pre>
 
PREFIX=/usr/
 
PREFIX=/usr/
 
LIBDIR=/usr/lib/
 
LIBDIR=/usr/lib/
 
</pre>
 
</pre>
</nowiki>
 

Revision as of 04:54, 22 January 2007

Creating Your First Plugin: Hello Myth

This is a really simple skeleton plugin that doesn't do anything. It'll show you what is absolutely necessary to create a plugin. Then you can expand on that by disecting others.

As a disclaimer, I am also very new to plugin development and so please correct me where I might be wrong.

To start, download the mythplugin directory from SVN. Now create the following directory tree within the mythplugin directory:

mythplugin/
  mythhello/
    mythhello/

mythhello.pro Files

The *.pro files are used by qmake to create the Makefiles.

1) Create a file called mythhello.pro in the first mythhello directory:

TEMPLATE = subdirs

# Directories
SUBDIRS = <strong>mythhello</strong>

"mythhello" refers to the second mythhello directory.

2) Create another file called mythhello.pro in the second mythhello directory

include ( ../../mythconfig.mak )
include ( ../../settings.pro )

TEMPLATE = lib
CONFIG += plugin thread
TARGET = mythhello
target.path = $${LIBDIR}/mythtv/plugins
INSTALLS += target

uifiles.path = $${PREFIX}/share/mythtv/themes/default
uifiles.files = hello-ui.xml
installfiles.path = $${PREFIX}/share/mythtv
installfiles.files = hello-ui.xml

INSTALLS += uifiles

# Input
HEADERS += mythhello.h
SOURCES += main.cpp mythhello.cpp

macx {
    QMAKE_LFLAGS += -flat_namespace -undefined suppress
}


The following items are specific to your plugin: uifiles.files, installfiles.files, HEADERS, SOURCES. Be sure that $${LIBDIR} and $${PREFIX} are set in mythplugins/mythconfig.mak to be the mythtv install prefix and library directory. Mine are set to:

PREFIX=/usr/
LIBDIR=/usr/lib/