mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-29 13:03:37 +01:00
fxsdk: compatibility with CMake 3.24
This commit is contained in:
parent
92316b9f5a
commit
223cd31b6c
5 changed files with 46 additions and 7 deletions
18
fxsdk/cmake/CMakeDetermineFXCONVCompiler.cmake
Normal file
18
fxsdk/cmake/CMakeDetermineFXCONVCompiler.cmake
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
set(FXCONV_COMPILER_NAME $ENV{FXCONV_PATH})
|
||||||
|
if(NOT FXCONV_COMPILER_NAME)
|
||||||
|
set(FXCONV_COMPILER_NAME "fxconv")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(FXCONV_COMPILER_PATH "${FXCONV_COMPILER_NAME}")
|
||||||
|
if(FXCONV_COMPILER_PATH STREQUAL "FXCONV_COMPILER_PATH-NOTFOUND")
|
||||||
|
message(FATAL_ERROR "'${FXCONV_COMPILER}' not found!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_FXCONV_COMPILER "${FXCONV_COMPILER_PATH}")
|
||||||
|
set(CMAKE_FXCONV_COMPILER_ENV_VAR "FXCONV_PATH")
|
||||||
|
set(CMAKE_FXCONV_OUTPUT_EXTENSION ".o")
|
||||||
|
|
||||||
|
# Save these results
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/CMakeFXCONVCompiler.cmake.in"
|
||||||
|
"${CMAKE_PLATFORM_INFO_DIR}/CMakeFXCONVCompiler.cmake")
|
4
fxsdk/cmake/CMakeFXCONVCompiler.cmake.in
Normal file
4
fxsdk/cmake/CMakeFXCONVCompiler.cmake.in
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
set(CMAKE_FXCONV_COMPILER "@CMAKE_FXCONV_COMPILER@")
|
||||||
|
set(CMAKE_FXCONV_COMPILER_LOADED 1)
|
||||||
|
set(CMAKE_FXCONV_OUTPUT_EXTENSION "@CMAKE_FXCONV_OUTPUT_EXTENSION@")
|
||||||
|
set(CMAKE_FXCONV_COMPILER_ENV_VAR "@CMAKE_FXCONV_COMPILER_ENV_VAR@")
|
15
fxsdk/cmake/CMakeFXCONVInformation.cmake
Normal file
15
fxsdk/cmake/CMakeFXCONVInformation.cmake
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# The compiler command is a bit shaky because we want to dynamically add
|
||||||
|
# --converters flags but too much user code carelessly sets C/C++ flags for all
|
||||||
|
# languages globally, meaning our own flags are mostly unusable.
|
||||||
|
#
|
||||||
|
# We work around this problem by using CMAKE_FXCONV_COMPILER_ARG1, a special
|
||||||
|
# variable whose value is automatically inserted as an argument after the
|
||||||
|
# <CMAKE_FXCONV_COMPILER> placeholder in the COMPILE_OBJECT rule. We then
|
||||||
|
# modify CMAKE_FXCONV_COMPILER_ARG1 from the fxconv_declare_converters()
|
||||||
|
# function to supply the --converters flag.
|
||||||
|
|
||||||
|
set(CMAKE_FXCONV_COMPILER_ARG1)
|
||||||
|
set(CMAKE_FXCONV_COMPILE_OBJECT
|
||||||
|
"<CMAKE_FXCONV_COMPILER> --toolchain=sh-elf --${FXSDK_PLATFORM} \
|
||||||
|
<SOURCE> -o <OBJECT>")
|
||||||
|
set(CMAKE_FXCONV_INFORMATION_LOADED 1)
|
1
fxsdk/cmake/CMakeTestFXCONVCompiler.cmake
Normal file
1
fxsdk/cmake/CMakeTestFXCONVCompiler.cmake
Normal file
|
@ -0,0 +1 @@
|
||||||
|
set(CMAKE_FXCONV_COMPILER_WORKS 1 CACHE INTERNAL "")
|
|
@ -1,5 +1,7 @@
|
||||||
set(CMAKE_FXCONV_COMPILE_OBJECT
|
# For the template of the custom language, see:
|
||||||
"fxconv <SOURCE> -o <OBJECT> --toolchain=sh-elf --${FXSDK_PLATFORM}")
|
# - https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CMakeAddNewLanguage.txt
|
||||||
|
# - https://stackoverflow.com/questions/59536644/cmake-custom-compiler-linker-language-not-found
|
||||||
|
enable_language(FXCONV)
|
||||||
|
|
||||||
function(fxconv_declare_assets)
|
function(fxconv_declare_assets)
|
||||||
cmake_parse_arguments(CONV "WITH_METADATA" "" "" ${ARGN})
|
cmake_parse_arguments(CONV "WITH_METADATA" "" "" ${ARGN})
|
||||||
|
@ -27,10 +29,9 @@ function(fxconv_declare_converters)
|
||||||
list(APPEND FXCONV_CONVERTERS "${CONVERTER_PATH}")
|
list(APPEND FXCONV_CONVERTERS "${CONVERTER_PATH}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Record the names in the list
|
# Record the full list in the parent scope
|
||||||
set(FXCONV_CONVERTERS "${FXCONV_CONVERTERS}" PARENT_SCOPE)
|
set(FXCONV_CONVERTERS "${FXCONV_CONVERTERS}" PARENT_SCOPE)
|
||||||
|
# Also push a language flag through the special "ARG1" variable
|
||||||
# Update the compile command
|
set(CMAKE_FXCONV_COMPILER_ARG1 "--converters=${FXCONV_CONVERTERS}"
|
||||||
set(CMAKE_FXCONV_COMPILE_OBJECT
|
PARENT_SCOPE)
|
||||||
"fxconv <SOURCE> -o <OBJECT> --toolchain=sh-elf --${FXSDK_PLATFORM} --converters=${FXCONV_CONVERTERS}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
Loading…
Reference in a new issue