phodina / ProjectConverter

Convert existing project from KEIL or IAR to CMake using arm-none-eabi-gcc
Other
83 stars 25 forks source link

abspath dependence #4

Open boger047 opened 3 months ago

boger047 commented 3 months ago

The scenario I'm using requires an absolute path, and the call to template_dir in cmake.py requires that the program execution path be in the same directory as the script

this is my solution

abspath = os.path.abspath(os.path.join(self.path,'CMakeLists.txt'))
self.generateFile('CMakeLists.txt', abspath)

replace to

template_path = os.path.split(os.path.realpath(__file__))[0]

abspath = os.path.abspath(os.path.join(self.path,'CMakeLists.txt'))
self.generateFile('CMakeLists.txt', abspath, template_dir=template_path)
self.linkerScript('STM32FLASH.ld',os.path.join(self.path,'STM32FLASH.ld'), template_path)