@@ -80,16 +80,22 @@ fn parallel_cc(mut b builder.Builder, result c.GenOutput) ! {
8080 mut compile_args := b.get_compile_args ()
8181 mut linker_args := b.get_linker_args ()
8282 if b.ccoptions.cc == .tcc {
83- // vlang/tcc has its system headers under `${vroot}/thirdparty/tcc/lib/tcc/include/`
84- // and its runtime objects (libtcc1.a, bt-*.o) under `${vroot}/thirdparty/tcc/lib/tcc /`.
83+ // vlang/tcc can have its system headers and runtime objects either under
84+ // `${vroot}/thirdparty/tcc/lib/tcc/` or directly under `${vroot}/thirdparty/tcc/lib/`.
8585 // `-B` controls tcc's include search (`${B}/include`) and `-L` adds a library search path,
8686 // so pass absolute paths for both. This lets tcc find them regardless of the cwd from
8787 // which v was invoked, without affecting how user-supplied relative flags are resolved.
88- tcc_install_dir := os.join_path (@VEXEROOT, 'thirdparty' , 'tcc' , 'lib' , 'tcc' )
88+ tcc_lib_dir := os.join_path (@VEXEROOT, 'thirdparty' , 'tcc' , 'lib' )
89+ tcc_nested_dir := os.join_path (tcc_lib_dir, 'tcc' )
90+ tcc_install_dir := if os.is_dir (tcc_nested_dir) { tcc_nested_dir } else { tcc_lib_dir }
8991 if os.is_dir (tcc_install_dir) {
9092 tcc_b_arg := '-B${b .tcc_quoted_path (tcc_install_dir )}'
9193 tcc_l_arg := '-L${b .tcc_quoted_path (tcc_install_dir )}'
94+ tcc_include_dir := os.join_path (tcc_install_dir, 'include' )
9295 compile_args << tcc_b_arg
96+ if os.is_dir (tcc_include_dir) {
97+ compile_args << '-I${b .tcc_quoted_path (tcc_include_dir )}'
98+ }
9399 linker_args << tcc_b_arg
94100 linker_args << tcc_l_arg
95101 }
0 commit comments