Add an example that builds .asm files #118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#117 fixed a bug in
ASM_MASM
usage - the Windows SDK's include paths should be added for theASM_MASM
language, so that.asm
files can correctly find MASM.inc
files that are shipped in the Windows SDK. This PR adds an 'example', so that it shows that things work, and makes sure that there's no regressions.This change adds an 'example/CommandLineAsm' folder, with a simple example. A single function -
CallAsmCode
- is implemented in assembly. It takes no parameters, and returns the value42
. And there's a 'main' that calls the function and prints out the value. I've added implementations forASM_MASM
(on X86 and AMD64), and I've added an example forASM_MARMASM
, which is used on ARM64. But the ARM64 example is a little broken. The ARM64 include files (for examplekxarm64.h
) contain C-pre-processor directives that theASM_MARMASM
assembly doesn't support, because the headers expect the assembly files to have been pre-processed by a C preprocessor first. Looking at the Visual Studio support for MARMASM (in, say,MSBuild\Microsoft\VC\v170\BuildCustomizations\marmasm.props
andMSBuild\Microsoft\VC\v170\BuildCustomizations\marmasm.targets
) shows the invocation of the Cl pre-processor first. But with a non-Visual Studio generator, the CMake logic just runs the ARM assembler, without running, say, $(CMAKE_C_COMPILER). I don't know of a way to 'fix' this from a WindowsToolchain level - it seems to be a gap in the CMake support forASM_MARMASM
. With all that being said, I could be missing something. Does anyone have any insights that could shed some light here?Tagging @waldnercharles (who filed #115) and @paulfd (who fixed #115 with #117), in case they have any ideas.