WSL/SLF GitLab Repository

Commit f86cd858 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Now enabling release compile by default

A small inconsistency has been fixed in Number.cc (now using the
background color instead of hard-coded white). The PATH is now expanded
to include the directory where inishell is (this will be convenient for
packaging with small applications). The NSIS templates for Windows have
been copied, but there is still work to do before it can be useful.
parent 86250bb4
......@@ -18,8 +18,9 @@
#The only qmake file for this project. Use 'qmake inishell.pro; make'.
#2019-10
CONFIG += debug
#CONFIG += release
#CONFIG += debug
CONFIG -= debug
CONFIG += release
message("Building from $$_PRO_FILE_ ...")
......@@ -29,7 +30,7 @@ CONFIG += c++11
#CONFIG += static
CONFIG(debug) { #in release, we try everything
message("Debug build, enabling checks.")
message("Debug build, enabling check.")
lessThan(QT_MAJOR_VERSION, 5): error("Qt5 is required for this project.")
CONFIG += strict_c++ #disable compiler extensions
CONFIG += warn_on
......@@ -39,6 +40,7 @@ CONFIG(debug) { #in release, we try everything
DEFINES += DEBUG #to be able to check at runtime
} else {
message("Release build.")
QMAKE_CXXFLAGS += -Wall -lto
}
VERSION = "2.0.1"
......@@ -158,14 +160,6 @@ DESTDIR = ./build #put executable here
MOC_DIR = ./tmp/obj #clutter build directory instead of source
OBJECTS_DIR = $$MOC_DIR
#default rules for deployment, e. g. 'make install':
#qnx {
# target.path = /tmp/$${TARGET}/bin
#} else {
# unix:!android: target.path = /opt/$${TARGET}/bin
#}
#!isEmpty(target.path): INSTALLS += target #install list
#deploy configuration
isEmpty(TARGET_EXT) {
win32 {
......
!define VERSION "@APP_VERSION@"
!define APP_VERSION "@APP_VERSION@"
!define APP_NAME "@APP_NAME@"
!define EXE_NAME "@EXE_NAME@"
!define README_FILE "README"
!define LICENSE_FILE "@PWD@\resources\text\COPYING_GNU_GPL"
!define MUI_ICON "@PWD@\resources\graphics\@APP_LOW_NAME@.ico"
!define MUI_UNICON "@PWD@\resources\graphics\@APP_LOW_NAME@.ico"
!define PATCH "0"
!define OUTPUT_FILE "@OUT_PWD@\@APP_LOW_NAME@-@APP_VERSION@-win32.exe"
!define BINARY_TREE "@OUT_PWD@\app"
;--------------------------------
; Do necessary inclusions.
!include NSIS.definitions.nsh
!include MUI2.nsh
;--------------------------------
; Basic values definitions.
; Name and file.
Name "${APP_NAME} portable"
OutFile "${OUTPUT_FILE}"
; Set custom branding text.
BrandingText "${APP_NAME}"
; Set compression.
SetCompressor /SOLID /FINAL lzma
; Default installation folder.
InstallDir "$PROGRAMFILES\${APP_NAME}"
InstallDirRegKey HKCU "Software\${APP_NAME}" "Install Directory"
; Require administrator access.
RequestExecutionLevel admin
;--------------------------------
; Interface Settings
; Show "are you sure" dialog when cancelling installation.
!define MUI_ABORTWARNING
;--------------------------------
; Pages
; Pages for installator.
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${LICENSE_FILE}"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
; Start menu folder page configuration.
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APP_NAME}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_INSTFILES
; Offer user to launch the application right when it is installed.
!define MUI_FINISHPAGE_RUN "$INSTDIR\${EXE_NAME}"
!insertmacro MUI_PAGE_FINISH
; Pages for uninstallator.
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
; Languages.
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Helper macros.
!macro ExecWaitJob _exec
StrCpy $9 0
System::Call 'kernel32::CreateIoCompletionPort(i -1,i0,i0,i0)i.r1'
${IfThen} $1 != 0 ${|} IntOp $9 $9 + 1 ${|}
System::Call 'kernel32::CreateJobObject(i0,i0)i.r2'
${IfThen} $2 != 0 ${|} IntOp $9 $9 + 1 ${|}
System::Call '*(i 0,i $1)i.r0'
System::Call 'kernel32::SetInformationJobObject(i $2,i 7,i $0,i 8)i.r3'
${IfThen} $3 != 0 ${|} IntOp $9 $9 + 1 ${|}
System::Free $0
System::Call '*(i,i,i,i)i.r0'
System::Alloc 72
pop $4
System::Call "*$4(i 72)"
System::Call 'kernel32::CreateProcess(i0,t ${_exec},i0,i0,i0,i 0x01000004,i0,i0,i $4,i $0)i.r3'
${IfThen} $3 != 0 ${|} IntOp $9 $9 + 1 ${|}
System::Free $4
System::Call "*$0(i.r3,i.r4,i,i)"
System::Free $0
System::Call 'kernel32::AssignProcessToJobObject(i $2,i $3)i.r0'
${IfThen} $0 != 0 ${|} IntOp $9 $9 + 1 ${|}
System::Call 'kernel32::ResumeThread(i $4)i.r0'
${IfThen} $0 != -1 ${|} IntOp $9 $9 + 1 ${|}
System::Call 'kernel32::CloseHandle(i $3)'
System::Call 'kernel32::CloseHandle(i $4)'
!define __ExecWaitJob__ ExecWaitJob${__LINE__}
${__ExecWaitJob__}ioportwait:
System::Call 'kernel32::GetQueuedCompletionStatus(i $1,*i.r3,*i,*i.r4,i -1)i.r0'
${IfThen} $0 = 0 ${|} StrCpy $9 0 ${|}
${IfThen} $3 != 4 ${|} goto ${__ExecWaitJob__}ioportwait ${|}
System::Call 'kernel32::CloseHandle(i $2)'
System::Call 'kernel32::CloseHandle(i $1)'
!undef __ExecWaitJob__
${IfThen} $9 < 6 ${|} MessageBox mb_iconstop `ExecWaitJob "${_exec}" failed!` ${|}
!macroend
; If you are using solid compression, files that are required before
; the actual installation should be stored first in the data block,
; because this will make your installer start faster.
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
; Sections.
; Installer sections.
Section "!Core" Core
IfFileExists $INSTDIR\Uninstall.exe +1 NotInstalled
MessageBox MB_OK|MB_ICONEXCLAMATION "${APP_NAME} is already installed. $\n$\nClick 'OK' to automatically uninstall it, installer will then automatically continue with current installation." IDOK Uninstall
Uninstall:
!insertmacro ExecWaitJob '"$INSTDIR\Uninstall.exe /S"'
NotInstalled:
SetOutPath "$INSTDIR"
; Install core application files.
File /r "${BINARY_TREE}\"
; Store installation folder.
WriteRegStr HKCU "Software\${APP_NAME}" "Install Directory" $INSTDIR
; Create uninstaller.
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Desktop Icon" DesktopIcon
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
SectionEnd
Section "Start Menu Shortcuts" StartMenuShortcuts
CreateDirectory "$SMPROGRAMS\${APP_NAME}"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
SectionEnd
LangString DESC_Core ${LANG_ENGLISH} "Core installation files for ${APP_NAME}."
LangString DESC_DesktopIcon ${LANG_ENGLISH} "Desktop icon for ${APP_NAME}."
LangString DESC_StartMenuShortcuts ${LANG_ENGLISH} "Start Menu Shortcuts for ${APP_NAME}."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Core} $(DESC_Core)
!insertmacro MUI_DESCRIPTION_TEXT ${DesktopIcon} $(DESC_DesktopIcon)
!insertmacro MUI_DESCRIPTION_TEXT ${StartMenuShortcuts} $(DESC_StartMenuShortcuts)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
; Uninstaller section.
Section "Uninstall"
; Here remove all files, but skip "data" folder.
Push "$INSTDIR"
Push "data"
Call un.RmDirsButOne
; Remove uninstaller.
Delete "$INSTDIR\*"
; Remove rest of installed files.
; Custom files are left intact.
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${APP_NAME}"
Delete "$DESKTOP\${APP_NAME}.lnk"
DeleteRegKey /ifempty HKCU "Software\${APP_NAME}"
SectionEnd
;--------------------------------
; Custom functions.
Function un.RmDirsButOne
Exch $R0 ; exclude dir
Exch
Exch $R1 ; route dir
Push $R2
Push $R3
ClearErrors
FindFirst $R3 $R2 "$R1\*.*"
IfErrors Exit
Top:
StrCmp $R2 "." Next
StrCmp $R2 ".." Next
StrCmp $R2 $R0 Next
IfFileExists "$R1\$R2\*.*" 0 Next
RmDir /r "$R1\$R2"
#Goto Exit ;uncomment this to stop it being recursive (delete only one dir)
Next:
ClearErrors
FindNext $R3 $R2
IfErrors Exit
Goto Top
Exit:
FindClose $R3
Pop $R3
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
; Executed when installer starts.
Function .onInit
IntOp $0 ${SF_SELECTED} | ${SF_RO}
SectionSetFlags ${Core} $0
FunctionEnd
......@@ -348,7 +348,7 @@ void Number::setOptions(const QDomNode &options)
} //endif format
/* allow to set "empty" via the property system */
QString bg_color("white");
QString bg_color( colors::getQColor("app_bg").name() );
//find font color to use for hidden spinbox text dependent on background color:
if (options.toElement().attribute("optional").toLower() == "false")
bg_color = colors::getQColor("mandatory").name();
......
......@@ -95,11 +95,12 @@ bool isDarkTheme()
*/
QString getExtraPath(const QString& appname)
{
#if defined Q_OS_WIN
const QString own_path( QCoreApplication::applicationDirPath() ); //so exe copied next to inishell are found, this is usefull for packaging
const QString home( QDir::homePath() );
const QString desktop( QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).at(0) ); //DesktopLocation always returns 1 element
QString extra_path( ";" + desktop+"/"+appname+"\\bin;" + home+"\\src\\"+appname+"\\bin;" + "D:\\src\\"+appname+"\\bin;" + "C:\\Program Files\\"+appname+"\\bin;" + "C:\\Program Files (x86)\\"+appname+"\\bin");
#if defined Q_OS_WIN
QString extra_path( ";" + desktop+"/"+appname+"\\bin;" + home+"\\src\\"+appname+"\\bin;" + "D:\\src\\"+appname+"\\bin;" + "C:\\Program Files\\"+appname+"\\bin;" + "C:\\Program Files (x86)\\"+appname+"\\bin;" + own_path);
const QString reg_key("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + appname + "\\UninstallString");
QSettings settings;
......@@ -113,15 +114,11 @@ QString getExtraPath(const QString& appname)
return extra_path;
#endif
#if defined Q_OS_MAC
const QString home( QDir::homePath() );
const QString desktop( QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).at(0) ); //DesktopLocation always returns 1 element
const QString extra_path( ":" +home+"/bin:" + home+"/usr/bin:" + home+"/src/"+appname+"/bin:" + desktop+"/"+appname+"/bin:" + "/Applications/"+appname+".app/Contents/bin" );
const QString extra_path( ":" +home+"/bin:" + home+"/usr/bin:" + home+"/src/"+appname+"/bin:" + desktop+"/"+appname+"/bin:" + "/Applications/"+appname+".app/Contents/bin:" + own_path);
return extra_path;
#endif
#if !defined Q_OS_WIN && !defined Q_OS_MAC
const QString home( QDir::homePath() );
const QString desktop( QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).at(0) ); //DesktopLocation always returns 1 element
const QString extra_path( ":" + home+"/bin:" + home+"/usr/bin:" + home+"/src/"+appname+"/bin:" + desktop+"/"+appname+"/bin:" + "/opt/"+appname+"/bin" );
const QString extra_path( ":" + home+"/bin:" + home+"/usr/bin:" + home+"/src/"+appname+"/bin:" + desktop+"/"+appname+"/bin:" + "/opt/"+appname+"/bin:" + own_path );
return extra_path;
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment