Skip to content

Commit

Permalink
Add support for VS 2019, cleanup setup.py
Browse files Browse the repository at this point in the history
Added support for Visual Studio 2019 to compile wxWidgets.

Also cleaned up setup.py to have non-repeating code to easily decipher and modify.
  • Loading branch information
garrettsummerfi3ld committed Oct 26, 2023
1 parent a609a54 commit e72b5f2
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
finalpath = "C:\\wxWidgets-3.2.2.1"
checksum = "032fb3fe03d62253927cbdac3982bfbac1e5633d"
pbar = None

configuration = [ "Debug", "Release" ]

Check notice on line 16 in setup.py

View workflow job for this annotation

GitHub Actions / qodana

PEP 8 coding style violation

PEP 8: E201 whitespace after '\['

Check notice on line 16 in setup.py

View workflow job for this annotation

GitHub Actions / qodana

PEP 8 coding style violation

PEP 8: E202 whitespace before '\]'
platform = [ "x64", "Win32" ]

Check notice on line 17 in setup.py

View workflow job for this annotation

GitHub Actions / qodana

PEP 8 coding style violation

PEP 8: E202 whitespace before '\]'

Check notice on line 17 in setup.py

View workflow job for this annotation

GitHub Actions / qodana

PEP 8 coding style violation

PEP 8: E201 whitespace after '\['

def main():

Check notice on line 19 in setup.py

View workflow job for this annotation

GitHub Actions / qodana

PEP 8 coding style violation

PEP 8: E302 expected 2 blank lines, found 1
# Main
Expand Down Expand Up @@ -61,19 +62,15 @@ def extract_wxwidgets():

def build_wxwidgets():
# Build wxWidgets
# It is a bit of a hack, but it works
msbuild_path = find_msbuild()
vsversion = determine_msbuild_vs_version()
print(msbuild_path)
print("[-] Building wxWidgets...")
os.chdir(f"{finalpath}\\build\\msw")
print("[-] Building wxWidgets Debug (x64)...")
subprocess.run([msbuild_path, "wx_vc17.sln", "/p:Configuration=Debug", "/p:Platform=x64"])
print("[-] Building wxWidgets Release (x64)...")
subprocess.run([msbuild_path, "wx_vc17.sln", "/p:Configuration=Release", "/p:Platform=x64"])
print("[-] Building wxWidgets Debug (Win32)...")
subprocess.run([msbuild_path, "wx_vc17.sln", "/p:Configuration=Debug", "/p:Platform=Win32"])
print("[-] Building wxWidgets Release (Win32)...")
subprocess.run([msbuild_path, "wx_vc17.sln", "/p:Configuration=Release", "/p:Platform=Win32"])
for config in configuration:
for plat in platform:
print(f"[-] Building wxWidgets {config} ({plat})...")
subprocess.run([msbuild_path, f"wx_vc{vsversion}.sln", f"/p:Configuration={config}", f"/p:Platform={plat}"])
print("[-] Build complete!")


Expand All @@ -96,6 +93,17 @@ def find_msbuild():
print("[!] Could not find msbuild.exe!")
exit(0)

def determine_msbuild_vs_version():

Check notice on line 96 in setup.py

View workflow job for this annotation

GitHub Actions / qodana

PEP 8 coding style violation

PEP 8: E302 expected 2 blank lines, found 1
# Determine which version of Visual Studio is installed
print("[-] Determining which version of Visual Studio is installed...")
vsversion = vswhere.get_latest_major_version()
if vsversion is not None:
print(f"[-] Visual Studio {vsversion} is installed!")
return vsversion
else:
print("[!] Could not determine which version of Visual Studio is installed!")
exit(1)


def check_admin():
# Check if running as admin
Expand Down

0 comments on commit e72b5f2

Please sign in to comment.