Notes |
|
(0021760)
|
Alex Neundorf
|
2010-08-15 11:50
|
|
Thanks for your patch.
A few questions still.
On Linux, nasm -v prints "NASM version 0.98.39 compiled on Feb 6 2006".
Does this work also on Windows and Mac ?
Does "nasm -h" work on all platforms ?
Here on Linux the output contains "usage: nasm [-@ response file]".
Does this look the same on all platforms ?
Or does it contain on Windows "nasm.exe" ?
Alex |
|
|
(0021761)
|
Peter Collingbourne
|
2010-08-15 12:51
|
|
Hi Alex,
I tested the commands you mentioned on Windows and they all work the same as on Linux. "nasm -v" is the same, "nasm -h" always prints "nasm" (this appears to be hard coded in the nasm source code). I don't have access to a Mac any more so I can't test there, but I can't see any reason why those commands wouldn't work there.
I assume you are planning to expand the patch to add support for version detection and response files? Perhaps that should be a separate patch.
Thanks,
Peter |
|
|
(0022347)
|
Alex Neundorf
|
2010-09-25 15:05
|
|
I just merged this into the git next branch of cmake.
Please give it a try and let me know if there are issues.
Alex
|
|
|
(0022533)
|
kwtc
|
2010-10-19 09:11
|
|
Once this patch is integrated, does it allow to specify that the compiler to use should be YASM instead of NASM ? Otherwise perhaps we should also add the same patch for the YASM assembler at the same time.
YASM is a rewrite of NASM. |
|
|
(0022552)
|
kwtc
|
2010-10-21 05:46
|
|
I installed the patch and modified my CMakeLists.txt as follow :
enable_language(ASM_NASM)
set(CMAKE_ASM_NASM_COMPILER "yasm")
The compiler used for .nasm files is then yasm.
I still have two issues :
* How do I link .asm file to this compiler
* How do I disable C flags for this compiler
In my CMakeLists.txt I have
add_definitions(-Wall -Wextra ...)
and these flags get forwarded to the nasm/yasm compiler. |
|
|
(0022652)
|
Alex Neundorf
|
2010-10-21 15:02
|
|
Please give the attached nasm.patch a try.
It now also searches for yasm, and the C flags shouldn't make it anymore to its command line.
Also asm files should now be used automatically.
You can also get it directly from git, it's the AddASM_NASMSupport branch here:
http://cmake.org/gitweb?p=stage/cmake.git [^]
Alex |
|
|
(0022660)
|
kwtc
|
2010-10-22 10:14
(edited on: 2010-10-22 10:15) |
|
Thanks for the quick reply !
Indeed, *.asm files are now handled by NASM.
Moreover, if NASM is not installed, YASM is automatically used. Command
set(CMAKE_ASM_NASM_COMPILER yasm) still works to force YASM if both compilers are installed. As a side note, find_path(CMAKE_ASM_NASM_COMPILER yasm) does fill the variable with '/usr/bin/yasm' but for some reason, it sets it "differently" than the set command since it does not get propagated.
The C flags does no longer make it to the command line but the <CMAKE_ASM_NASM_CFLAGS> in CMakeASM_NASMInformation.cmake does not get replaced; using verbose makefile I get the following command line :
/usr/bin/yasm CMAKE_ASM_NASM_CFLAGS -f elf -o AsmFilePath.asm.o AsmFilePath.asm
I have tried various things to get this variable replaced but failed.
|
|
|
(0022663)
|
Alex Neundorf
|
2010-10-22 13:53
|
|
> As a side note, find_path(CMAKE_ASM_NASM_COMPILER yasm) does fill the
> variable with '/usr/bin/yasm' but for some reason, it sets it "differently"
> than the set command since it does not get propagated.
Sorry, I don't understand. What do you mean ?
find_program() finds the file with the full path, that's how it is supposed to be.
> /usr/bin/yasm CMAKE_ASM_NASM_CFLAGS -f elf -o AsmFilePath.asm.o
> AsmFilePath.asm
I'll have a closer look next week.
Until then you can just remove it from the CMakeASM_NASMInformation.cmake file.
Alex |
|
|
(0022812)
|
kwtc
|
2010-11-03 02:21
|
|
About my sidenote on CMAKE_ASM_NASM_COMPILER :
With the following code :
find_program(CMAKE_ASM_NASM_COMPILER, yasm)
message("Compiler is ${CMAKE_ASM_NASM_COMPILER)")
I do see the message 'Compiler is /usr/bin/yasm', a cache variable is created but the compiler used is /usr/bin/nasm.
With the following code :
find_program(CMAKE_ASM_NASM_COMPILER_PATH, yasm)
message("Compiler is ${CMAKE_ASM_NASM_COMPILER_PATH)")
set(CMAKE_ASM_NAME_COMPILER ${CMAKE_ASM_NASM_COMPILER_PATH})
I see the same message, a cache variable named CMAKE_ASM_NASM_COMPILER_PATH is created with value '/usr/bin/yasm', a cache variable named CMAKE_ASM_NASM_COMPILER is created with value '/usr/bin/nasm' and in the end, it is the yasm compiler which is used.
This is most certainly not a bug but an unexpected interaction between cache and non cache variables and the automatic detection of compilers. It is not a problem for me, I had just mentionned it as a sidenote. Now that I've explained what I have seen, you can ignore it ! |
|
|
(0023110)
|
Alex Neundorf
|
2010-11-09 15:59
|
|
Ok, so it is working for you now ?
Then I'll merge this into the main cmake branch.
Alex |
|
|
(0023123)
|
kwtc
|
2010-11-10 04:50
|
|
I am uploading a new patch with the following modifications :
1. I reverted <CMAKE_ASM_NASM_CFLAGS> back to <FLAGS>.
2. Added an 'if (NOT CMAKE_ASM_NASM_FORMAT_OBJECT)' to let the user select a different output format if the default value selected is not suitable.
Regards,
Étienne
Note for users of this patch :
All compilation flags get forwarded to the NASM/YASM compiler but it looks like it is the behavior for the other languages supported by cmake. It seems to be up to the user to take care of setting C compilation flags only for C files when mixing more than one language.
For example :
foreach (SOURCE ${SOURCES})
if (NOT ${SOURCE} MATCHES "asm$")
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS " -g -Wall -Wextra")
endif()
endforeach() |
|
|
(0023125)
|
kwtc
|
2010-11-10 05:05
(edited on: 2010-11-10 05:06) |
|
Please forgive me, my patch is not as complete as yours, it includes only the three new files for NASM support.
I also forgot to mention that with this new patch, it does work perfectly.
|
|
|
(0023359)
|
Alex Neundorf
|
2010-11-17 17:08
|
|
I merged this into the next branch now.
Please give it a try.
If something doesn't work, feel free to open a new bug or to reopen this one.
Alex
|
|