
committed by
CMake Topic Stage

20 changed files with 415 additions and 4 deletions
-
5Help/release/dev/vs-nasm.rst
-
8Modules/CMakeDetermineASMCompiler.cmake
-
17Modules/CMakeDetermineASM_NASMCompiler.cmake
-
14Source/cmGlobalVisualStudio10Generator.cxx
-
2Source/cmGlobalVisualStudio10Generator.h
-
1Source/cmGlobalVisualStudio7Generator.cxx
-
2Source/cmGlobalVisualStudio7Generator.h
-
50Source/cmVS10NASMFlagTable.h
-
105Source/cmVisualStudio10TargetGenerator.cxx
-
9Source/cmVisualStudio10TargetGenerator.h
-
1Source/cmVisualStudio10ToolsetOptions.cxx
-
1Source/cmVisualStudioGeneratorOptions.h
-
17Templates/MSBuild/nasm.props.in
-
41Templates/MSBuild/nasm.targets
-
110Templates/MSBuild/nasm.xml
-
7Tests/CMakeLists.txt
-
10Tests/VSNASM/CMakeLists.txt
-
7Tests/VSNASM/foo.asm
-
7Tests/VSNASM/include/foo-proc.asm
-
5Tests/VSNASM/main.c
@ -0,0 +1,5 @@ |
|||
vs-nasm |
|||
------- |
|||
|
|||
* :ref:`Visual Studio Generators` for VS 2010 and above learned to support |
|||
the ``ASM_NASM`` language when ``nasm`` is installed. |
@ -0,0 +1,50 @@ |
|||
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 } |
|||
}; |
@ -0,0 +1,17 @@ |
|||
<?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> |
@ -0,0 +1,41 @@ |
|||
<?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->'%(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->Metadata('OutputFormat')->Distinct()->ClearMetadata())" Condition="'%(NASM.ExcludedFromBuild)' != 'true'"/> |
|||
<Lib Include="@(NASM->Metadata('OutputFormat')->Distinct()->ClearMetadata())" Condition="'%(NASM.ExcludedFromBuild)' != 'true'"/> |
|||
</ItemGroup> |
|||
</Target> |
|||
</Project> |
@ -0,0 +1,110 @@ |
|||
<?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 "[value]""/> |
|||
<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 "[value]""/> |
|||
<StringListProperty Name="IncludePaths" Category="General" DisplayName="Include Paths" Description="Sets path for include file. (-I[path])" HelpUrl="http://www.nasm.us/doc/" Switch="-I"[value]""/> |
|||
<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> |
@ -0,0 +1,10 @@ |
|||
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) |
@ -0,0 +1,7 @@ |
|||
section .text |
|||
%ifdef TEST2x64 |
|||
global foo |
|||
%else |
|||
global _foo |
|||
%endif |
|||
%include "foo-proc.asm" |
@ -0,0 +1,7 @@ |
|||
%ifdef TESTx64 |
|||
foo: |
|||
%else |
|||
_foo: |
|||
%endif |
|||
mov eax, 0 |
|||
ret |
@ -0,0 +1,5 @@ |
|||
extern int foo(void); |
|||
int main(void) |
|||
{ |
|||
return foo(); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue