29 November 2019, 09:55 | #1 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
CMake and vasm
Are there any examples on how to write a cmake script to assemble a bunch of files into a binary?
Not sure if it is very different to create a project which consists only of assembler sources, versus a project which mixes gcc and also links assembler files. Using gcc is simple enough, but I haven't found any info on how to build vasm sources, so I'm currently looking into how to write my own modules for cmake and it would be nice if there already exists something like that. |
29 November 2019, 10:06 | #2 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,774
|
What exactly do you want to accomplish?
|
29 November 2019, 11:41 | #3 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Szenario 1:
Multiple asm files, built into an executable or library Szenario 2: gcc sources files mixed with asm source files. If I can build a library, then szenario 2 is probably obsolete, because then one could always build a library anyway. Also I guess, if I can build asm files I should also be able to integrate it into a gcc project as well. I wrote a small assembler source, and ocmpiled it manually, but I don't want to use this approach all the time. |
29 November 2019, 11:45 | #4 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
It has to be CMake? I do this with gnu make fairly easily.
|
29 November 2019, 11:56 | #5 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
I can also do it with makefile, but I would prefer cmake, as I also use this for gcc builds.
|
29 November 2019, 13:50 | #6 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
Here is my CMakeLists.txt for a small project that mixes gcc and asm which assembles with vasm
Code:
cmake_minimum_required(VERSION 3.13) project(make C ASM) set(CMAKE_C_FLAGS_MINSIZEREL "-Os") if (CMAKE_C_COMPILER STREQUAL "/opt/amiga/gcc6/bin/m68k-amigaos-gcc") #add_compile_options(-mcrt=nix13 -D_AMIGA -fbaserel -fomit-frame-pointer -msmall-code -Wall) #set(CMAKE_EXE_LINKER_FLAGS "-s -mcrt=nix13 -fbaserel -msmall-code" CACHE INTERNAL "" FORCE) add_compile_options(-mcrt=nix13 -fomit-frame-pointer -Wall) set(CMAKE_EXE_LINKER_FLAGS "-s -mcrt=nix13" CACHE INTERNAL "" FORCE) set(SRC_FILES file.c gomake.c make.c make.h reader.c mysystem.c system0.asm) set(XTRA_LIBS /opt/amiga/gcc6/m68k-amigaos/lib/libdebug.a) set(CMAKE_ASM_COMPILER /opt/amiga/gcc6/bin/vasmm68k_mot) set(CMAKE_ASM_FLAGS "-esc -nosym -kick1hunks -Fhunk") set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${CMAKE_ASM_FLAGS} -o <OBJECT> <SOURCE>") FIND_PROGRAM(CRANKER cranker_generic PATHS "/usr/local/bin") IF(CRANKER) SET(CRANKER_COMMAND ${CRANKER} -f ${CMAKE_CURRENT_BINARY_DIR}/make -o ${CMAKE_CURRENT_BINARY_DIR}/makec) SET(CRANKER_LS ls -l makec) ENDIF(CRANKER) ELSE() set(SRC_FILES file.c gomake.c make.c make.h reader.c mysystem.c) endif(CMAKE_C_COMPILER STREQUAL "/opt/amiga/gcc6/bin/m68k-amigaos-gcc") set(CMAKE_C_STANDARD 11) add_executable(make ${SRC_FILES}) target_link_libraries(make ${XTRA_LIBS}) include_directories(.) #add_custom_command(TARGET make POST_BUILD COMMAND ls -l make) add_custom_command(TARGET make POST_BUILD COMMAND ${CRANKER_COMMAND} COMMAND ls -l make COMMAND ${CRANKER_LS} ) #set(CMAKE_VERBOSE_MAKEFILE ON) |
29 November 2019, 13:55 | #7 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Thanks! Doesn't look so bad then.
Is your system0.asm a kind of crt0 startup code? |
29 November 2019, 14:01 | #8 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
|
29 November 2019, 23:06 | #9 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Thanks to your help, I finally managed to create cmake project with two source files.
I attached it, in case someting might find this usefull. This project is for pure asm, and wouldn't work with gcc, as it doesn't link the required libraries, so it's pretty bare bone. |
30 November 2019, 21:04 | #10 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
I uploaded the project now in github.
It includes the above sample project which uses vasm only files, and another which contains an example of gcc C++ mingling with a vasm module. https://github.com/skeetor/Amiga-programming-examples |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
If statements with Vasm | LaBodilsen | Coders. Asm / Hardware | 5 | 24 September 2019 17:55 |
Trying out vlink and vasm | cla | Coders. General | 2 | 30 September 2016 20:30 |
vasm and comments | xxxxx | Coders. Asm / Hardware | 10 | 03 February 2015 12:59 |
vasm question | marduk_kurios | Coders. Asm / Hardware | 7 | 14 February 2014 20:06 |
CMake for WinUAE | gilgamesh | request.UAE Wishlist | 1 | 08 February 2010 00:28 |
|
|