Initial release
This commit is contained in:
56
UpdateCMakeList.ps1
Normal file
56
UpdateCMakeList.ps1
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
$Template = ""
|
||||
$IncDirs = [System.Collections.Hashtable]::new()
|
||||
$files = Get-ChildItem -Path $PSScriptRoot/../../Library -Recurse -Include '*.h' #-Name
|
||||
|
||||
/cmake/stm32cubemx
|
||||
|
||||
Write-Output "" | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output "" | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output "# Library folder" | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output "set(DS_Include_Dirs" | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
|
||||
foreach($file in $files)
|
||||
{
|
||||
try
|
||||
{
|
||||
$IncDirs.Add($file.DirectoryName, $file.DirectoryName)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
foreach($IncDir in $IncDirs.Values)
|
||||
{
|
||||
$Template = $PSScriptRoot
|
||||
$Template = $Template -replace "\\cmake\\stm32cubemx", ''
|
||||
$Template = $Template -replace "\\", '/'
|
||||
|
||||
$TempString = $IncDir -replace '\\', '/'
|
||||
$TempString = $TempString -replace $Template, ''
|
||||
$TempString = ' ${CMAKE_SOURCE_DIR}' + $TempString
|
||||
Write-Output $TempString | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
}
|
||||
|
||||
Write-Output ')' | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output 'target_include_directories(stm32cubemx INTERFACE ${DS_Include_Dirs})' | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output '' | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output 'set(DS_Application_Src' | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
|
||||
|
||||
$files = Get-ChildItem -Path $PSScriptRoot/../../Library -Recurse -Include '*.c' #-Name
|
||||
|
||||
foreach($file in $files)
|
||||
{
|
||||
$Template = $PSScriptRoot
|
||||
$Template = $Template -replace "\\cmake\\stm32cubemx", ''
|
||||
$Template = $Template -replace "\\", '/'
|
||||
|
||||
$TempString = $file.FullName -replace '\\', '/'
|
||||
$TempString = $TempString -replace $Template, ''
|
||||
$TempString = ' ${CMAKE_SOURCE_DIR}' + $TempString
|
||||
Write-Output $TempString | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
}
|
||||
|
||||
Write-Output ')' | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output 'target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${DS_Application_Src})' | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
Write-Output "" | Out-File -FilePath $PSScriptRoot/../../cmake/stm32cubemx/CMakeLists.txt -Append -Encoding utf8
|
||||
|
||||
Reference in New Issue
Block a user