Build dirs seperate from source dirs

Help
2004-12-23
2012-12-06
  • Brian Smith
    Brian Smith
    2004-12-23

    My project's files are laid out like this:
    ocl2/         project's root directory
    ocl2/src     all source files go here
    ocl2/build  all generated files go here

    I need to be able to tell the plugin that, for example, the file ocl2/src/Ocl2/Parser.hs gets compiled to ocl2/build/Ocl2/Parser.hi and ocl2/build/Ocl2/Parser.o. In particuilar, I do not want the plugin to generate the *.o and *.hi files into the same directories that the source files are in. Furthermore, when the plugin is attempting to resolve symbols, I want it to look at the .hi files in ocl2/build.

    Is this possible? I cannot find a way to do this. As a result, the error list shows a lot of extra errors for unresolved symbols. If the plugin was looking in ocl2/build/**/.hi instead of ocl2/src/**/*.hi then it would be able to resolve these errors. This makes the plugin much less useful than it otherwise would be.

    Ideally, I would be able to set the destination directories (-hidir and -odir) seperately for each source directory.

     
    • Leif Frenzel
      Leif Frenzel
      2004-12-23

      The plugin uses a project model that separates the project in (at least) three folders:

      src/ - Sources
      out/ - what the compiler generates, i.e. .hi and .o
      bin/ - the linked executable (if any)

      (The latter two are sepaarated to facilitaty launching the executable from the IDE.)

      When you create a new project, these folders are named src/, out/ and bin/ resp. You can set different names for these folders in the 'New Project Wizard' preference page (Window > Preferences > Functional Programming > Haskell > New Project Wizard). If you change out/ to build/, that should cause the compiler to generate everything to build/.

      This applies only to new projects (changing the project's folder names later is not yet supported). You can also adjust them in the .hsproject file in the project root, but you should be careful doing that (I recommend doing it only when Eclipse is closed ...).

      In the Eclipse Java tools, it is also possible to have more than one source directory and a different output folder for each of them. This is not supported in the Haskell plugin, and probably won't be for a while longer (unless someone volunteers to implement it ;-)

      Hope that helps,
      Ciao,
      Leif