我正在尝试为名为TMPx的 Commodore 64/6502 交叉汇编器建立一个尽可能可重复使用的 cmake 构建系统。
我的问题是:
- 根据主机平台,我如何让 CMake [尝试] 在各种指定位置检测并设置可执行路径
tmpx
和正确路径?TMPx.exe
- 如果这是可能的,
./cmake/
下面列出的哪些模块是这样的搜索/查找?
- 如果这是可能的,
- 有没有办法
cmake .
检测并列出 TMPX 版本,而不是显示:--
ASM_TMPX
编译器标识未知
除此之外,非常感谢其他意见和建议。
(这是我的git repo和下面的文件)
我的./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)
通过遵循CMake wiki 中的本指南,到目前为止,我已经完成了以下 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
:
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
:
###
# 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
:
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)