V0.32.3.250623_alpha:优化接口生成后端C++库
This commit is contained in:
parent
ba9b024cd9
commit
ad5354f5d5
22
Release/Configuration/C909_V1/IDL/ATA04/CMakeLists.txt
Normal file
22
Release/Configuration/C909_V1/IDL/ATA04/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
# ATA04接口的源文件
|
||||
set(ATA04_SOURCES
|
||||
Aerodynamics_input.hpp
|
||||
Aerodynamics_input.cxx
|
||||
GroundHandling_input.hpp
|
||||
GroundHandling_input.cxx
|
||||
GroundHandling_output.hpp
|
||||
GroundHandling_output.cxx
|
||||
Aerodynamics_output.hpp
|
||||
Aerodynamics_output.cxx
|
||||
WeightBalance_input.hpp
|
||||
WeightBalance_input.cxx
|
||||
WeightBalance_output.hpp
|
||||
WeightBalance_output.cxx
|
||||
GroundHandling_heartbeat.hpp
|
||||
GroundHandling_heartbeat.cxx
|
||||
WeightBalance_heartbeat.hpp
|
||||
WeightBalance_heartbeat.cxx
|
||||
Aerodynamics_heartbeat.hpp
|
||||
Aerodynamics_heartbeat.cxx
|
||||
)
|
||||
list(APPEND ALL_SUBDIR_SOURCES ${ATA04_SOURCES})
|
@ -16,6 +16,8 @@ if(NOT fastdds_FOUND)
|
||||
find_package(fastdds 3 REQUIRED)
|
||||
endif()
|
||||
find_package(OpenSSL REQUIRED)
|
||||
set(ALL_SUBDIR_SOURCES "")
|
||||
add_subdirectory(ATA04)
|
||||
add_library(C909_V1_Interface SHARED
|
||||
C909_V1.hpp
|
||||
C909_V1CdrAux.hpp
|
||||
@ -25,24 +27,7 @@ add_library(C909_V1_Interface SHARED
|
||||
C909_V1TypeObjectSupport.hpp
|
||||
C909_V1TypeObjectSupport.cxx
|
||||
C909_V1_Interface.h
|
||||
ATA04/Aerodynamics_input.hpp
|
||||
ATA04/Aerodynamics_input.cxx
|
||||
ATA04/GroundHandling_input.hpp
|
||||
ATA04/GroundHandling_input.cxx
|
||||
ATA04/GroundHandling_output.hpp
|
||||
ATA04/GroundHandling_output.cxx
|
||||
ATA04/Aerodynamics_output.hpp
|
||||
ATA04/Aerodynamics_output.cxx
|
||||
ATA04/WeightBalance_input.hpp
|
||||
ATA04/WeightBalance_input.cxx
|
||||
ATA04/WeightBalance_output.hpp
|
||||
ATA04/WeightBalance_output.cxx
|
||||
ATA04/GroundHandling_heartbeat.hpp
|
||||
ATA04/GroundHandling_heartbeat.cxx
|
||||
ATA04/WeightBalance_heartbeat.hpp
|
||||
ATA04/WeightBalance_heartbeat.cxx
|
||||
ATA04/Aerodynamics_heartbeat.hpp
|
||||
ATA04/Aerodynamics_heartbeat.cxx
|
||||
${ALL_SUBDIR_SOURCES}
|
||||
)
|
||||
target_link_libraries(C909_V1_Interface PRIVATE
|
||||
fastcdr fastdds OpenSSL::SSL OpenSSL::Crypto
|
||||
|
Binary file not shown.
@ -38,6 +38,13 @@ bool CMakeListsGen::generateCMakeLists(const AllInterfaceData &interfaceData,
|
||||
|
||||
cmakeFile << "find_package(OpenSSL REQUIRED)" << std::endl;
|
||||
|
||||
cmakeFile << "set(ALL_SUBDIR_SOURCES \"\")" << std::endl;
|
||||
|
||||
for (const auto &ataInterfaceData : interfaceData.ataInterfaceData) {
|
||||
std::string ataName = ataInterfaceData.ataName;
|
||||
cmakeFile << "add_subdirectory(" << ataName << ")" << std::endl;
|
||||
}
|
||||
|
||||
cmakeFile << "add_library(" << configName << "_Interface SHARED" << std::endl;
|
||||
cmakeFile << " " << configName << ".hpp" << std::endl;
|
||||
cmakeFile << " " << configName << "CdrAux.hpp" << std::endl;
|
||||
@ -47,14 +54,7 @@ bool CMakeListsGen::generateCMakeLists(const AllInterfaceData &interfaceData,
|
||||
cmakeFile << " " << configName << "TypeObjectSupport.hpp" << std::endl;
|
||||
cmakeFile << " " << configName << "TypeObjectSupport.cxx" << std::endl;
|
||||
cmakeFile << " " << configName << "_Interface.h" << std::endl;
|
||||
for (const auto &ataInterfaceData : interfaceData.ataInterfaceData) {
|
||||
std::string ataName = ataInterfaceData.ataName;
|
||||
for (const auto &structInterfaceData : ataInterfaceData.structInterfaceData) {
|
||||
std::string structName = structInterfaceData.modelStructName;
|
||||
cmakeFile << " " << ataName << "/" << structName << ".hpp" << std::endl;
|
||||
cmakeFile << " " << ataName << "/" << structName << ".cxx" << std::endl;
|
||||
}
|
||||
}
|
||||
cmakeFile << " ${ALL_SUBDIR_SOURCES}" << std::endl;
|
||||
cmakeFile << ")" << std::endl;
|
||||
|
||||
cmakeFile << "target_link_libraries(" << configName << "_Interface PRIVATE" << std::endl;
|
||||
|
@ -10,7 +10,7 @@ bool DDSInterfaceGen::generateDDSInterface(const AllInterfaceData &interfaceData
|
||||
{
|
||||
std::string systemName = interfaceData.systemName;
|
||||
std::string planeName = interfaceData.planeName;
|
||||
|
||||
// 生成包含所有接口的头文件
|
||||
std::string headerFilePath = IDLPath + "/" + IDLName + "_Interface.h";
|
||||
std::ofstream headerFile(headerFilePath);
|
||||
headerFile << "#pragma once" << std::endl;
|
||||
@ -19,6 +19,11 @@ bool DDSInterfaceGen::generateDDSInterface(const AllInterfaceData &interfaceData
|
||||
std::string interfaceFolderPath = IDLPath + "/" + ataName;
|
||||
fs::create_directories(interfaceFolderPath);
|
||||
std::string nameSpace = systemName + "::" + planeName + "::" + ataName;
|
||||
// 生成每个ATA章节子文件夹的CMakeLists.txt文件
|
||||
std::ofstream cmakeListsPath(interfaceFolderPath + "/CMakeLists.txt");
|
||||
cmakeListsPath << "# " << ataName << "接口的源文件" << std::endl;
|
||||
cmakeListsPath << "set(" << ataName << "_SOURCES " << std::endl;
|
||||
|
||||
for (const auto &structData : ata.structInterfaceData) {
|
||||
std::string structName = structData.modelStructName;
|
||||
generateDDSInterfaceHpp(nameSpace, structName, interfaceFolderPath,
|
||||
@ -26,7 +31,15 @@ bool DDSInterfaceGen::generateDDSInterface(const AllInterfaceData &interfaceData
|
||||
generateDDSInterfaceCxx(nameSpace, structName, interfaceFolderPath,
|
||||
structData.interfaceData);
|
||||
headerFile << "#include \"" << ataName << "/" << structName << ".hpp\"" << std::endl;
|
||||
|
||||
cmakeListsPath << " " << structName << ".hpp" << std::endl;
|
||||
cmakeListsPath << " " << structName << ".cxx" << std::endl;
|
||||
}
|
||||
cmakeListsPath << ")" << std::endl;
|
||||
// 将ATA04的源文件添加到父目录的ALL_SUBDIR_SOURCES变量中
|
||||
cmakeListsPath << "list(APPEND ALL_SUBDIR_SOURCES ${" << ataName << "_SOURCES})"
|
||||
<< std::endl;
|
||||
cmakeListsPath.close();
|
||||
}
|
||||
headerFile.close();
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user