From 7883178caef4ebf56f2ee83b07af630e0b75fe58 Mon Sep 17 00:00:00 2001 From: Josh Channings Date: Fri, 24 Nov 2023 12:50:10 +0000 Subject: ADSP: Use $CMAKE_EXECUTABLE_SUFFIX in COMPILER_NAME The binaries are obviously not .exe-suffixed on Linux --- Modules/Platform/ADSP-Common.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/ADSP-Common.cmake b/Modules/Platform/ADSP-Common.cmake index 2ba90b2..582adb5 100644 --- a/Modules/Platform/ADSP-Common.cmake +++ b/Modules/Platform/ADSP-Common.cmake @@ -9,9 +9,9 @@ macro(__platform_adsp_init) set(CMAKE_ADSP_PROCESSOR "ADSP-${CMAKE_SYSTEM_PROCESSOR}") string(TOUPPER "${CMAKE_ADSP_PROCESSOR}" CMAKE_ADSP_PROCESSOR) - set(CMAKE_ADSP_COMPILER_NAME cc21k.exe) + set(CMAKE_ADSP_COMPILER_NAME "cc21k${CMAKE_EXECUTABLE_SUFFIX}") if(CMAKE_ADSP_PROCESSOR MATCHES "^ADSP-BF") - set(CMAKE_ADSP_COMPILER_NAME ccblkfn.exe) + set(CMAKE_ADSP_COMPILER_NAME "ccblkfn${CMAKE_EXECUTABLE_SUFFIX}") endif() set(CMAKE_ADSP_PLATFORM_INITIALIZED TRUE) -- cgit v0.12 From 04d8a39e5c44b07bb5ca2a57756591c6280cc61d Mon Sep 17 00:00:00 2001 From: Josh Channings Date: Fri, 24 Nov 2023 12:51:53 +0000 Subject: ADSP: Use find_program() to get path to cc21k/ccblkfn This still uses CMAKE_ADSP_ROOT as the PATHS argument, so the same behavior should be retained - but now the Platform will work without needing to supply the root, if the binaries are already in $PATH. --- Modules/Platform/ADSP-Common.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/ADSP-Common.cmake b/Modules/Platform/ADSP-Common.cmake index 582adb5..7ec8a6f 100644 --- a/Modules/Platform/ADSP-Common.cmake +++ b/Modules/Platform/ADSP-Common.cmake @@ -20,7 +20,12 @@ endmacro() macro(__platform_adsp lang) __platform_adsp_init() - set(CMAKE_${lang}_COMPILER "${CMAKE_ADSP_ROOT}/${CMAKE_ADSP_COMPILER_NAME}") + find_program( + CMAKE_${lang}_COMPILER + "${CMAKE_ADSP_COMPILER_NAME}" + PATHS "${CMAKE_ADSP_ROOT}" + REQUIRED + ) execute_process( COMMAND "${CMAKE_${lang}_COMPILER}" "-proc=${CMAKE_ADSP_PROCESSOR}" "-version" -- cgit v0.12 From 85e25451af91c16131fb542dc1bef655c4ec1b43 Mon Sep 17 00:00:00 2001 From: Josh Channings Date: Fri, 24 Nov 2023 12:52:50 +0000 Subject: ADSP: Add /opt/analog/cces to _find_adsp_root()'s search space This is the default install location on Linux. --- Modules/Platform/ADSP-Determine.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/Platform/ADSP-Determine.cmake b/Modules/Platform/ADSP-Determine.cmake index 6ccf1ea..d5a34c5 100644 --- a/Modules/Platform/ADSP-Determine.cmake +++ b/Modules/Platform/ADSP-Determine.cmake @@ -21,6 +21,9 @@ endif() if(NOT CMAKE_ADSP_ROOT) _find_adsp_root("C:/Program Files (x86)/Analog Devices/VisualDSP *") endif() +if(NOT CMAKE_ADSP_ROOT) + _find_adsp_root("/opt/analog/cces *") +endif() if(NOT IS_DIRECTORY "${CMAKE_ADSP_ROOT}") message(FATAL_ERROR "ADSP: could not find CCES/VDSP++ install directory ${CMAKE_ADSP_ROOT}") endif() -- cgit v0.12 From 33e6862cbcb8002ce82cd1420a2197af5b56cfbb Mon Sep 17 00:00:00 2001 From: Josh Channings Date: Wed, 29 Nov 2023 19:01:27 +0000 Subject: ADSP: Allow progress with CMAKE_ADSP_ROOT unset This is a behavior change. You can still set ADSP_ROOT/CMAKE_ADSP_ROOT to hint the find_program() invocations for the CCES binaries, but it is no longer necessary if they are already in PATH. The reason is: CMAKE_ADSP_ROOT is only used to find the binaries. If they are in PATH, there is no need to supply the root path. If they are not in PATH, you can hint still hint it as before. The other option would be to use find_path() to get CMAKE_ADSP_ROOT from the path to one of the bins, but that would be convoluted and pointless. There are some circumstances where the binaries are available, but the ADSP install is not. For example, from my own dev environment: https://github.com/joshchngs/macos-sharc-tools Here, the `cc21k` et. al. binaries are actually shell scripts which launch the real binary inside a running VM. --- Modules/Platform/ADSP-Determine.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/Modules/Platform/ADSP-Determine.cmake b/Modules/Platform/ADSP-Determine.cmake index d5a34c5..1588c92 100644 --- a/Modules/Platform/ADSP-Determine.cmake +++ b/Modules/Platform/ADSP-Determine.cmake @@ -24,6 +24,3 @@ endif() if(NOT CMAKE_ADSP_ROOT) _find_adsp_root("/opt/analog/cces *") endif() -if(NOT IS_DIRECTORY "${CMAKE_ADSP_ROOT}") - message(FATAL_ERROR "ADSP: could not find CCES/VDSP++ install directory ${CMAKE_ADSP_ROOT}") -endif() -- cgit v0.12