Skip to content

Commit

Permalink
Merge branch 'release-1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
catharanthus committed Dec 3, 2021
2 parents 81f2a05 + 2014bd7 commit 20e217d
Show file tree
Hide file tree
Showing 51 changed files with 846 additions and 419 deletions.
21 changes: 21 additions & 0 deletions doc/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
========================
SDM 1.0.1
------------------------
Released on 2021-12-03
========================

sdmconsole:

* plotter now supports limitless scrolling, scrollbars have been removed
* various minor ergonomic enhancements in the plotter module
* default console font for Windows changed from Courier New to Consolas (if available)
* implement unobtrusive hints on startup
* fixed minor glitches in the stream viewer

Build system:

* Linux installer now creates an sdmconsole application shortcut
* requirements bumped: gcc>=4.9, Qt>=5.6, Ubuntu>=18.04
* fixed a bunch of compiler errors/warnings generated with newer Qt, gcc, clang and libstdc++
* experimental BSD-specific code removed

========================
SDM 1.0.0
------------------------
Expand Down
3 changes: 2 additions & 1 deletion doc/licenses/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ IN THE SOFTWARE.
THIRD PARTY SOFTWARE COMPONENTS

SDM framework includes the following third party software components. License
conditions for third-party software are provided in the documentation.
conditions for third-party software are provided in the documentation
directory.

* Lua: Copyright © 1994–2020 Lua.org, PUC-Rio.
* The Qt Toolkit: Copyright © 2015 The Qt Company Ltd.
Binary file modified doc/manual.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endif()

if(UNIX)
option(OPTION_VALGRIND "Enable Valgrind in the main test suite")
option(OPTION_NO_ICONS "Skip installation of desktop entries")
endif()

include(Version)
Expand Down
22 changes: 13 additions & 9 deletions src/cmake/GlobalBuildConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,19 @@ endif()
# Set up warning level

if(GCC_CMDLINE_SYNTAX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
# Note: -Wno-misleading-indentation prevents bogus Clang warnings related
# to the Qt's "emit" macro which expands to nothing and breaks indentation.
# -Wno-stringop-overflow prevents bogus GCC11 warning in the
# QVector<T>::append(), probably a compiler bug.
set(GCC_WARNINGS "-pedantic -Wall -Wextra -Wno-unused-parameter")
if(CMAKE_C_COMPILER_ID STREQUAL GNU)
set(GCC_WARNINGS "${GCC_WARNINGS} -Wno-stringop-overflow")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL Clang)
set(GCC_WARNINGS "${GCC_WARNINGS} -Wno-unknown-warning-option -Wno-misleading-indentation")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_WARNINGS}")
endif()

# Don't export unnecessary symbols from the executables
Expand All @@ -96,10 +107,3 @@ if(GCC_CMDLINE_SYNTAX)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
endif()

# Enable timed mutex workaround for libstdc++

if(GCC_CMDLINE_SYNTAX)
include_directories(${CMAKE_CURRENT_LIST_DIR}/workarounds)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include timed_mutex_workaround.h")
endif()
22 changes: 22 additions & 0 deletions src/cmake/InstallDirectories.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,26 @@ else()
set(DATA_INSTALL_DIR share/sdm/data)
set(CONFIG_PACKAGE_INSTALL_DIR share/sdm/cmake)
set(EXAMPLES_INSTALL_DIR share/sdm/examples)

