summaryrefslogtreecommitdiffstats
path: root/src/tools/boost/boost.cpp
blob: e67f833c5bf2e354e5ffa281c7555f385514a506 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#include "boost.h"

#include "boostc_compile.h"
#include "boost_config.h"
#include "devices/pic/pic/pic_memory.h"
#include "devices/list/device_list.h"
#include "devices/base/device_group.h"

//----------------------------------------------------------------------------
bool Boost::Linker::checkExecutableResult(bool, TQStringList &lines) const
{
  return ( lines.count()>0 && lines[0].startsWith("BoostLink ") );
}

PURL::Directory Boost::Linker::checkExecutableWorkingDirectory() const
{
  return static_cast<const Group *>(_group)->checkExecutableUrl().directory();
}

TQStringList Boost::Linker16::checkExecutableOptions(bool) const
{
  // #### otherwise may stall...
  TQStringList args;
  args += "-t PIC16F873";
  args += static_cast<const Group *>(_group)->checkExecutableUrl().toExtension("obj").filename();
  return args;
}

TQStringList Boost::Linker18::checkExecutableOptions(bool) const
{
  // #### otherwise may stall...
  TQStringList args;
  args += "-t PIC18F452";
  args += static_cast<const Group *>(_group)->checkExecutableUrl().toExtension("obj").filename();
  return args;
}

//----------------------------------------------------------------------------
TQStringList Boost::Compiler::checkExecutableOptions(bool) const
{
  // #### otherwise may stall...
  return static_cast<const Group *>(_group)->checkExecutableUrl().filename();
}

PURL::Directory Boost::Compiler::checkExecutableWorkingDirectory() const
{
  return static_cast<const Group *>(_group)->checkExecutableUrl().directory();
}

//----------------------------------------------------------------------------
Boost::Group::Group(const TQString &extension, const TQString &text)
  : _checkExecTmp(_sview, extension)
{
  if ( _checkExecTmp.openForWrite() ) _checkExecTmp.appendText(text);
  _checkExecTmp.close();
}

TQString Boost::Group::comment() const
{
  return i18n("The Boost toolchain needs to be run by Wine with \"Windows NT 4.0\" compatibility. This can be configured with the Wine configuration utility.");
}

PURL::Directory Boost::Group::autodetectDirectory(Compile::DirectoryType type, const PURL::Directory &execDir, bool) const
{
  if ( type==Compile::DirectoryType::Library ) return execDir.path() + "Lib";
  return PURL::Directory();
}

Compile::Process *Boost::Group::processFactory(const Compile::Data &data) const
{
  switch (data.category.type()) {
    case Tool::Category::Compiler: return new Boost::CompileFile;
    case Tool::Category::Linker: return new Boost::Link;
    default: break;
  }
  Q_ASSERT(false);
  return 0;
}

Compile::Config *Boost::Group::configFactory(::Project *project) const
{
  return new Boost::Config(project);
}

TQValueList<const Device::Data *> Boost::Group::getSupportedDevices(const TQString &) const
{
  TQValueList<const Device::Data *> list;
  TQValueVector<TQString> devices = Device::lister().group("pic")->supportedDevices();
  for (uint i=0; i<devices.count(); i++) {
    const Device::Data *data = Device::lister().data(devices[i]);
    if ( supportedArchitecture(static_cast<const Pic::Data *>(data)->architecture()) ) list.append(data);
  }
  return list;
}