Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example that builds .asm files #118

Merged
merged 2 commits into from
Nov 2, 2024
Merged

Add an example that builds .asm files #118

merged 2 commits into from
Nov 2, 2024

Conversation

MarkSchofield
Copy link
Owner

#117 fixed a bug in ASM_MASM usage - the Windows SDK's include paths should be added for the ASM_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 value 42. And there's a 'main' that calls the function and prints out the value. I've added implementations for ASM_MASM (on X86 and AMD64), and I've added an example for ASM_MARMASM, which is used on ARM64. But the ARM64 example is a little broken. The ARM64 include files (for example kxarm64.h) contain C-pre-processor directives that the ASM_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 and MSBuild\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 for ASM_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.

@paulfd
Copy link
Contributor

paulfd commented Nov 2, 2024

Sorry I don't have much experience in windows ASM at all... Seems like it could be a cmake thing to fix though. I know gcc runs preprocessor on .S files automatically.

@MarkSchofield MarkSchofield merged commit 8b0e6a4 into main Nov 2, 2024
17 checks passed
@MarkSchofield MarkSchofield deleted the mschofie/asm branch November 2, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add additional languages to CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES
2 participants