forked from kfrlib/kfr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-sources.py
48 lines (40 loc) · 1.67 KB
/
update-sources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
from __future__ import print_function
import fnmatch
import os
import subprocess
import sys
import glob
def list_sources(name, searchpath, masks, exclude = []):
global cmake
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), searchpath)
filenames = []
for root, dirnames, files in os.walk(path, path):
for mask in masks:
for filename in fnmatch.filter(files, mask):
if filename not in exclude:
filenames.append(os.path.relpath(os.path.join(root, filename), path).replace('\\','/'))
cmake += """
set(
""" + name + """
""" + "\n ".join(['${PROJECT_SOURCE_DIR}/' + searchpath + '/' + f for f in filenames]) + """
)
"""
cmake = """
# Auto-generated file. Do not edit
# Use update-sources.py
"""
list_sources("KFR_SRC", "include", ['*.hpp', '*.h'])
list_sources("KFR_SIMD_SRC", "include/kfr/simd", ['*.hpp', '*.h'])
list_sources("KFR_MATH_SRC", "include/kfr/math", ['*.hpp', '*.h'])
list_sources("KFR_BASE_SRC", "include/kfr/base", ['*.hpp', '*.h'])
list_sources("KFR_DSP_SRC", "include/kfr/dsp", ['*.hpp', '*.h'])
list_sources("KFR_IO_SRC", "include/kfr/io", ['*.hpp', '*.h'])
list_sources("KFR_RUNTIME_SRC", "include/kfr/runtime", ['*.hpp', '*.h'])
list_sources("KFR_GRAPHICS_SRC", "include/kfr/graphics", ['*.hpp', '*.h'])
list_sources("KFR_SRC", "include", ['*.hpp', '*.h'])
list_sources("KFR_DFT_SRC", "include/kfr/dft", ['*.cpp'], ["dft-src.cpp"])
list_sources("KFR_IO_SRC", "include/kfr/io", ['*.cpp'])
list_sources("KFR_UNITTEST_SRC", "tests/unit", ['*.cpp'])
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'sources.cmake'), "w") as f:
f.write(cmake)