|
12 | 12 | type=str, |
13 | 13 | help="Optional compiler launcher (e.g., ccache, sccache)" |
14 | 14 | ) |
| 15 | +parser.add_argument( |
| 16 | + "--generator", |
| 17 | + choices=["ninja", "xcode", "visualstudio"], |
| 18 | + default="ninja", |
| 19 | + help="CMake generator to use: ninja (default), xcode, or visualstudio" |
| 20 | +) |
| 21 | +parser.add_argument( |
| 22 | + "--configure-only", |
| 23 | + action="store_true", |
| 24 | + help="Only run CMake configuration, skip the build step" |
| 25 | +) |
| 26 | + |
15 | 27 | args = parser.parse_args() |
16 | 28 |
|
17 | 29 | system = platform.system() |
|
20 | 32 | else: |
21 | 33 | cmake_compiler = [] |
22 | 34 |
|
| 35 | +if args.generator == "xcode": |
| 36 | + cmake_generator = ["-GXcode"] |
| 37 | +elif args.generator == "visualstudio": |
| 38 | + cmake_generator = ["-GVisual Studio 17 2022", "-A x64"] |
| 39 | + cmake_compiler = [] |
| 40 | +else: |
| 41 | + cmake_generator = ["-GNinja"] |
| 42 | + |
23 | 43 | # Load config.json |
24 | 44 | with open("config.json") as f: |
25 | 45 | plugins_config = json.load(f) |
|
41 | 61 | formats = plugin.get("formats", []) |
42 | 62 | is_fx = plugin.get("type", "").lower() == "fx" |
43 | 63 |
|
44 | | - build_dir = builds_parent_dir / f"Build-{name}" |
| 64 | + build_dir = builds_parent_dir / f"{args.generator}-{name}" |
45 | 65 | print(f"\nProcessing: {name}") |
46 | 66 |
|
47 | 67 | author = plugin.get("author", False) |
|
53 | 73 | cmake_configure = [ |
54 | 74 | "cmake", |
55 | 75 | "-GNinja", |
| 76 | + *cmake_generator, |
56 | 77 | *cmake_compiler, |
57 | 78 | f"-B{build_dir}", |
58 | 79 | f"-DCUSTOM_PLUGIN_NAME={name}", |
|
76 | 97 | continue |
77 | 98 |
|
78 | 99 | # Build all combinations of type + format |
79 | | - for fmt in formats: |
80 | | - if system != "Darwin" and fmt == "AU": |
81 | | - continue |
82 | | - target = f"plugdata_{'fx_' if is_fx else ''}{fmt}" |
83 | | - if fmt == "Standalone": |
84 | | - target = "plugdata_standalone" |
85 | | - |
86 | | - cmake_build = [ |
87 | | - "cmake", |
88 | | - "--build", str(build_dir), |
89 | | - "--target", target, |
90 | | - "--config Release" |
91 | | - ] |
92 | | - print(f"Building target: {target}") |
93 | | - result_build = subprocess.run(cmake_build, cwd=plugdata_dir) |
94 | | - if result_build.returncode != 0: |
95 | | - print(f"Failed to build target: {target}") |
96 | | - else: |
97 | | - print(f"Successfully built: {target}") |
98 | | - format_path = os.path.join(plugins_dir, fmt) |
99 | | - target_dir = os.path.join(build_output_dir, fmt) |
100 | | - |
101 | | - if fmt == "Standalone": |
102 | | - if os.path.isdir(format_path): |
103 | | - if os.path.exists(target_dir): |
104 | | - shutil.rmtree(target_dir) |
105 | | - shutil.copytree(format_path, target_dir) |
106 | | - else: |
107 | | - extension = "" |
108 | | - if fmt == "VST3": |
109 | | - extension = ".vst3" |
110 | | - elif fmt == "AU": |
111 | | - extension = ".component" |
112 | | - elif fmt == "LV2": |
113 | | - extension = ".lv2" |
114 | | - elif fmt == "CLAP": |
115 | | - extension = ".clap" |
116 | | - |
117 | | - plugin_filename = name + extension; |
118 | | - os.makedirs(target_dir, exist_ok=True) |
119 | | - src = os.path.join(format_path, plugin_filename); |
120 | | - dst = os.path.join(target_dir, plugin_filename); |
121 | | - if os.path.isdir(src): |
122 | | - if os.path.exists(dst): |
123 | | - shutil.rmtree(dst) |
124 | | - shutil.copytree(src, dst) |
| 100 | + if not args.configure_only: |
| 101 | + for fmt in formats: |
| 102 | + if system != "Darwin" and fmt == "AU": |
| 103 | + continue |
| 104 | + target = f"plugdata_{'fx_' if is_fx else ''}{fmt}" |
| 105 | + if fmt == "Standalone": |
| 106 | + target = "plugdata_standalone" |
| 107 | + |
| 108 | + cmake_build = [ |
| 109 | + "cmake", |
| 110 | + "--build", str(build_dir), |
| 111 | + "--target", target, |
| 112 | + "--config Release" |
| 113 | + ] |
| 114 | + print(f"Building target: {target}") |
| 115 | + result_build = subprocess.run(cmake_build, cwd=plugdata_dir) |
| 116 | + if result_build.returncode != 0: |
| 117 | + print(f"Failed to build target: {target}") |
| 118 | + else: |
| 119 | + print(f"Successfully built: {target}") |
| 120 | + format_path = os.path.join(plugins_dir, fmt) |
| 121 | + target_dir = os.path.join(build_output_dir, fmt) |
| 122 | + |
| 123 | + if fmt == "Standalone": |
| 124 | + if os.path.isdir(format_path): |
| 125 | + if os.path.exists(target_dir): |
| 126 | + shutil.rmtree(target_dir) |
| 127 | + shutil.copytree(format_path, target_dir) |
125 | 128 | else: |
126 | | - if os.path.exists(dst): |
127 | | - os.remove(dst) |
128 | | - shutil.copy2(src, dst) |
| 129 | + extension = "" |
| 130 | + if fmt == "VST3": |
| 131 | + extension = ".vst3" |
| 132 | + elif fmt == "AU": |
| 133 | + extension = ".component" |
| 134 | + elif fmt == "LV2": |
| 135 | + extension = ".lv2" |
| 136 | + elif fmt == "CLAP": |
| 137 | + extension = ".clap" |
| 138 | + |
| 139 | + plugin_filename = name + extension; |
| 140 | + os.makedirs(target_dir, exist_ok=True) |
| 141 | + src = os.path.join(format_path, plugin_filename); |
| 142 | + dst = os.path.join(target_dir, plugin_filename); |
| 143 | + if os.path.isdir(src): |
| 144 | + if os.path.exists(dst): |
| 145 | + shutil.rmtree(dst) |
| 146 | + shutil.copytree(src, dst) |
| 147 | + else: |
| 148 | + if os.path.exists(dst): |
| 149 | + os.remove(dst) |
| 150 | + shutil.copy2(src, dst) |
0 commit comments