+8
-4
CMakeLists.txt
+8
-4
CMakeLists.txt
···
14
14
add_compile_options(-fno-threadsafe-statics)
15
15
add_compile_options(-D_GLIBCXX_HAS_GTHREADS=0)
16
16
17
-
add_executable(ShortwaveApp WIN32 main.cpp)
17
+
if(MINGW)
18
+
set(WIN32_ICON shortwave.rc)
19
+
endif()
20
+
21
+
add_executable(ShortwaveApp WIN32 main.cpp ${WIN32_ICON})
18
22
19
23
# Add BASS library from libs directory
20
24
target_include_directories(ShortwaveApp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
···
24
28
target_include_directories(ShortwaveApp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
25
29
26
30
# Minimal static linking and avoid threading dependencies
27
-
target_link_options(ShortwaveApp PRIVATE
28
-
-static-libgcc
31
+
target_link_options(ShortwaveApp PRIVATE
32
+
-static-libgcc
29
33
-static-libstdc++
30
34
-static
31
35
-Wl,--subsystem,windows:5.01
···
51
55
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}"
52
56
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}"
53
57
)
54
-
endif()
58
+
endif()
+40
-97
flake.nix
+40
-97
flake.nix
···
65
65
'';
66
66
};
67
67
68
-
installer = pkgs.stdenv.mkDerivation {
69
-
name = "shortwave-installer";
70
-
version = "1.0.0";
71
-
src = ./.;
72
-
73
-
nativeBuildInputs = with pkgs; [
74
-
nsis
75
-
];
76
-
77
-
buildInputs = [ self'.packages.shortwave ];
78
-
buildPhase = ''
79
-
# Create staging directory
80
-
mkdir -p staging
81
-
82
-
# Copy executable and DLLs
83
-
cp ${self'.packages.shortwave}/bin/Shortwave.exe staging/
84
-
85
-
cp libs/bass.dll staging/
86
-
87
-
cp shortwave.ico staging/
88
-
89
-
# Copy documentation
90
-
cp LICENSE.md staging/
91
-
cp README.md staging/
92
-
93
-
# Build installer
94
-
cd staging
95
-
makensis -NOCD ../installer.nsi
96
-
97
-
# Rename output to expected installer name
98
-
if [ -f ShortwaveRadioInstaller.exe ]; then
99
-
mv ShortwaveRadioInstaller.exe ../
100
-
else
101
-
echo "โ Installer was not created by makensis"
102
-
exit 1
103
-
fi
104
-
cd ..
105
-
ls
106
-
'';
107
-
108
-
installPhase = ''
109
-
mkdir -p $out/bin
110
-
cp ShortwaveRadioInstaller.exe $out/bin/
111
-
'';
112
-
};
113
-
114
68
deploy-to-xp = pkgs.writeShellScriptBin "deploy-to-xp" ''
115
69
echo "rebuilding program"
116
70
nix build
···
168
122
pkgsCross.mingw32.buildPackages.gcc
169
123
self'.packages.deploy-to-xp
170
124
self'.packages.build-installer
125
+
nsis
171
126
];
172
127
173
128
shellHook = ''
174
-
echo "Shortwave Radio development environment loaded"
175
-
echo "Available commands:"
176
-
echo " nix build - Build the Shortwave Radio application"
177
-
echo " nix build .#installer - Build Windows installer"
178
-
echo " build-installer - Build installer (shortcut)"
179
-
echo " deploy-to-xp - Deploy to XP VM folder"
180
-
echo ""
181
-
echo "Setting up development environment..."
129
+
# Get dynamic paths from nix packages
130
+
GCC_BASE="${pkgs.pkgsCross.mingw32.buildPackages.gcc}/i686-w64-mingw32"
131
+
SYS_INCLUDE="$GCC_BASE/sys-include"
132
+
MINGW_MAIN_INCLUDE="${pkgs.pkgsCross.mingw32.windows.mingw_w64.dev}/include"
133
+
CPP_INCLUDE="${pkgs.lib.getDev pkgs.pkgsCross.mingw32.buildPackages.gcc}/include/c++/10.3.0"
134
+
CPP_TARGET_INCLUDE="$CPP_INCLUDE/i686-w64-mingw32"
182
135
183
-
# Get dynamic paths from nix packages
184
-
GCC_BASE="${pkgs.pkgsCross.mingw32.buildPackages.gcc}/i686-w64-mingw32"
185
-
SYS_INCLUDE="$GCC_BASE/sys-include"
186
-
MINGW_MAIN_INCLUDE="${pkgs.pkgsCross.mingw32.windows.mingw_w64.dev}/include"
187
-
CPP_INCLUDE="${pkgs.lib.getDev pkgs.pkgsCross.mingw32.buildPackages.gcc}/include/c++/10.3.0"
188
-
CPP_TARGET_INCLUDE="$CPP_INCLUDE/i686-w64-mingw32"
189
-
190
-
# Auto-generate .clangd config with correct paths
191
-
cat > .clangd << EOF
192
-
CompileFlags:
193
-
Add:
194
-
- -target
195
-
- i686-w64-mingw32
196
-
- -DWINVER=0x0501
197
-
- -D_WIN32_WINNT=0x0501
198
-
- -DWIN32_LEAN_AND_MEAN
199
-
- -D_WIN32
200
-
- -DWIN32
201
-
- -std=c++17
202
-
- -fno-builtin
203
-
- -isystem
204
-
- $SYS_INCLUDE
205
-
- -isystem
206
-
- $MINGW_MAIN_INCLUDE
207
-
- -isystem
208
-
- $CPP_INCLUDE
209
-
- -isystem
210
-
- $CPP_TARGET_INCLUDE
211
-
Remove:
212
-
- -I*/gcc/*/include
213
-
EOF
214
-
215
-
cat > compile_commands.json << EOF
216
-
[
217
-
{
218
-
"directory": "$(pwd)",
219
-
"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",
220
-
"file": "main.cpp"
221
-
}
222
-
]
223
-
EOF
136
+
# Auto-generate .clangd config with correct paths
137
+
cat > .clangd <<EOF
138
+
CompileFlags:
139
+
Add:
140
+
- -target
141
+
- i686-w64-mingw32
142
+
- -DWINVER=0x0501
143
+
- -D_WIN32_WINNT=0x0501
144
+
- -DWIN32_LEAN_AND_MEAN
145
+
- -D_WIN32
146
+
- -DWIN32
147
+
- -std=c++17
148
+
- -fno-builtin
149
+
- -isystem
150
+
- $SYS_INCLUDE
151
+
- -isystem
152
+
- $MINGW_MAIN_INCLUDE
153
+
- -isystem
154
+
- $CPP_INCLUDE
155
+
- -isystem
156
+
- $CPP_TARGET_INCLUDE
157
+
Remove:
158
+
- -I*/gcc/*/include
159
+
EOF
224
160
225
-
echo "โ Generated .clangd config and compile_commands.json with include paths"
226
-
echo "โ Development environment ready for Shortwave Radio development"
161
+
cat > compile_commands.json <<EOF
162
+
[
163
+
{
164
+
"directory": "$(pwd)",
165
+
"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",
166
+
"file": "main.cpp"
167
+
}
168
+
]
169
+
EOF
227
170
'';
228
171
};
229
172
};
icon.aseprite
icon.aseprite
This is a binary file and will not be displayed.
+13
-13
installer.nsi
+13
-13
installer.nsi
···
44
44
45
45
section "install"
46
46
setOutPath $INSTDIR
47
-
47
+
48
48
; Main executable
49
-
file "Shortwave.exe"
50
-
49
+
file "result/bin/Shortwave.exe"
50
+
51
51
; BASS audio library
52
-
file "bass.dll"
53
-
52
+
file "libs/bass.dll"
53
+
54
54
; License and documentation
55
55
file "LICENSE.md"
56
56
file "README.md"
57
-
57
+
58
58
; Create uninstaller
59
59
writeUninstaller "$INSTDIR\uninstall.exe"
60
-
60
+
61
61
; Start menu shortcuts
62
62
createDirectory "$SMPROGRAMS\${APPNAME}"
63
63
createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe"
64
64
createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
65
-
65
+
66
66
; Desktop shortcut
67
67
createShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe"
68
-
68
+
69
69
; Registry entries for Add/Remove Programs
70
70
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} - ${DESCRIPTION}"
71
71
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
···
99
99
delete "$INSTDIR\LICENSE.md"
100
100
delete "$INSTDIR\README.md"
101
101
delete "$INSTDIR\uninstall.exe"
102
-
102
+
103
103
; Remove shortcuts
104
104
delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
105
105
delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
106
106
rmDir "$SMPROGRAMS\${APPNAME}"
107
107
delete "$DESKTOP\${APPNAME}.lnk"
108
-
108
+
109
109
; Remove registry entries
110
110
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
111
-
111
+
112
112
; Remove installation directory
113
113
rmDir "$INSTDIR"
114
-
sectionEnd
114
+
sectionEnd
shortwave.ico
shortwave.ico
This is a binary file and will not be displayed.
+1
shortwave.rc
+1
shortwave.rc
···
1
+
IDI_ICON1 ICON DISCARDABLE "shortwave.ico"