# Set desktop entry directories
if(NOT OPTION_NO_ICONS)
file(RELATIVE_PATH INSTALL_PREFIX_FROM_HOME "$ENV{HOME}" "${CMAKE_INSTALL_PREFIX}")
string(SUBSTRING "${INSTALL_PREFIX_FROM_HOME}" 0 2 TMP)
if(TMP STREQUAL "..")
# Install path is a system directory
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(FREEDESKTOP_INSTALL_DIR /usr/share)
else()
set(FREEDESKTOP_INSTALL_DIR /usr/local/share)
endif()
else()
# Install path is a user directory
if("$ENV{XDG_DATA_HOME}")
set(FREEDESKTOP_INSTALL_DIR "$ENV{XDG_DATA_HOME}")
else()
set(FREEDESKTOP_INSTALL_DIR "$ENV{HOME}/.local/share")
endif()
endif()
message("Installing desktop entries to ${FREEDESKTOP_INSTALL_DIR}")
endif()
endif()
2 changes: 1 addition & 1 deletion src/cmake/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.3.0)

set(PRODUCT_VERSION_MAJOR 1)
set(PRODUCT_VERSION_MINOR 0)
set(PRODUCT_VERSION_PATCH 0)
set(PRODUCT_VERSION_PATCH 1)

