Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor fixes and cleanup for proprietary OS build #12

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion skyscraper.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ TARGET = Skyscraper
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += release
win32:CONFIG += console
QT += core network xml
QMAKE_CXXFLAGS += -std=c++11

Expand Down
4 changes: 4 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
#include <QDebug>
#include <QDir>
#include <QStringBuilder>
#ifdef __MINGW32__
#include <experimental/filesystem>
#else
#include <filesystem>
#endif

RuntimeCfg::RuntimeCfg(Settings *config, const QCommandLineParser *parser) {
this->config = config;
Expand Down
54 changes: 35 additions & 19 deletions win32/deploy_mandatory_files.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
param([string]$src_dir,[string]$skyscraper_home)
param([string]$src_dir,[string]$skyscraper_home)

# These may be customized by user, thus do not overwrite with the repo files.
# The (newer) repo file will then get '.dist' extension appended in target dir.
Expand Down Expand Up @@ -30,38 +30,54 @@ $dmap = @{
'impexamples' = 'import'
'resexamples' = 'resources'
}
# ignore: supplementary.files and target.files
# ignore: unix.supplementary.files and unix.target.files

# key: value from dmap, value: unix.($dmap.key).files= from skyscraper.pro
$fmap = @{}

# Prepare map $fmap with files to copy for each folder
$regex = '^unix:(?<key>.+)\.files=(?<deployfiles>.+)$'
Get-Content $src_dir/skyscraper.pro | Select-String $regex | ForEach-Object {
$regex = 'unix:(?<key>[^.]+)\.files=(?<deployfiles>.+?)unix'

(Get-Content $src_dir/skyscraper.pro) -join ' ' -replace '\\' |
Select-String $regex -AllMatches | ForEach-Object {
$g = $_.Matches.Groups |
? { $_.Name -eq 'key' -or $_.Name -eq 'deployfiles' } |
Select-Object -Property Value
for ($i=0; $i -lt $g.length; $i+=2) {
$v = $g[$i].Value
if ($dmap.ContainsKey($v)) {
$deployfiles = $g[$i+1].Value.split(' ')
$fmap.Add($dmap.$v, $deployfiles)
Where-Object { $_.Name -eq 'key' -or $_.Name -eq 'deployfiles' } |
Select-Object -Property Value
for ($i = 0; $i -lt $g.length; $i += 2) {
$v = $g[$i].Value.Trim()
if (-not [string]::IsNullOrEmpty($v) -and $dmap.ContainsKey($v)) {
$deployfiles = ($g[$i + 1].Value -replace ('\s+',' ')).Trim().Split(' ')
if ($fmap.ContainsKey($dmap.$v)) {
$deployfiles += $fmap.($dmap.$v)
$fmap.($dmap.$v) = $deployfiles
} else {
$fmap.Add($dmap.$v,$deployfiles)
}
}
}
}

# Copy files
$folders | ForEach-Object {
mkdir -Force "$skyscraper_home/$_" | Out-Null
$subfolder = $_
mkdir -Force "$skyscraper_home/$subfolder" | Out-Null
if ($fmap.ContainsKey($subfolder)) {
$fmap.$subfolder | ForEach-Object {
$cf = $_.split('/')[-1]
if (($cf -in $user_cfg_files) -and (Test-Path $skyscraper_home/$subfolder/$cf)) {
"[*] Install folder '$subfolder':"
$fmap.$subfolder | Sort-Object –CaseSensitive | ForEach-Object {
$cf = $_.Split('/')[-1]
if (($cf -in $user_cfg_files) -and `
(Test-Path $skyscraper_home/$subfolder/$cf)) {
$cf_dist = "{0}.dist" -f $cf
$cf_print = "$skyscraper_home/$subfolder/$cf".replace("/", "\").replace(".\","")
"[*] {0} exists. Copying new file to $cf_dist" -f $cf_print
Copy-Item -Path $src_dir/$_ $skyscraper_home/$subfolder/$cf_dist
$cf_print = "$skyscraper_home/$subfolder/$cf"
$cf_print = $cf_print.Replace("/","\").Replace("\.\","\")
" {0} exists. Copying new file to $cf_dist" -f $cf_print
Copy-Item -Force -Path "$src_dir/$_" `
"$skyscraper_home/$subfolder/$cf_dist"
} else {
Copy-Item -Path $src_dir/$_ $skyscraper_home/$subfolder
$cf_print = (("$skyscraper_home/$subfolder".Replace("/","\")) `
-replace ('\.$','')) -replace ('([a-z])$','$1\')
" Copy $_ to $cf_print"
Copy-Item -Path "$src_dir/$_" "$skyscraper_home/$subfolder"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions win32/skyscraper.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
win32 {

CONFIG += console
CONFIG(release, debug|release) {
BUILD_CFG=release
} else {
Expand All @@ -13,6 +14,9 @@ win32 {
WINDEPLOYQT_BIN="$$[QT_INSTALL_PREFIX]/bin/windeployqt.exe"
QT_LIC_FOLDER="$$[QT_INSTALL_PREFIX]/../../Licenses"

# Avoid MinGW windres.exe hiccup in generated Skyscraper_resource.rc
VERSION=$$replace(VERSION, '-dev', '.999')

# remove build artifacts
QMAKE_POST_LINK += cmd /c del $$shell_quote($$shell_path($${DEST}\\\\*.cpp)) \
$$shell_quote($$shell_path($${DEST}\\\\*.o)) \
Expand Down