a mega cool windows xp app

Compare changes

Choose any two refs to compare.

+1
.gitignore
···
.clangd
compile_commands.json
build/
+
ShortwaveRadioInstaller.exe
+8 -4
CMakeLists.txt
···
add_compile_options(-fno-threadsafe-statics)
add_compile_options(-D_GLIBCXX_HAS_GTHREADS=0)
-
add_executable(ShortwaveApp WIN32 main.cpp)
+
if(MINGW)
+
set(WIN32_ICON shortwave.rc)
+
endif()
+
+
add_executable(ShortwaveApp WIN32 main.cpp ${WIN32_ICON})
# Add BASS library from libs directory
target_include_directories(ShortwaveApp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
···
target_include_directories(ShortwaveApp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# Minimal static linking and avoid threading dependencies
-
target_link_options(ShortwaveApp PRIVATE
-
-static-libgcc
+
target_link_options(ShortwaveApp PRIVATE
+
-static-libgcc
-static-libstdc++
-static
-Wl,--subsystem,windows:5.01
···
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}"
)
-
endif()
+
endif()
+40 -97
flake.nix
···
'';
};
-
installer = pkgs.stdenv.mkDerivation {
-
name = "shortwave-installer";
-
version = "1.0.0";
-
src = ./.;
-
-
nativeBuildInputs = with pkgs; [
-
nsis
-
];
-
-
buildInputs = [ self'.packages.shortwave ];
-
buildPhase = ''
-
# Create staging directory
-
mkdir -p staging
-
-
# Copy executable and DLLs
-
cp ${self'.packages.shortwave}/bin/Shortwave.exe staging/
-
-
cp libs/bass.dll staging/
-
-
cp shortwave.ico staging/
-
-
# Copy documentation
-
cp LICENSE.md staging/
-
cp README.md staging/
-
-
# Build installer
-
cd staging
-
makensis -NOCD ../installer.nsi
-
-
# Rename output to expected installer name
-
if [ -f ShortwaveRadioInstaller.exe ]; then
-
mv ShortwaveRadioInstaller.exe ../
-
else
-
echo "โœ— Installer was not created by makensis"
-
exit 1
-
fi
-
cd ..
-
ls
-
'';
-
-
installPhase = ''
-
mkdir -p $out/bin
-
cp ShortwaveRadioInstaller.exe $out/bin/
-
'';
-
};
-
deploy-to-xp = pkgs.writeShellScriptBin "deploy-to-xp" ''
echo "rebuilding program"
nix build
···
pkgsCross.mingw32.buildPackages.gcc
self'.packages.deploy-to-xp
self'.packages.build-installer
+
nsis
];
shellHook = ''
-
echo "Shortwave Radio development environment loaded"
-
echo "Available commands:"
-
echo " nix build - Build the Shortwave Radio application"
-
echo " nix build .#installer - Build Windows installer"
-
echo " build-installer - Build installer (shortcut)"
-
echo " deploy-to-xp - Deploy to XP VM folder"
-
echo ""
-
echo "Setting up development environment..."
+
# Get dynamic paths from nix packages
+
GCC_BASE="${pkgs.pkgsCross.mingw32.buildPackages.gcc}/i686-w64-mingw32"
+
SYS_INCLUDE="$GCC_BASE/sys-include"
+
MINGW_MAIN_INCLUDE="${pkgs.pkgsCross.mingw32.windows.mingw_w64.dev}/include"
+
CPP_INCLUDE="${pkgs.lib.getDev pkgs.pkgsCross.mingw32.buildPackages.gcc}/include/c++/10.3.0"
+
CPP_TARGET_INCLUDE="$CPP_INCLUDE/i686-w64-mingw32"
-
# Get dynamic paths from nix packages
-
GCC_BASE="${pkgs.pkgsCross.mingw32.buildPackages.gcc}/i686-w64-mingw32"
-
SYS_INCLUDE="$GCC_BASE/sys-include"
-
MINGW_MAIN_INCLUDE="${pkgs.pkgsCross.mingw32.windows.mingw_w64.dev}/include"
-
CPP_INCLUDE="${pkgs.lib.getDev pkgs.pkgsCross.mingw32.buildPackages.gcc}/include/c++/10.3.0"
-
CPP_TARGET_INCLUDE="$CPP_INCLUDE/i686-w64-mingw32"
-
-
# Auto-generate .clangd config with correct paths
-
cat > .clangd << EOF
-
CompileFlags:
-
Add:
-
- -target
-
- i686-w64-mingw32
-
- -DWINVER=0x0501
-
- -D_WIN32_WINNT=0x0501
-
- -DWIN32_LEAN_AND_MEAN
-
- -D_WIN32
-
- -DWIN32
-
- -std=c++17
-
- -fno-builtin
-
- -isystem
-
- $SYS_INCLUDE
-
- -isystem
-
- $MINGW_MAIN_INCLUDE
-
- -isystem
-
- $CPP_INCLUDE
-
- -isystem
-
- $CPP_TARGET_INCLUDE
-
Remove:
-
- -I*/gcc/*/include
-
EOF
-
-
cat > compile_commands.json << EOF
-
[
-
{
-
"directory": "$(pwd)",
-
"command": "i686-w64-mingw32-g++ -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -std=c++17 -isystem \"$SYS_INCLUDE\" -isystem \"$MINGW_MAIN_INCLUDE\" -isystem \"$CPP_INCLUDE\" -isystem \"$CPP_TARGET_INCLUDE\" -c main.cpp",
-
"file": "main.cpp"
-
}
-
]
-
EOF
+
# Auto-generate .clangd config with correct paths
+
cat > .clangd <<EOF
+
CompileFlags:
+
Add:
+
- -target
+
- i686-w64-mingw32
+
- -DWINVER=0x0501
+
- -D_WIN32_WINNT=0x0501
+
- -DWIN32_LEAN_AND_MEAN
+
- -D_WIN32
+
- -DWIN32
+
- -std=c++17
+
- -fno-builtin
+
- -isystem
+
- $SYS_INCLUDE
+
- -isystem
+
- $MINGW_MAIN_INCLUDE
+
- -isystem
+
- $CPP_INCLUDE
+
- -isystem
+
- $CPP_TARGET_INCLUDE
+
Remove:
+
- -I*/gcc/*/include
+
EOF
-
echo "โœ“ Generated .clangd config and compile_commands.json with include paths"
-
echo "โœ“ Development environment ready for Shortwave Radio development"
+
cat > compile_commands.json <<EOF
+
[
+
{
+
"directory": "$(pwd)",
+
"command": "i686-w64-mingw32-g++ -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -std=c++17 -isystem \"$SYS_INCLUDE\" -isystem \"$MINGW_MAIN_INCLUDE\" -isystem \"$CPP_INCLUDE\" -isystem \"$CPP_TARGET_INCLUDE\" -c main.cpp",
+
"file": "main.cpp"
+
}
+
]
+
EOF
'';
};
};
icon.aseprite

This is a binary file and will not be displayed.

+13 -13
installer.nsi
···
section "install"
setOutPath $INSTDIR
-
+
; Main executable
-
file "Shortwave.exe"
-
+
file "result/bin/Shortwave.exe"
+
; BASS audio library
-
file "bass.dll"
-
+
file "libs/bass.dll"
+
; License and documentation
file "LICENSE.md"
file "README.md"
-
+
; Create uninstaller
writeUninstaller "$INSTDIR\uninstall.exe"
-
+
; Start menu shortcuts
createDirectory "$SMPROGRAMS\${APPNAME}"
createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe"
createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
-
+
; Desktop shortcut
createShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe"
-
+
; Registry entries for Add/Remove Programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} - ${DESCRIPTION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
···
delete "$INSTDIR\LICENSE.md"
delete "$INSTDIR\README.md"
delete "$INSTDIR\uninstall.exe"
-
+
; Remove shortcuts
delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
rmDir "$SMPROGRAMS\${APPNAME}"
delete "$DESKTOP\${APPNAME}.lnk"
-
+
; Remove registry entries
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
-
+
; Remove installation directory
rmDir "$INSTDIR"
-
sectionEnd
+
sectionEnd
shortwave.ico

This is a binary file and will not be displayed.

+1
shortwave.rc
···
+
IDI_ICON1 ICON DISCARDABLE "shortwave.ico"