[英]How to set up a CMake cross-assembling toolchain for 6502 CPU (C64)?
I'm trying to set up a, as re-usable as possible, cmake build system for a Commodore 64/6502 cross-assembler called TMPx . 我正在尝试为一个名为TMPx的Commodore 64/6502交叉汇编程序设置一个尽可能可重用的cmake构建系统。
My questions are: 我的问题是:
tmpx
or TMPx.exe
executable and proper path, in various specified locations , depending on host platform? tmpx
或TMPx.exe
可执行文件和正确的路径,具体取决于主机平台?
./cmake/
modules listed below are such a search/find to be put in? ./cmake/
模块中的哪一个是这样的搜索/发现? cmake .
cmake .
detect and list the TMPX version, rather than showing : -- The
ASM_TMPX
compiler identification is unknown-
ASM_TMPX
编译器标识未知
Other than that, other advices and suggestions are greatly appreciated. 除此之外,非常感谢其他建议和建议。
(Here's my git repo with the files below) (这是我的git repo和下面的文件)
My ./CMakeLists.txt
我的
./CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
set(CMAKE_SYSTEM_NAME "C64")
set(CMAKE_SYSTEM_PROCESSOR 6502)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/cmake")
#TODO: Try to move this into one of the cmake/ modules..
SET(CMAKE_ASM_TMPX_COMPILER "${CMAKE_BINARY_DIR}/tools/TMPx_v1.1.0-STYLE/linux-x86_64/tmpx")
PROJECT(test001 ASM_TMPX)
By following this guide from the CMake wiki I've so far got the following cmake modules close to done and semi-working: 通过遵循CMake wiki的这个指南,我到目前为止已经完成了以下cmake模块的完成和半工作:
./cmake/CMakeASM_TMPXInformation.cmake
: ./cmake/CMakeASM_TMPXInformation.cmake
: SET(ASM_DIALECT "_TMPX")
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS ms;s;asm)
#Set any default arguments here
#TODO: remove the nasm args
IF(UNIX)
SET(CMAKE_ASM_TMPX_COMPILER_ARG1 "-f elf")
ELSE(UNIX)
SET(CMAKE_ASM_TMPX_COMPILER_ARG1 "-f win32")
ENDIF(UNIX)
# This section exists to override the one in CMakeASMInformation.cmake
# (the default Information file). This removes the <FLAGS>
# thing so that your C compiler flags that have been set via
# set_target_properties don't get passed to TMPx and confuse it.
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
#TODO: Change nasm args to correct tmpx arguments
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> -o <OBJECT> <SOURCE>")
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
INCLUDE(CMakeASMInformation)
SET(ASM_DIALECT)
./cmake/CMakeDetermineASM_TMPXCompiler.cmake
: ./cmake/CMakeDetermineASM_TMPXCompiler.cmake
: SET(ASM_DIALECT "_TMPX")
IF(UNIX)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}tmpx)
ENDIF()
# TODO: Properly determine exen for other host platforms
# (The Windows exe would be 'TMPx.exe' but possibly 'tmpx.exe' or 'TMPX.EXE')
INCLUDE(CMakeDetermineASMCompiler)
SET(ASM_DIALECT)
./cmake/CMakeTestASM_TMPXCompiler.cmake
: ./cmake/CMakeTestASM_TMPXCompiler.cmake
: ###
# From original template:
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that the selected ASM-ATT "compiler" works.
# For assembler this can only check whether the compiler has been found,
# because otherwise there would have to be a separate assembler source file
# for each assembler on every architecture.
###
set(ASM_DIALECT "_TMPX")
include(CMakeTestASMCompiler)
set(ASM_DIALECT)
./cmake/Platform/C64.cmake
: ./cmake/Platform/C64.cmake
: MESSAGE("-¤# Building for Commodore 64 platform! #¤-")
#this does not seem to work
#SET(CMAKE_ASM_TMPX_COMPILER "${CMAKE_BINARY_DIR}/tools/TMPx_v1.1.0-STYLE/linux-x86_64/tmpx")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
After checking a bit closer using CMake's 'MESSAGE()' commands, I think i've got at least the answer to my first question ; 在使用CMake的'MESSAGE()'命令仔细检查后,我想我至少得到了第一个问题的答案; ./cmake/CMakeDetermineASM_TMPXCompiler.cmake is the first thing to be run (and only at the very first 'cmake .') when eg
./cmake/CMakeDetermineASM_TMPXCompiler.cmake是第一个运行的东西(并且只在第一个'cmake。') ,例如
PROJECT(test001 ASM_TMPX) #asm_tmpx denoting the <lang>_<dialect>
is set in the ./CMakeLists.txt 在./CMakeLists.txt中设置
In my case, the run order at 'cmake .' 在我的例子中, 'cmake'的运行顺序。 appears to be:
似乎:
. 。 /cmake/Platform/ CMAKE_SYSTEM_NAME .cmake (runs at every 'cmake .')
/ cmake / Platform / CMAKE_SYSTEM_NAME .cmake (在每个'cmake运行'。)
Note: This relies on eg SET(CMAKE_SYSTEM_NAME "C64") having been set in CMakeLists.txt ;
注意:这取决于例如在CMakeLists.txt中设置的SET(CMAKE_SYSTEM_NAME“C64”) ; CMake will then look for eg ./cmake/Platform/C64.cmake
然后CMake将寻找例如./cmake/Platform/C64.cmake
./cmake/CMake LANG_DIALECT Information.cmake (runs at every 'cmake .') ./cmake/CMake LANG_DIALECT Information.cmake (在每个'cmake运行'。)
So i'm guessing CMakeDetermine LANG_DIALECT Compiler.cmake is where any and all detection of the location of the assembler executable , and any extraction of assembler version, it's commandline arguments, etc. etc., could and would need to be performed. 所以我猜测CMakeDetermine LANG_DIALECT Compiler.cmake是汇编程序可执行文件的位置的任何和所有检测,以及任何汇编程序版本的提取,它的命令行参数等等,可能并且需要执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.