Skip to content

Commit 9638d03

Browse files
committed
Add header copying script.
1 parent 5eeae5f commit 9638d03

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/scripts/prepare_headers.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os.path
2+
import subprocess
3+
4+
from script_config import BuildConfig
5+
6+
7+
def run(config: BuildConfig):
8+
header_directories = [
9+
os.path.join(config.LDK_C_BINDINGS_DIRECTORY, 'include'),
10+
os.path.join(config.LDK_C_BINDINGS_BASE, 'ldk-net'),
11+
]
12+
13+
header_destination_directory = os.path.realpath(os.path.join(os.path.dirname(__file__), '../../xcode/LDKFramework/headers'))
14+
os.makedirs(header_destination_directory, exist_ok=True)
15+
16+
for current_directory in header_directories:
17+
for current_file in os.listdir(current_directory):
18+
19+
is_relevant_file = current_file.endswith('.h') or current_file.endswith('.c')
20+
if not is_relevant_file:
21+
continue
22+
23+
current_path = os.path.join(current_directory, current_file)
24+
if not os.path.isfile(current_path):
25+
continue
26+
27+
subprocess.check_call(['cp', current_path, header_destination_directory])
28+
29+
30+
if __name__ == '__main__':
31+
config = BuildConfig.parse(allow_ldk_argument=True)
32+
run(config)

0 commit comments

Comments
 (0)