+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()
+39
-97
flake.nix
+39
-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
···
172
126
];
173
127
174
128
shellHook = ''
175
-
echo "Shortwave Radio development environment loaded"
176
-
echo "Available commands:"
177
-
echo " nix build - Build the Shortwave Radio application"
178
-
echo " nix build .#installer - Build Windows installer"
179
-
echo " build-installer - Build installer (shortcut)"
180
-
echo " deploy-to-xp - Deploy to XP VM folder"
181
-
echo ""
182
-
echo "Setting up development environment..."
183
-
184
-
# Get dynamic paths from nix packages
185
-
GCC_BASE="${pkgs.pkgsCross.mingw32.buildPackages.gcc}/i686-w64-mingw32"
186
-
SYS_INCLUDE="$GCC_BASE/sys-include"
187
-
MINGW_MAIN_INCLUDE="${pkgs.pkgsCross.mingw32.windows.mingw_w64.dev}/include"
188
-
CPP_INCLUDE="${pkgs.lib.getDev pkgs.pkgsCross.mingw32.buildPackages.gcc}/include/c++/10.3.0"
189
-
CPP_TARGET_INCLUDE="$CPP_INCLUDE/i686-w64-mingw32"
190
-
191
-
# Auto-generate .clangd config with correct paths
192
-
cat > .clangd << EOF
193
-
CompileFlags:
194
-
Add:
195
-
- -target
196
-
- i686-w64-mingw32
197
-
- -DWINVER=0x0501
198
-
- -D_WIN32_WINNT=0x0501
199
-
- -DWIN32_LEAN_AND_MEAN
200
-
- -D_WIN32
201
-
- -DWIN32
202
-
- -std=c++17
203
-
- -fno-builtin
204
-
- -isystem
205
-
- $SYS_INCLUDE
206
-
- -isystem
207
-
- $MINGW_MAIN_INCLUDE
208
-
- -isystem
209
-
- $CPP_INCLUDE
210
-
- -isystem
211
-
- $CPP_TARGET_INCLUDE
212
-
Remove:
213
-
- -I*/gcc/*/include
214
-
EOF
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"
215
135
216
-
cat > compile_commands.json << EOF
217
-
[
218
-
{
219
-
"directory": "$(pwd)",
220
-
"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",
221
-
"file": "main.cpp"
222
-
}
223
-
]
224
-
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
225
160
226
-
echo "✓ Generated .clangd config and compile_commands.json with include paths"
227
-
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
228
170
'';
229
171
};
230
172
};
icon.aseprite
icon.aseprite
This is a binary file and will not be displayed.
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"