Buildscript erstellen



  • Hallo an alle,

    ich mache gerade das Gtkmm Tutorial und würde gerne das Beispiel compilieren. Dies geht auch wunderbar in Eclipse. Nun möchte ich dies aber durch ein Buildscript ersetzen.
    Ziel ist es am Ende mit Jenkins / Hudson bauen zu können.
    Leider scheitere ich gerade am g++ Compiler.

    Der Output von der Eclipse Konsole sagt mir das ich alle .cpp Dateien manuell auflisten muss um Sie zu Kompilieren. Um daraufhin dann das Linking zu machen. Muss ich das echt von hand immer abtippen?

    Hier mal mein Code:

    /*
     ============================================================================
     Name        : hello_world.cpp
     Author      : Jemand
     Version     :
     Copyright   : GPL
     Description : Hello World in gttkmm
     ============================================================================
     */
    
    #include "HelloWorld.h"
    #include <gtkmm/main.h>
    
    int main (int argc, char *argv[])
    {
      Gtk::Main kit(argc, argv);
    
      HelloWorld helloworld;
      //Shows the window and returns when it is closed.
      Gtk::Main::run(helloworld);
    
      return 0;
    }
    

    Kleine Klasse als Beispiel:

    /*
     ============================================================================
     Name        : hello_world.cpp
     Author      : Jemand
     Version     :
     Copyright   : GPL
     Description : Hello World in gtkmm
     ============================================================================
     */
    
    #include "HelloWorld.h"
    #include <iostream>
    
    HelloWorld::HelloWorld()
    : m_button("Hello World!!")   // creates a new button with label "Hello World".
    {
      // Sets the border width of the window.
      set_border_width(10);
    
      // When the button receives the "clicked" signal, it will call the
      // on_button_clicked() method defined below.
      m_button.signal_clicked().connect(sigc::mem_fun(*this,
                  &HelloWorld::on_button_clicked));
    
      // This packs the button into the Window (a container).
      add(m_button);
    
      // The final step is to display this newly created widget...
      m_button.show();
    }
    
    HelloWorld::~HelloWorld()
    {
    }
    
    void HelloWorld::on_button_clicked()
    {
      std::cout << "Hello World" << std::endl;
    }
    
    #ifndef GTKMM_EXAMPLE_HELLOWORLD_H
    #define GTKMM_EXAMPLE_HELLOWORLD_H
    
    #include <gtkmm/button.h>
    #include <gtkmm/window.h>
    
    class HelloWorld : public Gtk::Window
    {
    
    public:
      HelloWorld();
      virtual ~HelloWorld();
    
    protected:
      //Signal handlers:
      void on_button_clicked();
    
      //Member widgets:
      Gtk::Button m_button;
    };
    
    #endif // GTKMM_EXAMPLE_HELLOWORLD_H
    

    Hier der Auszug meiner Eclipse Konsole:

    **** Build of configuration Debug for project hello_world ****
    
    make all 
    Building file: ../src/HelloWorld.cpp
    Invoking: GCC C++ Compiler
    g++ -I/usr/include/atkmm-1.6 -I/usr/include/giomm-2.4 -I/usr/lib/i386-linux-gnu/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/i386-linux-gnu/pangomm-1.4/include -I/usr/include/gtk-3.0 -I/usr/include/cairomm-1.0 -I/usr/lib/i386-linux-gnu/cairomm-1.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtk-3.0/unix-print -I/usr/include/atk-1.0 -I/usr/include/glibmm-2.4 -I/usr/lib/i386-linux-gnu/glibmm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/i386-linux-gnu/sigc++-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gio-unix-2.0/ -I/usr/include/gtkmm-3.0 -I/usr/lib/gtkmm-3.0/include -I/usr/include/gdkmm-3.0 -I/usr/lib/gdkmm-3.0/include -O0 -g3 -Wall -c -fmessage-length=0 -pthread -MMD -MP -MF"src/HelloWorld.d" -MT"src/HelloWorld.d" -o "src/HelloWorld.o" "../src/HelloWorld.cpp"
    Finished building: ../src/HelloWorld.cpp
    
    Building target: hello_world
    Invoking: GCC C++ Linker
    g++  -o "hello_world"  ./src/HelloWorld.o ./src/hello_world.o   -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0
    Finished building target: hello_world
    
    **** Build Finished ****
    

    Wie komme ich nun am besten zu einem Buildskript?


Anmelden zum Antworten