@@ -1703,6 +1703,9 @@ void FSkookumScriptGenerator::save_generated_cpp_files(eClassScope class_scope)
17031703 // ---------------------------------------------------------------------------------------
17041704 // 1) Determine output path
17051705
1706+ // Store the project module so we can query it later
1707+ const ModuleInfo* ProjectModule = nullptr ;
1708+
17061709 FString binding_code_directory_path;
17071710 if (class_scope == ClassScope_project)
17081711 {
@@ -1713,6 +1716,7 @@ void FSkookumScriptGenerator::save_generated_cpp_files(eClassScope class_scope)
17131716 {
17141717 // Found it, use its generated_include_folder path
17151718 binding_code_directory_path = module .m_generated_include_folder ;
1719+ ProjectModule = &module ;
17161720 break ;
17171721 }
17181722 }
@@ -1792,6 +1796,25 @@ void FSkookumScriptGenerator::save_generated_cpp_files(eClassScope class_scope)
17921796 include_file_path.RemoveFromStart (" Public/" );
17931797 }
17941798
1799+ if (class_scope == ClassScope_project && ProjectModule != nullptr )
1800+ {
1801+ for (UClass* C : ProjectModule->m_classes_to_export )
1802+ {
1803+ // If the include file matches a class name that our project module exports, e.g:
1804+ // HardwareConnection == Components/HardwareConnection.h
1805+ // Then prefix the include with our module name so it becomes:
1806+ // ModuleName/Components/HardwareConnection.h
1807+ // Clang (Android) does not have very resilient extra include paths defined or something and will
1808+ // be unable to find these includes otherwise.
1809+ const FString BaseFileName = FPaths::GetBaseFilename (include_file_path);
1810+ if (C->GetName () == *BaseFileName)
1811+ {
1812+ include_file_path = m_current_target_p->m_project_name + TEXT (" /" ) + include_file_path;
1813+ break ;
1814+ }
1815+ }
1816+ }
1817+
17951818 if (!include_file_path.IsEmpty ())
17961819 {
17971820 class_header_code += FString::Printf (TEXT (" #include \" %s\"\n " ), *include_file_path);
0 commit comments