Login Page - Create Account

Support Board


Date/Time: Wed, 08 May 2024 22:08:50 +0000



Post From: How to build ACSIL study on Ubuntu/Linux

[2019-04-09 00:16:11]
Kiwi - Posts: 375
So, just finishing off.

I wrote a Python script to release the dll, compile and reload the new dll. So the Python is in a file I labelled .MinGW_compile.py:

#!/usr/local/bin/python
import sys
import socket
from subprocess import run

source_path = '/home/john/.wine/drive_c/SC64/ACS_Source/'
dest_path = '/home/john/zRamdisk/SierraData/'
win_path = 'Z:' + dest_path.replace('/', '\\')

f_name = sys.argv[1]
print(f"Compiling {f_name}.cpp")
# eliminate extra path elements if present
f_name = f_name if '/' not in f_name else f_name[-f_name[::-1].index('/'):]

# first release existing dll
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print(sock.sendto(f"RELEASE_DLL--{win_path}{f_name}.dll".encode(),
("127.0.0.1", 22903)), end=' ')

# compile to dll
run(f"/usr/bin/x86_64-w64-mingw32-g++ -march=x86-64 -mtune=x86-64 -O2 -shared " +
f"-static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions " +
f"-w {source_path}{f_name}.cpp " +
f"-o {dest_path}{f_name}_64.dll", shell=True)

# finally allow new dll to load
print(sock.sendto(f"ALLOW_LOAD_DLL--{win_path}{f_name}.dll".encode(),
("127.0.0.1", 22903)))

and the VS Code tasks.json becomes:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build_DLL",
"type": "shell",
"command": "/home/john/.MinGW_compile.py",
"args": [
"${fileBasenameNoExtension}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

And (thanks ganz) the .vimrc amendments are (I use ctrl m for compile):

nmap <C-m> :execute ':!~/.MinGW_compile.py %:r'<CR>

So now that I can compile with one key press I expect that'll remove my load from Sierra's Compile Server. :)


Note: sagi in the post above is just a zshrc alias for "yes | sudo apt-get install"
Date Time Of Last Edit: 2019-04-09 06:01:20