try_compile(CPU_DETECTED "${CMAKE_CURRENT_BINARY_DIR}/try_compile/DetectCPU" "${CMAKE_CURRENT_LIST_DIR}/DetectCPU.c" COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/try_compile/DetectCPU.bin")

Expand Down
219 changes: 219 additions & 0 deletions src/cmake/installer/addtopath.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
-- This script adds/removes the SDM installation directory to/from the PATH
-- environment variable.
-- This is an experimental script that is not currently used by the installer.
-- Usage: addtopath.lua <add|remove>

if #arg~=1 or (arg[1]~="add" and arg[1]~="remove") then
print("Adds/removes SDM to/from the Windows PATH environment variable")
print("Usage: "..arg[0].." <add|remove>")
return
end

-- Import the necessary Win32 functions

dfic=require("luadfic")

local RegCreateKeyExA=dfic.import("advapi32","RegCreateKeyExA",
"long@winapi@uintptr_t,".. -- HKEY hKey
"const char*,".. -- LPCSTR lpSubKey
"unsigned long,".. -- DWORD Reserved
"const void*,".. -- LPSTR lpClass
"unsigned long,".. -- DWORD dwOptions
"unsigned long,".. -- REGSAM samDesired
"const void*,".. -- const LPSECURITY_ATTRIBUTES lpSecurityAttributes
"uintptr_t*,".. -- PHKEY phkResult,
"const void*") -- LPDWORD lpdwDisposition

local RegQueryValueExW=dfic.import("advapi32","RegQueryValueExW",
"long@winapi@uintptr_t,".. -- HKEY hKey,
"const void*,".. -- LPCWSTR lpValueName,
"const unsigned long*,".. -- LPDWORD lpReserved,
"unsigned long*,".. -- LPDWORD lpType,
"void*,".. -- LPBYTE lpData,
"unsigned long*") -- LPDWORD lpcbData

local RegSetValueExW=dfic.import("advapi32","RegSetValueExW",
"long@winapi@uintptr_t,".. -- HKEY hKey,
"const void*,".. -- LPCWSTR lpValueName,
"unsigned long,".. -- DWORD Reserved,
"unsigned long,".. -- DWORD dwType,
"const void*,".. -- const BYTE *lpData,
"unsigned long") -- DWORD cbData

local RegCloseKey=dfic.import("advapi32","RegCloseKey","long@winapi@uintptr_t")

local SendMessageTimeoutA=dfic.import("user32","SendMessageTimeoutA",
"long@winapi@uintptr_t,".. -- HWND hWnd,
"unsigned int,".. -- UINT Msg,
"const void*,".. -- WPARAM wParam,
"const char*,".. -- LPARAM lParam,
"unsigned int,".. -- UINT fuFlags,
"unsigned int,".. -- UINT uTimeout,
"unsigned int*" -- PDWORD_PTR lpdwResult
);

-- A helper function to parse the PATH environment variable

function parse_path(path)
local t={}
local i=1

function additem(str)
if str~="" then table.insert(t,str) end
end

while true do
-- "i" points to the beginning of an item
if path:sub(i,i)~="\"" then
-- normal item
local r=path:find(";",i,true)
if not r then
additem(path:sub(i))
break
end
additem(path:sub(i,r-1))
i=r+1
else
-- quoted item
local r=path:find("\"",i+1,true)
if not r then break end -- malformed string
additem(path:sub(i+1,r-1))
i=path:find(";",r+1,true)
if not i then break end
end
end

return t
end

-- Create a UTF-16 codec because Windows API doesn't support UTF-8

local c=codec.createcodec("utf-16")

-- Open the environment registry key

local HKEY_LOCAL_MACHINE=0x80000002
local KEY_ALL_ACCESS=0xF003F
local subkey="SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"

local r,key=RegCreateKeyExA(HKEY_LOCAL_MACHINE,subkey,0,nil,0,KEY_ALL_ACCESS,nil,1,nil)

if r~=0 then
print("Error opening registry key")
return
end

-- Query the Path value

local valuename_buf=dfic.buffer(256)
valuename_buf.write(c.fromutf8("Path"))

local r,valuetype,size=RegQueryValueExW(key[1],valuename_buf.ptr(),nil,1,nil,1)

if r~=0 then
print("Error querying registry key value")
RegCloseKey(key[1])
return
end

local path_buf=dfic.buffer(size[1])

r,valuetype,size=RegQueryValueExW(key[1],valuename_buf.ptr(),nil,1,path_buf.ptr(),{size[1]})

if r~=0 then
print("Error querying registry key value")
RegCloseKey(key[1])
return
end

if valuetype[1]~=1 and valuetype[1]~=2 then
print("Unexpected [Path] value type")
RegCloseKey(key[1])
return
end

local path=c.toutf8(path_buf.read(1,size[1]))

-- Remove the terminating null character(s), if any

for i=#path,1,-1 do
if path:byte(i)~=0 then
path=path:sub(1,i)
break
end
end

-- Dissect the path string

local path_table=parse_path(path)

-- Obtain the path to the SDM installation directory

local installprefix=sdm.path("installprefix")

-- Modify the path table

if arg[1]=="add" then
-- Add the SDM installation prefix to the PATH
-- Check whether it is not already present
for k,v in ipairs(path_table) do
if v==installprefix or v==installprefix.."\\" then
print("["..installprefix.."] is already present in the PATH")
RegCloseKey(key[1])
return
end
end
table.insert(path_table,installprefix)
else
-- Remove the SDM installation prefix from the PATH
local removed=false
for k,v in ipairs(path_table) do
if v==installprefix or v==installprefix.."\\" then
table.remove(path_table,k)
removed=true
end
end
if not removed then
print("["..installprefix.."] is not present in the PATH")
RegCloseKey(key[1])
return
end
end

-- Reassemble the path string

path=""
for i=1,#path_table do
if path_table[i]:find(";",1,true) then
path=path.."\""..path_table[i].."\""
else
path=path..path_table[i]
end
if i~=#path_table then path=path..";" end
end

-- Set the new PATH environment variable value

local path_utf16=c.fromutf8(path)
path_buf.resize(#path_utf16+2)
path_buf.write(path_utf16)
path_buf.write("\0\0",#path_utf16) -- add terminating null character

r=RegSetValueExW(key[1],valuename_buf.ptr(),0,valuetype[1],path_buf.ptr(),#path_buf)

if r~=0 then
print("Error setting registry key value")
RegCloseKey(key[1])
return
end

RegCloseKey(key[1])

-- Inform applications that the environment has been updated

local HWND_BROADCAST=0xFFFF
local WM_SETTINGCHANGE=0x001A

SendMessageTimeoutA(HWND_BROADCAST,WM_SETTINGCHANGE,nil,"Environment",0,1000,1)

print("PATH environment variable has been successfully modified")
6 changes: 6 additions & 0 deletions src/cmake/installer/make_installer.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,14 @@ Function .onInit
ReadRegStr $OldUninstaller HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_FULL_NAME_WITH_ARCH}" \
"UninstallString"
StrCmp $OldUninstaller "" 0 process_old_uninstaller
# Detect legacy Microproject SDM installations
ReadRegStr $OldUninstaller HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Microproject SDM (${ARCH_STR})" \
"UninstallString"
StrCmp $OldUninstaller "" done

process_old_uninstaller:
Push $OldUninstaller
Call GetInQuotes
Pop $OldUninstallerPath
Expand Down
35 changes: 21 additions & 14 deletions src/cmake/installer/uninstall.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@

# Uninstall program

@EMPTY@rm -f @CMAKE_INSTALL_PREFIX@/bin/sdmconsole
@EMPTY@rm -f @CMAKE_INSTALL_PREFIX@/bin/sdmhost
@EMPTY@rm -rf @CMAKE_INSTALL_PREFIX@/lib/sdm
@EMPTY@rm -rf @CMAKE_INSTALL_PREFIX@/include/sdm
@EMPTY@rm -rf @CMAKE_INSTALL_PREFIX@/share/sdm
@EMPTY@rm -f "@CMAKE_INSTALL_PREFIX@/bin/sdmconsole"
@EMPTY@rm -f "@CMAKE_INSTALL_PREFIX@/bin/sdmhost"
@EMPTY@rm -rf "@CMAKE_INSTALL_PREFIX@/lib/sdm"
@EMPTY@rm -rf "@CMAKE_INSTALL_PREFIX@/include/sdm"
@EMPTY@rm -rf "@CMAKE_INSTALL_PREFIX@/share/sdm"

# Remove desktop entries

@EMPTY@rm -f "@FREEDESKTOP_INSTALL_DIR@/applications/sdmconsole.desktop"
@EMPTY@rm -f "@FREEDESKTOP_INSTALL_DIR@/icons/hicolor/scalable/apps/sdmconsole.svg"
@EMPTY@rm -f "@FREEDESKTOP_INSTALL_DIR@/icons/hicolor/256x256/apps/sdmconsole.png"
@EMPTY@rm -f "@FREEDESKTOP_INSTALL_DIR@/icons/hicolor/48x48/apps/sdmconsole.png"

# Remove user configuration

@EMPTY@rm -f $ENV{HOME}/.config/Microproject/sdmconsole.ini
@EMPTY@rm -rf $ENV{HOME}/.config/Microproject/sdmconsole
@EMPTY@rm -df $ENV{HOME}/.config/Microproject
@EMPTY@rm -f "$ENV{HOME}/.config/Microproject/sdmconsole.ini"
@EMPTY@rm -rf "$ENV{HOME}/.config/Microproject/sdmconsole"
@EMPTY@rm -df "$ENV{HOME}/.config/Microproject"

# Remove empty directories (if appropriate)
# Remove these directories only if empty

@DONTREMOVE@rm -df @CMAKE_INSTALL_PREFIX@/bin
@DONTREMOVE@rm -df @CMAKE_INSTALL_PREFIX@/lib
@DONTREMOVE@rm -df @CMAKE_INSTALL_PREFIX@/include
@DONTREMOVE@rm -df @CMAKE_INSTALL_PREFIX@/share
@DONTREMOVE@rm -df @CMAKE_INSTALL_PREFIX@
@DONTREMOVE@rm -df "@CMAKE_INSTALL_PREFIX@/bin"
@DONTREMOVE@rm -df "@CMAKE_INSTALL_PREFIX@/lib"
@DONTREMOVE@rm -df "@CMAKE_INSTALL_PREFIX@/include"
@DONTREMOVE@rm -df "@CMAKE_INSTALL_PREFIX@/share"
@DONTREMOVE@rm -df "@CMAKE_INSTALL_PREFIX@"
Loading

0 comments on commit 20e217d

Please sign in to comment.