xmos / xcommon_cmake

6 stars 5 forks source link

PCA commands fail on Windows if there is a space in the directory path #123

Closed danielpieczko closed 6 months ago

danielpieczko commented 8 months ago

If your sandbox directory, or any of its parent directories, has a space in its name, PCA commands will fail

C:\Users\markphillips\OneDrive - Xmos\project_sw_usb_audio\sw_usb_audio\app_usb_aud_xk_evk_xu316\build>ninja
[14/624] Generating C:/Users/markphillips/OneDrive - Xmos/project_sw_usb_audio/sw_usb_audio/app_usb_aud_xk_evk_xu316/.build_1AMi2o2xxxxxx/_l_locks/_l_locks/src/swlock_asm.S.pca.xml
FAILED: C:/Users/markphillips/OneDrive - Xmos/project_sw_usb_audio/sw_usb_audio/app_usb_aud_xk_evk_xu316/.build_1AMi2o2xxxxxx/_l_locks/_l_locks/src/swlock_asm.S.pca.xml 
CMakeFiles\swlock_asm.S.pca.xml-196650e.bat 7178bb45e82a0750
xpcaobj: error: Cannot open "C:/Users/markphillips/OneDrive"

If PCA is disabled, the application builds, so it looks like the commands generated by cmake are fine with the space in the directory. I assume that our cmake code that creates the PCA commands needs some extra quoting to support this.

danielpieczko commented 6 months ago

There were a couple of problems here:

  1. the files listed in the _pca.rsp file needed to be individually quoted
  2. the path to the .build/pca.xml file needed to be quoted when used in the compiler options

With these changes, the pca_basic testcase works when there is a space in the directory name. Since the PCA commands are more manually constructed than the usual cmake flow for the other compiler/linker commands, our tests would benefit from having spaces in the directory name to avoid a regression on this issue.