Skip to content

Commit 3195b42

Browse files
committed
Migrates to premake
1 parent 48bf657 commit 3195b42

File tree

99 files changed

+537
-964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+537
-964
lines changed

Diff for: build.cmd

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
py scripts/build.py %*

Diff for: plugins/crow-jmdict-parser/crow-jmdict-parser.vcxproj

-183
This file was deleted.

Diff for: premake5.lua

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require "scripts/clear"
2+
require "scripts/info"
3+
4+
workspace "sore-crow"
5+
architecture "x64"
6+
configurations {
7+
"Debug",
8+
"Release",
9+
"Deploy"
10+
}
11+
12+
startproject "sore-crow"
13+
14+
output_path = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
15+
binaries_path = "%{wks.location}/bin/" .. "%{output_path}"
16+
intermediate_path = "%{wks.location}/intermediate/" .. "%{output_path}"
17+
vendor_path = "%{wks.location}/vendor/"
18+
qt_path = os.getenv("QTDIR") or os.getenv("QT_DIR")
19+
20+
include "vendor"
21+
include "sore-crow"
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: sore-crow/res/mpv.conf renamed to res/mpv.conf

File renamed without changes.

Diff for: scripts/build.py

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import os
2+
import sys
3+
import subprocess
4+
from build_qt import *
5+
from deploy import deploy
6+
from project_config import *
7+
8+
utility_actions = ['clear', 'info']
9+
10+
11+
# Premake Comands:
12+
def get_premake_actions() -> list[str]:
13+
process = subprocess.run(["premake5", "--help"], capture_output=True)
14+
output = process.stdout.decode("utf-8")
15+
actions_index = output.find('ACTIONS') + len('ACTIONS')
16+
actions_output = output[actions_index:]
17+
18+
actions = []
19+
for action_string in actions_output.splitlines():
20+
if action_string.find('https://premake.github.io') != -1:
21+
continue
22+
23+
action_args = action_string.split(' ')
24+
filtered = list(filter(lambda x: len(x) > 0, action_args))
25+
if len(filtered) <= 0:
26+
continue
27+
28+
# Ignores clean:
29+
action = filtered[0]
30+
if action == 'clean':
31+
continue
32+
33+
actions.append(filtered[0])
34+
35+
actions.append('deploy')
36+
return actions
37+
38+
39+
def help_premake_actions():
40+
process = subprocess.run(["premake5", "--help"], capture_output=True)
41+
output = process.stdout.decode("utf-8")
42+
43+
# Only show actions:
44+
actions_index = output.find('ACTIONS')
45+
actions_output = output[actions_index:]
46+
47+
# Extra Cleanup:
48+
output = ''
49+
for line in actions_output.splitlines():
50+
sanitized_line = line.strip()
51+
52+
if sanitized_line.startswith('clean') or sanitized_line.find('https://premake.github.io') != -1:
53+
continue
54+
55+
if line.isspace() or len(line) == 0:
56+
output += '\n'
57+
elif line.startswith('ACTIONS'):
58+
output += 'Available Actions:'
59+
else:
60+
output += f"* {sanitized_line}\n"
61+
62+
print(output.rstrip())
63+
64+
65+
def execute_premake(action: str) -> None:
66+
subprocess.run(["premake5", action])
67+
68+
69+
# Premake Actions:
70+
def is_action_utility(action: str) -> bool:
71+
return action in utility_actions
72+
73+
74+
def is_action_build(action: str) -> bool:
75+
return not is_action_utility(action)
76+
77+
78+
# Main:
79+
def main():
80+
if len(sys.argv) < 2:
81+
help_premake_actions()
82+
return
83+
84+
action = sys.argv[1]
85+
86+
project_configs = get_project_premake_project_configs()
87+
88+
if not action in get_premake_actions():
89+
print(f"The action '{action}' is not valid. Run the command without arguments to see a list of available actions.")
90+
return
91+
92+
if is_action_utility(action):
93+
execute_premake(action)
94+
return
95+
96+
# Project Information:
97+
for project_config in project_configs:
98+
if action == 'deploy':
99+
if project_config.project_name == 'sore-crow':
100+
deploy(project_config)
101+
continue
102+
103+
prepare_binary_directories(project_config)
104+
105+
# Build steps:
106+
build_qt_step(project_config)
107+
execute_premake(action)
108+
deploy(project_config)
109+
110+
111+
if __name__ == '__main__':
112+
main()

0 commit comments

Comments
 (0)