Skip to content

Commit 86e2c0b

Browse files
committed
Introduce tenyr language support to CMake
Adapted from https://stackoverflow.com/a/38296922
1 parent 89ee0c5 commit 86e2c0b

4 files changed

+45
-0
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# For now we are configuring ctest into a subdirectory of the build directory
2+
# that is chosen by the top-level Makefile. Eventually CMake will control the
3+
# build directory location and this TENYR_LEGACY_BUILD_DIR will go away.
4+
set(TENYR_LEGACY_BUILD_DIR "${CMAKE_BINARY_DIR}/..")
5+
6+
# Find the compiler
7+
find_program(
8+
CMAKE_TENYR_COMPILER
9+
NAMES "tas"
10+
PATHS "${TENYR_LEGACY_BUILD_DIR}"
11+
DOC "tenyr assembler"
12+
NO_DEFAULT_PATH
13+
)
14+
mark_as_advanced(CMAKE_TENYR_COMPILER)
15+
16+
find_program(
17+
CMAKE_TENYR_LINKER
18+
NAMES "tld"
19+
PATHS "${TENYR_LEGACY_BUILD_DIR}"
20+
DOC "tenyr linker"
21+
NO_DEFAULT_PATH
22+
)
23+
mark_as_advanced(CMAKE_TENYR_LINKER)
24+
25+
set(CMAKE_TENYR_SOURCE_FILE_EXTENSIONS tas)
26+
set(CMAKE_TENYR_OUTPUT_EXTENSION .to)
27+
set(CMAKE_TENYR_COMPILER_ENV_VAR "TENYR_AS")
28+
29+
# Configure variables set in this file for fast reload later on
30+
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeTENYRCompiler.cmake.in
31+
${CMAKE_PLATFORM_INFO_DIR}/CMakeTENYRCompiler.cmake)

cmake/CMakeTENYRCompiler.cmake.in

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
set(CMAKE_TENYR_COMPILER "@CMAKE_TENYR_COMPILER@")
2+
set(CMAKE_TENYR_LINKER "@CMAKE_TENYR_LINKER@")
3+
set(CMAKE_TENYR_COMPILER_LOADED 1)
4+
set(CMAKE_TENYR_SOURCE_FILE_EXTENSIONS @CMAKE_TENYR_SOURCE_FILE_EXTENSIONS@)
5+
set(CMAKE_TENYR_OUTPUT_EXTENSION @CMAKE_TENYR_OUTPUT_EXTENSION@)
6+
set(CMAKE_TENYR_COMPILER_ENV_VAR "@CMAKE_TENYR_COMPILER_ENV_VAR@")

cmake/CMakeTENYRInformation.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
set(CMAKE_TENYR_COMPILE_OBJECT "<CMAKE_TENYR_COMPILER> <SOURCE> -o <OBJECT>")
2+
# CMake wants to call a compiler front-end (CMAKE_TENYR_COMPILER) for linking,
3+
# but we need a separate linker. For now, we interpolate the CMAKE_TENYR_LINKER
4+
# directly into the string below.
5+
set(CMAKE_TENYR_LINK_EXECUTABLE "${CMAKE_TENYR_LINKER} <OBJECTS> -o <TARGET>")
6+
set(CMAKE_TENYR_INFORMATION_LOADED 1)

cmake/CMakeTestTENYRCompiler.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# For now just do nothing in here
2+
set(CMAKE_TENYR_COMPILER_WORKS 1 CACHE INTERNAL "")

0 commit comments

Comments
 (0)