Using KDevelop3.0 and Kyra...SOLVED!!!

2003-03-14
2003-03-15
  • William Seppeler

    I just wanted to give my feedback on setting up KDevelop3.0 for building SDL and Kyra projects.  I've read the SDL & KDevelop mini-HOTO:

    http://www.geekcomix.com/snh/files/docs/sdl-kdev/sdl-kdev-mini-how2.html

    But it seems the instructions, as simple as they are, appear to be much more than is needed.  The instructions mention that you need to modify both the admin/acinclude.m4.in and the configure.in.in file.  I've found this not to be the case.  You *only* need to modify the configure.in.in file.  Do not play with the admin/acinclude.m4.in file or any other config file in your project folder.  If you have a properly configured system such that the aclocal script can find all relavent *.m4 files, then any macro you call from the configure.in.in file will just work.

    So in summary, if you create a new project using KDevelope, select the template as plain Terminal C++, then once the project folder is set up, add the SDL macro calls per the examples given in the HOWTO to the end of the configure.in.in file and you're all done.  The macro call that works for me is:

    ---<begin cut>---
    dnl Check for SDL
    SDL_VERSION=1.2.0
    AM_PATH_SDL($SDL_VERSION,
             :,
             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    )
    CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
    LIBS="$LIBS $SDL_LIBS"
    ---<end cut>---

    On to adding Kyra support.  I've found that if you just make a SDL<-->KYRA substitution for the macro calls, then you can start building Kyra projects:

    ---<begin cut>---
    dnl Check for KYRA
    KYRA_VERSION=2.0.0
    AM_PATH_SDL($KYRA_VERSION,
             :,
             AC_MSG_ERROR([*** KYRA version $KYRA_VERSION not found!])
    )
    CXXFLAGS="$CXXFLAGS $KYRA_CFLAGS"
    LIBS="$LIBS $KYRA_LIBS"
    ---<end cut>---

    <b>
    NOTE1:  I did come across some glitches with getting Kyra to work properly.  The kyra.m4 file needed to construct the aclocal.m4 in your project folder is located in the /usr/local/share/aclocal directory.  For some reason, the aclocal script on my system doesn't search that directory when looking up macros.  My fix was to put a link in the /usr/share/aclocal directory for kyra.m4 and then KDevelop was able to build the aclocal.m4 file properly.

    NOTE2:  I also had a problem with some macros being called from the kyra.m4 file.  My autoconf puked on the AC_LANG_PUSH and AC_LANG_POP macros.  I made a backup of my kyra.m4 file and just removed these calls and the associated C++ test code from the kyra.m4 file.  This was my quick gerry rig fix and I should probably fix the real problem.  But after removing the extra macros, I'm able to completely build Kyra projects using KDevelop.

    If anyone cares to inform me how to fix my kyra.m4 macro issues, please follow up.  I beleave the problem is because I have an older version of autoconf on my system.  Mandrake 9 seems to include an old version of autoconf and KDevelop sometimes complains about it.

    I hope this helps anyone daring to use the KDevelop environment for Kyra and SDL development.

     
    • Lee Thomason

      Lee Thomason - 2003-03-14

      Excellent! Thanks for posting the information.

      lee

       
    • William Seppeler

      Ok, this is an update for using Kyra with KDesktop3.0.  PLEASE READ AS IT'S IMPORTANT!!!

      I now have a complete fix with no work arounds.  You should follow these steps to propperly integrate Kyra with KDesktop3.0 development.  I'm currently using KDesktop3.0 from a Mandrake9.0 distro, so if there's any descrepancies in regards to other Linux distros, please post a followup.

      1.) First and foremost, I'm assuming that the Kyra libraries have been installed per default installation (ie: /usr/local).

      2.) To create a Kyra project within KDesktop, select Terminal C++ from the KAppWizzard (ie: Project-->New)

      3.) After your project directory is layed out you need to modify the configure.in.in file at the top level of your project tree.  This is where you add your m4 macro calls for library dependancies.  You'll need to add a check for SDL and Kyra.  Follow the outline from my previous post.

      4.) Now for the trick with getting the kyra.m4 file to be searched when creating the aclocal.m4 file (automatically done by doing a Build-->Autoconf&Automake).  From the top level of your project tree, modify the admin/Makefile.common file.  Look for the line starting with '@aclocal'.  It'll be right after the line '@echo "*** Creating aclocal.m4".  Add '-I /usr/local/share/aclocal' to the end of the line.  When done you should have:

          @aclocal -I /usr/local/share/aclocal

      Now the kyra.m4 macros will be sourced properly when referencing them from the configure.in.in file.  If you have any other addon libraries with m4 macros that install with the /usr/local path, this will provide a proper source path for them as well.

      5.) This step may not be needed by everyone, but I've encounted one last problem when trying to integrate Kyra with my Mandrake9.0 distro.  When doing a Autoconf&Automake, it still pukes with an error about undefined macros for AC_LANG_PUSH and AC_LANG_POP.  With alot of searching, I see the macros seem to be defined in /usr/share/autoconf, but adding that path to my aclocal command only generates more errors.  MY fix was to modify the kyra.m4 file itself.  Again, them step may not be necessary for some as I think Mandrake9.0 may be using an older autoconf or aclocal script, but here's what I did:

      Find where the m4 macro AC_LANG_PUSH is called in the /usr/local/share/aclocal/kyra.m4 file and comment it out.  Then add the following two macro calls in it's place:

          AC_LANG_SAVE
          AC_LANG_CPLUSPLUS

      Then find where AC_LANG_POP is called and comment that out.  Add the following macro in it's place:

          AC_LANG_RESTORE

      After making the appropriate changes to:

          configure.in.in
          admin/Makefile.common
          /usr/local/share/aclocal/kyra.m4

      I can completely build a Kyra project with no problems.  As a test, I created a new project and called it KyraTutorial.  I make the changes mentioned above.  I then copied all the files from the kyra/tutorial1 directory minus the Makefile (you don't want the Makefile, because KDesktop will generate one automagically for you) to my KyraTutorial project tree under the appropriate subdir.  I clobber the default main.cpp file in my project tree and rename code_d.cpp to main.cpp.  Do a krencoder to build your tutorial1.dat file and you're all set.  Just do the typical:

          Build-->DistClean
          Build-->Autoconf&Automake
          Build-->Configure
          Build-->Execute

      Whola!  Magic genie is flying across my screen.

      NOTE:  Do read the formentioned HOWTO on getting SDL and KDevelop working together as it has lots of good infomation, but do not follow the config instructions.  Don't mess with the admin/acinclude.m4.in file.  It's completely the wrong thing to do and it only gave me lots and lots of errors.  With a properly configured autoconf system, all m4 macros for SDL and Kyra should be automatically found from the aclocal script (ie: /usr/bin/aclocal)  Don't move files around.  Let the autoconf system find them as they should be.  If things are done correct, your resulting aclocal.m4 file generated by aclocal should only contain the macros necessary from the configure.in.in file and not all the needless stuff.

      I really hope this helps some other lost soul out there, because it took a while to figure things out.  I think Lee can attest to my newbee status and the learning curve has been pretty steep, but man I'm getting the hang of this now!  Time to make something useful...

       
      • William Seppeler

        PS:  Because I'm also working through the SDL tutorials, I just wanted to mention that I was able to copy the SDL tutorial code directly off the net and saved it as main.cpp.  Doing a straight rebuild and execute worked flawlessly.

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks