diff --git a/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/-4_c-st9ahTGrveJ-kvwfSHaFAQd.xml b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/-4_c-st9ahTGrveJ-kvwfSHaFAQd.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/-4_c-st9ahTGrveJ-kvwfSHaFAQd.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/-4_c-st9ahTGrveJ-kvwfSHaFAQp.xml b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/-4_c-st9ahTGrveJ-kvwfSHaFAQp.xml new file mode 100644 index 0000000..afd26fe --- /dev/null +++ b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/-4_c-st9ahTGrveJ-kvwfSHaFAQp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/LDgFujdvEkAdLINrcpsZgf8RuYsd.xml b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/LDgFujdvEkAdLINrcpsZgf8RuYsd.xml new file mode 100644 index 0000000..4356a6a --- /dev/null +++ b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/LDgFujdvEkAdLINrcpsZgf8RuYsd.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/LDgFujdvEkAdLINrcpsZgf8RuYsp.xml b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/LDgFujdvEkAdLINrcpsZgf8RuYsp.xml new file mode 100644 index 0000000..b963f31 --- /dev/null +++ b/resources/project/uhX3sCdulACV2vjznfltYOGT8Rw/LDgFujdvEkAdLINrcpsZgf8RuYsp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/toolbox/+vcpkg/buildVcpkgDeps.m b/toolbox/+vcpkg/buildVcpkgDeps.m index b28da1a..55cc1f8 100644 --- a/toolbox/+vcpkg/buildVcpkgDeps.m +++ b/toolbox/+vcpkg/buildVcpkgDeps.m @@ -32,7 +32,7 @@ function buildVcpkgDeps(manifestFolder, vpckgArguments, options) %% Figure out target triplet % Initialize variables -qnxSdpBat = ''; +targetEnvRootBat = ''; % Figure out target triplet if required if options.buildHostOnly @@ -41,16 +41,28 @@ function buildVcpkgDeps(manifestFolder, vpckgArguments, options) targetTriplet = vcpkg.getTargetTriplet; if contains(targetTriplet, 'qnx', 'IgnoreCase', true) - % Using QNX with Siumink Real-Time Target Support Package + % Using QNX with Simulink Real-Time Target Support Package slrealtime.qnxSetupFcn; qnxSpRoot = getenv('SLREALTIME_QNX_SP_ROOT'); qnxVersion = getenv('SLREALTIME_QNX_VERSION'); if ispc - qnxSdpBat = ['&& ',fullfile(qnxSpRoot,qnxVersion,'qnxsdp-env.bat')]; + targetEnvRootBat = ['&& ',fullfile(qnxSpRoot,qnxVersion,'qnxsdp-env.bat')]; elseif isunix % Sourcing the .sh file for qcc compilation. - qnxSdpBat = ['&& ',append('source ',fullfile(qnxSpRoot,qnxVersion,'qnxsdp-env.sh'))]; + targetEnvRootBat = ['&& ',append('source ',fullfile(qnxSpRoot,qnxVersion,'qnxsdp-env.sh'))]; + end + elseif contains(targetTriplet, 'x64-speedgoat-linux', 'IgnoreCase', true) + % Yocto cc specific implementation + x64CCRoot = getenv('X64CC_ROOT'); + if isempty(x64CCRoot) + %Error x64 cc root path not defined. + error(message('slrealtime:utils:x64CCRootNotSet')); + end + if ispc + targetEnvRootBat = ['&& ',fullfile(x64CCRoot,'toolchain','x64cc-setup-env.bat')]; + else + error('Current host OS is still not supported.'); end end @@ -67,7 +79,7 @@ function buildVcpkgDeps(manifestFolder, vpckgArguments, options) % Build up vcpkg full command vcpkgCmd = ['cd ', manifestFolder, ' ',... - qnxSdpBat,... + targetEnvRootBat,... ' && vcpkg install ',targetTriplet,' --host-triplet ', vcpkg.getHostTriplet,... ' --overlay-triplets "', fullfile(vcpkg.getToolboxRoot,'overlay-triplets'), '" ', strjoin(vpckgArguments,' ')]; diff --git a/toolbox/+vcpkg/getTargetTriplet.m b/toolbox/+vcpkg/getTargetTriplet.m index a533b9d..9c66c7d 100644 --- a/toolbox/+vcpkg/getTargetTriplet.m +++ b/toolbox/+vcpkg/getTargetTriplet.m @@ -12,7 +12,10 @@ elseif isMATLABReleaseOlderThan('R2020b') triplet = 'x86-windows-static'; else - error('Target triplet is not supported for MATLAB R2026a and later yet. Use buildHostOnly.'); + % MATLAB R2026a or later + if exist('speedgoat','file') + triplet = 'x64-speedgoat-linux-static'; + end end end \ No newline at end of file diff --git a/toolbox/overlay-triplets/qnx-toolchain.cmake b/toolbox/overlay-triplets/qnx-toolchain.cmake index f86ff64..33be7ef 100644 --- a/toolbox/overlay-triplets/qnx-toolchain.cmake +++ b/toolbox/overlay-triplets/qnx-toolchain.cmake @@ -12,7 +12,7 @@ if(NOT DEFINED ENV{QNX_HOST} OR NOT DEFINED ENV{QNX_TARGET}) message(FATAL_ERROR "QNX environment not found. Please 'source qnxsdp-env.sh' first.") endif() -# Allow caller to choose architecture; default to aarch64 +# Allow caller to choose architecture; default to x86_64 set(CMAKE_SYSTEM_PROCESSOR "x86_64" CACHE STRING "QNX target arch (aarch64|armv7|x86_64)") # Map arch → qcc variant string and sysroot suffix @@ -43,7 +43,6 @@ set(CMAKE_CXX_COMPILER_TARGET ${QNX_QCC_VARIANT}) set(CMAKE_SYSROOT "$ENV{QNX_TARGET}/${QNX_SYSROOT_SUFFIX}") # Make sure CMake finds things in the QNX sysroot first -set(CMAKE_FIND_ROOT_PATH "$ENV{QNX_TARGET}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) diff --git a/toolbox/overlay-triplets/speedgoat-linux-toolchain.cmake b/toolbox/overlay-triplets/speedgoat-linux-toolchain.cmake new file mode 100644 index 0000000..6cd1e24 --- /dev/null +++ b/toolbox/overlay-triplets/speedgoat-linux-toolchain.cmake @@ -0,0 +1,35 @@ +# speedgoat-linux-toolchain.cmake + +# Require a modern-enough CMake +cmake_minimum_required(VERSION 3.20) + +# Tell CMake we target Linux +set(CMAKE_SYSTEM_NAME Linux) + +# Allow caller to choose architecture; default to x86_64 +set(CMAKE_SYSTEM_PROCESSOR "x86_64" CACHE STRING "Speedgoat Linux target arch (aarch64|x86_64)") + +# Compilers +set(CMAKE_C_COMPILER ${CMAKE_SYSTEM_PROCESSOR}-speedgoat-linux-gcc) +set(CMAKE_CXX_COMPILER ${CMAKE_SYSTEM_PROCESSOR}-speedgoat-linux-g++) + +# Sysroot +set(CMAKE_SYSROOT "$ENV{SDKTARGETSYSROOT}") + +# Optimize for target architecture +if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + add_compile_options(-march=core2) +elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + add_compile_options(-march=armv8-a+crc) +else() + message(FATAL_ERROR "Unsupported processor architecture='${CMAKE_SYSTEM_PROCESSOR}'. Use aarch64|x86_64.") +endif() + +# Make sure CMake finds things in the sysroot first +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) + +# Set fPIC flag +set(CMAKE_POSITION_INDEPENDENT_CODE ON) \ No newline at end of file diff --git a/toolbox/overlay-triplets/x64-speedgoat-linux-static.cmake b/toolbox/overlay-triplets/x64-speedgoat-linux-static.cmake new file mode 100644 index 0000000..3271f6e --- /dev/null +++ b/toolbox/overlay-triplets/x64-speedgoat-linux-static.cmake @@ -0,0 +1,16 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CMAKE_SYSTEM_NAME Linux) + +# Linkage preferences +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) # common for embedded + +# Pass environment variables +set(VCPKG_ENV_PASSTHROUGH SDKTARGETSYSROOT;PATH) + +# Absolute path to the chainloaded toolchain +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE + "${CMAKE_CURRENT_LIST_DIR}/speedgoat-linux-toolchain.cmake") + +# Disable debug builds +set(VCPKG_BUILD_TYPE release) \ No newline at end of file