if(type!=native_arch.type || system!=native_arch.system)
cross_prefix = format("%s-%s", type, system);
- else if(bits!=native_arch.bits)
- {
- build_info.cflags.push_back(format("-m%d", bits));
- build_info.ldflags.push_back(format("-m%d", bits));
- }
- else
+ else if(bits==native_arch.bits)
native = true;
-
- if(!cpu.empty())
- build_info.cflags.push_back(format("-march=%s", cpu));
}
name = type;
if(!cpu.empty())
bool native;
std::string cross_prefix;
StringMap tools;
- BuildInfo build_info;
public:
Architecture(Builder &b, const std::string &spec);
const std::string &get_name() const { return name; }
const std::string &get_system() const { return system; }
+ unsigned get_bits() const { return bits; }
+ const std::string &get_cpu() const { return cpu; }
bool match_name(const std::string &) const;
bool is_native() const { return native; }
std::string get_tool(const std::string &t) const;
const std::string &get_cross_prefix() const { return cross_prefix; }
- const BuildInfo &get_build_info() const { return build_info; }
-
private:
std::string resolve_alias(const std::string &) const;
void parse_specification(const std::string &);
#include <msp/fs/dir.h>
#include <msp/fs/utils.h>
+#include <msp/strings/format.h>
#include "builder.h"
#include "component.h"
#include "externaltask.h"
for(list<string>::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
argv.push_back("-D"+*i);
+ const Architecture &arch = builder.get_current_arch();
+ const Architecture &native_arch = builder.get_native_arch();
+ if(arch.get_bits()!=native_arch.get_bits())
+ argv.push_back(format("-m%d", arch.get_bits()));
+
+ const string &cpu = arch.get_cpu();
+ if(!cpu.empty())
+ argv.push_back("-march="+cpu);
+
FS::Path obj_path = object.get_path();
FS::Path src_path = object.get_source().get_path();
FS::Path work_dir = comp.get_package().get_source();
#include <vector>
#include <msp/fs/dir.h>
#include <msp/fs/utils.h>
+#include <msp/strings/format.h>
#include "builder.h"
#include "component.h"
#include "executable.h"
for(list<string>::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
argv.push_back("-L"+*i);
+ const Architecture &arch = builder.get_current_arch();
+ const Architecture &native_arch = builder.get_native_arch();
+ if(arch.get_bits()!=native_arch.get_bits())
+ argv.push_back(format("-m%d", arch.get_bits()));
+
FS::Path work_dir = comp.get_package().get_source();
argv.push_back("-o");
void SourcePackage::create_build_info()
{
- build_info.update_from(builder.get_current_arch().get_build_info());
-
// XXX Currently, a package-specific settings will override cmdline. This might or might not be desirable.
const StringList &warnings = builder.get_warnings();
build_info.warnings.insert(build_info.warnings.begin(), warnings.begin(), warnings.end());