Commit 5ba2c9e5 authored by Evgeny Fimochkin's avatar Evgeny Fimochkin Committed by Brad King

VS: Add support for ASM_NASM language

Fixes: #16469
parent 0f4dae0a
vs-nasm
-------
* :ref:`Visual Studio Generators` for VS 2010 and above learned to support
the ``ASM_NASM`` language when ``nasm`` is installed.
......@@ -92,6 +92,14 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS NASM)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_NASM "-v")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_NASM "(NASM version)")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS YASM)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_YASM "--version")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_YASM "(yasm)")
include(CMakeDetermineCompilerId)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
......
......@@ -7,8 +7,21 @@
set(CMAKE_ASM_NASM_COMPILER_LIST nasm yasm)
if(NOT CMAKE_ASM_NASM_COMPILER)
find_program(CMAKE_ASM_NASM_COMPILER nasm
"$ENV{ProgramFiles}/NASM")
set(_CMAKE_ENV_VARX86 "ProgramFiles(x86)")
set(_CMAKE_ASM_NASM_COMPILER_PATHS
"[HKEY_CURRENT_USER\\SOFTWARE\\nasm]"
"$ENV{ProgramFiles}/NASM"
"$ENV{${ENV_VARX86}}/NASM"
"$ENV{LOCALAPPDATA}/NASM"
)
find_program(CMAKE_ASM_NASM_COMPILER
NAMES ${CMAKE_ASM_NASM_COMPILER_LIST}
PATHS ${_CMAKE_ASM_NASM_COMPILER_PATHS}
NO_DEFAULT_PATH
DOC "NASM compiler"
)
unset(_CMAKE_ENV_VARX86)
unset(_CMAKE_ASM_NASM_COMPILER_PATHS)
endif()
# Load the generic DetermineASM compiler file with the DIALECT set properly:
......
......@@ -13,6 +13,7 @@
#include "cmVS10LibFlagTable.h"
#include "cmVS10LinkFlagTable.h"
#include "cmVS10MASMFlagTable.h"
#include "cmVS10NASMFlagTable.h"
#include "cmVS10RCFlagTable.h"
#include "cmVisualStudioSlnData.h"
#include "cmVisualStudioSlnParser.h"
......@@ -113,6 +114,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
this->DefaultLibFlagTable = cmVS10LibFlagTable;
this->DefaultLinkFlagTable = cmVS10LinkFlagTable;
this->DefaultMasmFlagTable = cmVS10MASMFlagTable;
this->DefaultNasmFlagTable = cmVS10NASMFlagTable;
this->DefaultRcFlagTable = cmVS10RCFlagTable;
this->Version = VS10;
}
......@@ -354,6 +356,13 @@ void cmGlobalVisualStudio10Generator::Generate()
void cmGlobalVisualStudio10Generator::EnableLanguage(
std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
{
for (std::vector<std::string>::const_iterator it = lang.begin();
it != lang.end(); ++it) {
if (*it == "ASM_NASM") {
this->NasmEnabled = true;
}
}
this->AddPlatformDefinitions(mf);
cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
}
......@@ -663,3 +672,8 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const
return (table != CM_NULLPTR) ? table : this->DefaultMasmFlagTable;
}
cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetNasmFlagTable() const
{
return this->DefaultNasmFlagTable;
}
......@@ -96,6 +96,7 @@ public:
cmIDEFlagTable const* GetLibFlagTable() const;
cmIDEFlagTable const* GetLinkFlagTable() const;
cmIDEFlagTable const* GetMasmFlagTable() const;
cmIDEFlagTable const* GetNasmFlagTable() const;
protected:
virtual void Generate();
......@@ -125,6 +126,7 @@ protected:
cmIDEFlagTable const* DefaultLibFlagTable;
cmIDEFlagTable const* DefaultLinkFlagTable;
cmIDEFlagTable const* DefaultMasmFlagTable;
cmIDEFlagTable const* DefaultNasmFlagTable;
cmIDEFlagTable const* DefaultRcFlagTable;
bool SystemIsWindowsCE;
bool SystemIsWindowsPhone;
......
......@@ -47,6 +47,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
this->IntelProjectVersion = 0;
this->DevEnvCommandInitialized = false;
this->MasmEnabled = false;
this->NasmEnabled = false;
if (platformName.empty()) {
this->DefaultPlatformName = "Win32";
......
......@@ -95,6 +95,7 @@ public:
/** Is the Microsoft Assembler enabled? */
bool IsMasmEnabled() const { return this->MasmEnabled; }
bool IsNasmEnabled() const { return this->NasmEnabled; }
// Encoding for Visual Studio files
virtual std::string Encoding();
......@@ -163,6 +164,7 @@ protected:
std::string GeneratorPlatform;
std::string DefaultPlatformName;
bool MasmEnabled;
bool NasmEnabled;
private:
char* IntelProjectVersion;
......
static cmVS7FlagTable cmVS10NASMFlagTable[] = {
// Enum Properties
{ "Outputswitch", "fwin32", "", "0", 0 },
{ "Outputswitch", "fwin", "", "0", 0 },
{ "Outputswitch", "fwin64", "", "1", 0 },
{ "Outputswitch", "felf", "", "2", 0 },
{ "Outputswitch", "felf32", "", "2", 0 },
{ "Outputswitch", "felf64", "", "3", 0 },
{ "ErrorReportingFormat", "Xgnu", "", "-Xgnu GNU format: Default format",
0 },
{ "ErrorReportingFormat", "Xvc", "",
"-Xvc Style used by Microsoft Visual C++", 0 },
// Bool Properties
{ "TreatWarningsAsErrors", "Werror", "", "true", 0 },
{ "GenerateDebugInformation", "g", "", "true", 0 },
{ "floatunderflow", "w+float-underflow", "", "true", 0 },
{ "macrodefaults", "w-macro-defaults", "", "true", 0 },
{ "user", "w-user", "%warning directives (default on)", "true", 0 },
{ "floatoverflow", "w-float-overflow", "", "true", 0 },
{ "floatdenorm", "w+float-denorm", "", "true", 0 },
{ "numberoverflow", "w-number-overflow", "", "true", 0 },
{ "macroselfref", "w+macro-selfref", "", "true", 0 },
{ "floattoolong", "w-float-toolong", "", "true", 0 },
{ "orphanlabels", "w-orphan-labels", "", "true", 0 },
{ "tasmmode", "t", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
{ "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
{ "UndefinePreprocessorDefinitions", "U",
"Undefine Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
{ "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
{ "AssembledCodeListingFile", "l",
"Generates an assembled code listing file.", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// String Properties
// Skip [Inputs] - no command line Switch.
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
};
......@@ -10,6 +10,7 @@
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
#include "cmVisualStudioGeneratorOptions.h"
#include "windows.h"
......@@ -207,6 +208,9 @@ void cmVisualStudio10TargetGenerator::Generate()
if (!this->ComputeMasmOptions()) {
return;
}
if (!this->ComputeNasmOptions()) {
return;
}
if (!this->ComputeLinkOptions()) {
return;
}
......@@ -454,6 +458,21 @@ void cmVisualStudio10TargetGenerator::Generate()
"BuildCustomizations\\masm.props\" />\n",
2);
}
if (this->GlobalGenerator->IsNasmEnabled()) {
// Always search in the standard modules location.
std::string propsTemplate =
GetCMakeFilePath("Templates/MSBuild/nasm.props.in");
std::string propsLocal;
propsLocal += this->DefaultArtifactDir;
propsLocal += "\\nasm.props";
this->ConvertToWindowsSlash(propsLocal);
this->Makefile->ConfigureFile(propsTemplate.c_str(), propsLocal.c_str(),
false, true, true);
std::string import = std::string("<Import Project=\"") +
cmVS10EscapeXML(propsLocal) + "\" />\n";
this->WriteString(import.c_str(), 2);
}
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
{
......@@ -509,6 +528,13 @@ void cmVisualStudio10TargetGenerator::Generate()
"BuildCustomizations\\masm.targets\" />\n",
2);
}
if (this->GlobalGenerator->IsNasmEnabled()) {
std::string nasmTargets =
GetCMakeFilePath("Templates/MSBuild/nasm.targets");
std::string import = "<Import Project=\"";
import += cmVS10EscapeXML(nasmTargets) + "\" />\n";
this->WriteString(import.c_str(), 2);
}
this->WriteString("</ImportGroup>\n", 1);
if (csproj == this->ProjectType) {
for (std::vector<std::string>::const_iterator i =
......@@ -1719,6 +1745,8 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
tool = "ClCompile";
} else if (lang == "ASM_MASM" && this->GlobalGenerator->IsMasmEnabled()) {
tool = "MASM";
} else if (lang == "ASM_NASM" && this->GlobalGenerator->IsNasmEnabled()) {
tool = "NASM";
} else if (lang == "RC") {
tool = "ResourceCompile";
} else if (lang == "CSharp") {
......@@ -2431,6 +2459,71 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions(
this->WriteString("</MASM>\n", 2);
}
bool cmVisualStudio10TargetGenerator::ComputeNasmOptions()
{
if (!this->GlobalGenerator->IsNasmEnabled()) {
return true;
}
for (std::vector<std::string>::const_iterator i =
this->Configurations.begin();
i != this->Configurations.end(); ++i) {
if (!this->ComputeNasmOptions(*i)) {
return false;
}
}
return true;
}
bool cmVisualStudio10TargetGenerator::ComputeNasmOptions(
std::string const& configName)
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::NasmCompiler, gg->GetNasmFlagTable()));
Options& nasmOptions = *pOptions;
std::string CONFIG = cmSystemTools::UpperCase(configName);
std::string configFlagsVar = std::string("CMAKE_ASM_NASM_FLAGS_") + CONFIG;
std::string flags =
std::string(this->Makefile->GetSafeDefinition("CMAKE_ASM_NASM_FLAGS")) +
std::string(" -f") + std::string(this->Makefile->GetSafeDefinition(
"CMAKE_ASM_NASM_OBJECT_FORMAT")) +
std::string(" ") +
std::string(this->Makefile->GetSafeDefinition(configFlagsVar));
nasmOptions.Parse(flags.c_str());
this->NasmOptions[configName] = pOptions.release();
return true;
}
void cmVisualStudio10TargetGenerator::WriteNasmOptions(
std::string const& configName, std::vector<std::string> includes)
{
if (!this->GlobalGenerator->IsNasmEnabled()) {
return;
}
this->WriteString("<NASM>\n", 2);
Options& nasmOptions = *(this->NasmOptions[configName]);
for (size_t i = 0; i < includes.size(); i++) {
includes[i] += "\\";
}
nasmOptions.AppendFlag("IncludePaths", includes);
nasmOptions.AppendFlag("IncludePaths", "%(IncludePaths)");
nasmOptions.OutputFlagMap(*this->BuildFileStream, " ");
nasmOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
nasmOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "ASM_NASM");
// Preprocessor definitions and includes are shared with clOptions.
Options& clOptions = *(this->ClOptions[configName]);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "ASM_NASM");
this->WriteString("</NASM>\n", 2);
}
void cmVisualStudio10TargetGenerator::WriteLibOptions(
std::string const& config)
{
......@@ -3062,6 +3155,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
// output rc compile flags <ResourceCompile></ResourceCompile>
this->WriteRCOptions(*i, includes);
this->WriteMasmOptions(*i, includes);
this->WriteNasmOptions(*i, includes);
}
// output midl flags <Midl></Midl>
this->WriteMidlOptions(*i, includes);
......@@ -3988,3 +4082,14 @@ bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
CloseHandle(h);
return true;
}
std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
const char* relativeFilePath) const
{
// Always search in the standard modules location.
std::string path = cmSystemTools::GetCMakeRoot() + "/";
path += relativeFilePath;
this->ConvertToWindowsSlash(path);
return path;
}
......@@ -51,7 +51,7 @@ private:
};
std::string ConvertPath(std::string const& path, bool forceRelative);
void ConvertToWindowsSlash(std::string& s);
static void ConvertToWindowsSlash(std::string& s);
void WriteString(const char* line, int indentLevel);
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
......@@ -102,6 +102,11 @@ private:
bool ComputeMasmOptions(std::string const& config);
void WriteMasmOptions(std::string const& config,
std::vector<std::string> const& includes);
bool ComputeNasmOptions();
bool ComputeNasmOptions(std::string const& config);
void WriteNasmOptions(std::string const& config,
std::vector<std::string> includes);
bool ComputeLinkOptions();
bool ComputeLinkOptions(std::string const& config);
bool ComputeLibOptions();
......@@ -146,6 +151,7 @@ private:
OptionsMap ClOptions;
OptionsMap RcOptions;
OptionsMap MasmOptions;
OptionsMap NasmOptions;
OptionsMap LinkOptions;
std::string PathToProjectFile;
std::string ProjectFileExtension;
......@@ -177,6 +183,7 @@ private:
typedef std::map<std::string, ToolSources> ToolSourceMap;
ToolSourceMap Tools;
std::string GetCMakeFilePath(const char* name) const;
};
#endif
......@@ -11,6 +11,7 @@
#include "cmVS10LibFlagTable.h"
#include "cmVS10LinkFlagTable.h"
#include "cmVS10MASMFlagTable.h"
#include "cmVS10NASMFlagTable.h"
#include "cmVS10RCFlagTable.h"
#include "cmVS11CLFlagTable.h"
#include "cmVS11CSharpFlagTable.h"
......
......@@ -27,6 +27,7 @@ public:
Compiler,
ResourceCompiler,
MasmCompiler,
NasmCompiler,
Linker,
FortranCompiler,
CSharpCompiler
......
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(NASMBeforeTargets)' == '' and '$(NASMAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<NASMBeforeTargets>Midl</NASMBeforeTargets>
<NASMAfterTargets>CustomBuild</NASMAfterTargets>
</PropertyGroup>
<ItemDefinitionGroup>
<NASM>
<OutputFormat>$(IntDir)%(FileName).obj</OutputFormat>
<Outputswitch>0</Outputswitch>
<CompilerNasm>@CMAKE_ASM_NASM_COMPILER@</CompilerNasm>
<PackAlignmentBoundary>0</PackAlignmentBoundary>
<CommandLineTemplate>"%(CompilerNasm)" [AllOptions] [AdditionalOptions] "%(FullPath)"</CommandLineTemplate>
<ExecutionDescription>Assembling %(Filename)%(Extension)</ExecutionDescription>
</NASM>
</ItemDefinitionGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml"/>
<AvailableItemName Include="NASM">
<Targets>_NASM</Targets>
</AvailableItemName>
</ItemGroup>
<PropertyGroup>
<ComputeLinkInputsTargets>
$(ComputeLinkInputsTargets);
ComputeNASMOutput;
</ComputeLinkInputsTargets>
<ComputeLibInputsTargets>
$(ComputeLibInputsTargets);
ComputeNASMOutput;
</ComputeLibInputsTargets>
</PropertyGroup>
<UsingTask TaskName="NASM" TaskFactory="XamlTaskFactory" AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<Target Name="_NASM" BeforeTargets="$(NASMBeforeTargets)" AfterTargets="$(NASMAfterTargets)" Condition="'@(NASM)' != ''" Outputs="%(NASM.OutputFormat)" Inputs="%(NASM.Identity);%(NASM.AdditionalDependencies);$(MSBuildProjectFile)" DependsOnTargets="_SelectedFiles">
<ItemGroup Condition="'@(SelectedFiles)' != ''">
<NASM Remove="@(NASM)" Condition="'%(Identity)' != '@(SelectedFiles)'"/>
</ItemGroup>
<ItemGroup>
<NASM_tlog Include="%(NASM.OutputFormat)" Condition="'%(NASM.OutputFormat)' != '' and '%(NASM.ExcludedFromBuild)' != 'true'">
<Source>@(NASM, '|')</Source>
</NASM_tlog>
</ItemGroup>
<Message Importance="High" Text="%(NASM.ExecutionDescription)"/>
<WriteLinesToFile Condition="'@(NASM_tlog)' != '' and '%(NASM_tlog.ExcludedFromBuild)' != 'true'" File="$(IntDir)$(ProjectName).write.1.tlog" Lines="^%(NASM_tlog.Source);@(NASM_tlog-&gt;'%(Fullpath)')"/>
<NASM Condition="'@(NASM)' != '' and '%(NASM.ExcludedFromBuild)' != 'true'" Inputs="%(NASM.Inputs)" OutputFormat="%(NASM.OutputFormat)" Outputswitch="%(NASM.Outputswitch)" AssembledCodeListingFile="%(NASM.AssembledCodeListingFile)" GenerateDebugInformation="%(NASM.GenerateDebugInformation)" ErrorReporting="%(NASM.ErrorReporting)" IncludePaths="%(NASM.IncludePaths)" PreprocessorDefinitions="%(NASM.PreprocessorDefinitions)" UndefinePreprocessorDefinitions="%(NASM.UndefinePreprocessorDefinitions)" ErrorReportingFormat="%(NASM.ErrorReportingFormat)" TreatWarningsAsErrors="%(NASM.TreatWarningsAsErrors)" floatunderflow="%(NASM.floatunderflow)" macrodefaults="%(NASM.macrodefaults)" user="%(NASM.user)" floatoverflow="%(NASM.floatoverflow)" floatdenorm="%(NASM.floatdenorm)" numberoverflow="%(NASM.numberoverflow)" macroselfref="%(NASM.macroselfref)" floattoolong="%(NASM.floattoolong)" orphanlabels="%(NASM.orphanlabels)" CommandLineTemplate="%(NASM.CommandLineTemplate)" AdditionalOptions="%(NASM.AdditionalOptions)"/>
</Target>
<Target Name="ComputeNASMOutput" Condition="'@(NASM)' != ''">
<ItemGroup>
<Link Include="@(NASM-&gt;Metadata('OutputFormat')-&gt;Distinct()-&gt;ClearMetadata())" Condition="'%(NASM.ExcludedFromBuild)' != 'true'"/>
<Lib Include="@(NASM-&gt;Metadata('OutputFormat')-&gt;Distinct()-&gt;ClearMetadata())" Condition="'%(NASM.ExcludedFromBuild)' != 'true'"/>
</ItemGroup>
</Target>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Rule Name="NASM" PageTemplate="tool" DisplayName="Netwide Assembler" Order="200">
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="NASM"/>
</Rule.DataSource>
<Rule.Categories>
<Category Name="General">
<Category.DisplayName>
<sys:String>General</sys:String>
</Category.DisplayName>
</Category>
<Category Name="Preprocessor">
<Category.DisplayName>
<sys:String>Preprocessing Options</sys:String>
</Category.DisplayName>
</Category>
<Category Name="Assembler Options">
<Category.DisplayName>
<sys:String>Assembler Options</sys:String>
</Category.DisplayName>
</Category>
<Category Name="Advanced">
<Category.DisplayName>
<sys:String>Advanced </sys:String>
</Category.DisplayName>
</Category>
<Category Name="Command Line" Subtype="CommandLine">
<Category.DisplayName>
<sys:String>Command Line</sys:String>
</Category.DisplayName>
</Category>
</Rule.Categories>
<StringProperty Name="Inputs" Category="Command Line" IsRequired="true">
<StringProperty.DataSource>
<DataSource Persistence="ProjectFile" ItemType="NASM" SourceType="Item"/>
</StringProperty.DataSource>
</StringProperty>
<StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o [value]"/>
<BoolProperty Name="tasmmode" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="SciTech TASM compatible mode" Description="assemble in SciTech TASM compatible mode" Switch="-t"/>
<EnumProperty Name="Outputswitch" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output Switch" Description="Select the type of output format required. Linking Should be disabled for ELF and Binary ,else error will popup">
<EnumValue Name="0" DisplayName="Object File win32" Switch="-fwin32"/>
<EnumValue Name="1" DisplayName="Object File win64" Switch="-fwin64"/>
<EnumValue Name="2" DisplayName="ELF32 (i386) object files (e.g. Linux)" Switch="-felf32"/>
<EnumValue Name="3" DisplayName="ELF64 (x86_64) object files (e.g. Linux)" Switch="-felf64"/>
</EnumProperty>
<StringListProperty Name="AssembledCodeListingFile" Category="Assembler Options" DisplayName="Assembled Code Listing File" Description="Generates an assembled code listing file. (-l [file])" HelpUrl="http://www.nasm.us/doc/" Switch="-l &quot;[value]&quot;"/>
<BoolProperty Name="GenerateDebugInformation" Category="Assembler Options" DisplayName="Generate Debug Information" Description="Generates Debug Information. (-g)" HelpUrl="http://www.nasm.us/doc/" Switch="-g"/>
<StringListProperty Name="ErrorReporting" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Redirect Error Messages to File" Description="Drops the error Message on specified device" Switch="-Z &quot;[value]&quot;"/>
<StringListProperty Name="IncludePaths" Category="General" DisplayName="Include Paths" Description="Sets path for include file. (-I[path])" HelpUrl="http://www.nasm.us/doc/" Switch="-I&quot;[value]&quot;"/>
<StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name. (-D[symbol])" Switch="-D[value]"/>
<StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name. (-U[symbol])" Switch="-U[value]"/>
<EnumProperty Name="ErrorReportingFormat" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Error Reporting Format" Description="Select the error reporting format ie. GNU or VC">
<EnumValue Name="0" DisplayName="-Xgnu GNU format: Default format" Switch="-Xgnu"/>
<EnumValue Name="1" DisplayName="-Xvc Style used by Microsoft Visual C++" Switch="-Xvc"/>
</EnumProperty>
<BoolProperty Name="TreatWarningsAsErrors" Category="Assembler Options" DisplayName="Treat Warnings As Errors" Description="Returns an error code if warnings are generated. (-Werror)" HelpUrl="http://www.nasm.us/doc/" Switch="-Werror"/>
<BoolProperty Name="floatunderflow" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="float-underflow" Description="floating point underflow (default off)" Switch="-w+float-underflow"/>
<BoolProperty Name="macrodefaults" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Disable macro-defaults" Description="macros with more default than optional parameters (default on)" Switch="-w-macro-defaults"/>
<BoolProperty Name="user" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Disable user" Description="%warning directives (default on)" Switch="-w-user"/>
<BoolProperty Name="floatoverflow" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Disable float-overflow" Description="floating point overflow (default on)" Switch="-w-float-overflow"/>
<BoolProperty Name="floatdenorm" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="float-denorm" Description="floating point denormal (default off)" Switch="-w+float-denorm"/>
<BoolProperty Name="numberoverflow" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Disable number-overflow" Description="numeric constant does not fit (default on)" Switch="-w-number-overflow"/>
<BoolProperty Name="macroselfref" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="macro-selfref" Description="cyclic macro references (default off)" Switch="-w+macro-selfref"/>
<BoolProperty Name="floattoolong" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Disable float-toolong" Description=" too many digits in floating-point number (default on)" Switch="-w-float-toolong"/>
<BoolProperty Name="orphanlabels" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Disable orphan-labels" Description="labels alone on lines without trailing `:' (default on)" Switch="-w-orphan-labels"/>
<StringProperty Name="CommandLineTemplate" DisplayName="Command Line" Visible="False" IncludeInCommandLine="False"/>
<DynamicEnumProperty Name="NASMBeforeTargets" Category="General" EnumProvider="Targets" IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute Before</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair Name="Exclude" Value="^NASMBeforeTargets|^Compute"/>
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" HasConfigurationCondition="true"/>
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<DynamicEnumProperty Name="NASMAfterTargets" Category="General" EnumProvider="Targets" IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute After</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair Name="Exclude" Value="^NASMAfterTargets|^Compute"/>
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" HasConfigurationCondition="true"/>
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<StringProperty Name="ExecutionDescription" DisplayName="Execution Description" IncludeInCommandLine="False" Visible="False"/>
<StringListProperty Name="AdditionalDependencies" DisplayName="Additional Dependencies" IncludeInCommandLine="False" Visible="False"/>
<StringProperty Subtype="AdditionalOptions" Name="AdditionalOptions" Category="Command Line">
<StringProperty.DisplayName>
<sys:String>Additional Options</sys:String>
</StringProperty.DisplayName>
<StringProperty.Description>
<sys:String>Additional Options</sys:String>
</StringProperty.Description>
</StringProperty>
</Rule>
<ItemType Name="NASM" DisplayName="Netwide Assembler"/>
<FileExtension Name="*.asm" ContentType="NASM"/>
<ContentType Name="NASM" DisplayName="Netwide Assembler" ItemType="NASM"/>
</ProjectSchemaDefinitions>
......@@ -2043,7 +2043,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]")
select_wince_sdk(reg_wince wince_sdk)
set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]")
foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra)
set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]")
foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm)
get_filename_component(r "${reg_${reg}}" ABSOLUTE)
if(IS_DIRECTORY "${r}")
set(${reg} 1)
......@@ -2134,6 +2135,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio ([^789]|[789][0-9])" AND nasm)
ADD_TEST_MACRO(VSNASM VSNASM)
endif()
if (CMake_TEST_GreenHillsMULTI)
macro(add_test_GhsMulti name primaryTarget bspName)
add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND}
......
cmake_minimum_required(VERSION 2.8.12)
project(VSNASM C ASM_NASM)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DTESTx64)
string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64")
else()
add_definitions(-DTESTi386)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_executable(VSNASM main.c foo.asm)
section .text
%ifdef TEST2x64
global foo
%else
global _foo
%endif
%include "foo-proc.asm"
%ifdef TESTx64
foo:
%else
_foo:
%endif
mov eax, 0
ret
extern int foo(void);
int main(void)
{
return foo();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment