add BUILD.gn and corrections for compiling with Clang under GN/Ninja

This commit is contained in:
Alexander Frick
2025-11-23 19:02:00 -08:00
parent 4ead6e8beb
commit c08fdccc06
2 changed files with 99 additions and 5 deletions
+84
View File
@@ -0,0 +1,84 @@
# xp_activate32
import("//build/config/precompiled_header.gni")
import("//build/config/static_shared.gni")
import("//build/config/win/manifest.gni")
# Main executable
executable("xp_activate32") {
configs -= [
#"//build/config/win:console",
#"//build/config/win:nominmax",
]
configs += [
#"//build/config/win:windowed",
":xp_activate32_config",
]
deps = [
":xp_activate32_sources",
":xp_activate32_manifest",
]
}
# Precompiled header for common C/C++ stdlib stuff
precompiled_header("precompiled") {
precompiled_header = "src/stdafx.h"
precompiled_source = "src/stdafx.cc"
}
source_set("xp_activate32_sources") {
configs -= [ "//build/config/win:nominmax", ]
# Must explicitly set this for sources
#configs += [ "//build/config/win:windowed", ]
configs += [
":xp_activate32_config",
#":precompiled"
]
sources = [
"src/constants.h",
"src/framework.h",
"src/keygen.cc",
"src/keygen.h",
"src/resource.h",
"src/resource.rc",
"src/utils.cc",
"src/utils.h",
"src/xp_activate32.cc",
"src/xp_activate32.h",
]
}
# Program-specific build config
config("xp_activate32_config") {
cflags = []
ldflags = []
libs = [
"comctl32.lib",
"kernel32.lib",
"user32.lib",
"ole32.lib",
"oleaut32.lib",
]
}
windows_manifest("xp_activate32_manifest") {
# No-Op on XP, but need it for running on newer systems to display warning dialog.
sources = [ require_administrator_manifest ]
# Breaks program for some reason, despite it using Unicode all throughout
#sources += [ unicode_manifest, ]
# Common controls was never working in the original one, finally have it working.
if (use_common_controls) {
sources += [ common_controls_manifest, ]
}
}
group("xp_activate32_test") {
testonly = true
public_deps = [ ]
}
+15 -5
View File
@@ -2,14 +2,24 @@
#include <WinSDKVer.h>
#define WINVER _WIN32_WINNT_WINXP
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#define _WIN64_WINNT _WIN32_WINNT_WS03s // Minimum version for 64 bit
#define _WIN32_IE 0x0600 // Minimum Internet Explorer version
#ifndef WINVER
#define WINVER _WIN32_WINNT_WINXP
#endif // WINVER
#ifndef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#endif // _WIN32_WINNT
#ifndef _WIN64_WINNT
#define _WIN64_WINNT _WIN32_WINNT_WS03s // Minimum version for 64 bit
#endif // _WIN64_WINNT
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600 // Minimum Internet Explorer version
#endif // _WIN32_IE
// See https://tedwvc.wordpress.com/2014/01/01/how-to-target-xp-with-vc2012-or-vc2013-and-continue-to-use-the-windows-8-x-sdk/
//#define _USING_V110_SDK71_
#define _ATL_XP_TARGETING
#ifndef _ATL_XP_TARGETING
#define _ATL_XP_TARGETING
#endif // _ATL_XP_TARGETING
#include <SDKDDKVer.h>