mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-25 21:40:04 +00:00
Refactor top-level file generation function.
This commit is contained in:
parent
f50243e683
commit
a8a2c5f910
@ -121,35 +121,7 @@ add_executable(VulkanHppGenerator
|
|||||||
${TINYXML2_HEADERS}
|
${TINYXML2_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_enums.hpp vulkan_enums_hpp)
|
target_compile_definitions(${PROJECT_NAME} PUBLIC -DBASE_PATH="${CMAKE_SOURCE_DIR}")
|
||||||
string(REPLACE "\\" "\\\\" vulkan_enums_hpp ${vulkan_enums_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_format_traits.hpp vulkan_format_traits_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_format_traits_hpp ${vulkan_format_traits_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_funcs.hpp vulkan_funcs_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_funcs_hpp ${vulkan_funcs_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp vulkan_handles_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_handles_hpp ${vulkan_handles_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp vulkan_hash_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_hash_hpp ${vulkan_hash_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp vulkan_raii_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_raii_hpp ${vulkan_raii_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_static_asserts.hpp vulkan_static_asserts_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_static_asserts_hpp ${vulkan_static_asserts_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp vulkan_structs_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_structs_hpp ${vulkan_structs_hpp})
|
|
||||||
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_to_string.hpp vulkan_to_string_hpp)
|
|
||||||
string(REPLACE "\\" "\\\\" vulkan_to_string_hpp ${vulkan_to_string_hpp})
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC
|
|
||||||
-DVULKAN_ENUMS_HPP_FILE="${vulkan_enums_hpp}"
|
|
||||||
-DVULKAN_FORMAT_TRAITS_HPP_FILE="${vulkan_format_traits_hpp}"
|
|
||||||
-DVULKAN_FUNCS_HPP_FILE="${vulkan_funcs_hpp}"
|
|
||||||
-DVULKAN_HANDLES_HPP_FILE="${vulkan_handles_hpp}"
|
|
||||||
-DVULKAN_HASH_HPP_FILE="${vulkan_hash_hpp}"
|
|
||||||
-DVULKAN_RAII_HPP_FILE="${vulkan_raii_hpp}"
|
|
||||||
-DVULKAN_STATIC_ASSERTS_HPP_FILE="${vulkan_static_asserts_hpp}"
|
|
||||||
-DVULKAN_STRUCTS_HPP_FILE="${vulkan_structs_hpp}"
|
|
||||||
-DVULKAN_TO_STRING_HPP_FILE="${vulkan_to_string_hpp}"
|
|
||||||
-DBASE_PATH="${CMAKE_SOURCE_DIR}")
|
|
||||||
|
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -25,24 +25,16 @@ class VulkanHppGenerator
|
|||||||
public:
|
public:
|
||||||
VulkanHppGenerator( tinyxml2::XMLDocument const & document );
|
VulkanHppGenerator( tinyxml2::XMLDocument const & document );
|
||||||
|
|
||||||
std::string generateBitmasks() const;
|
void generateVulkanEnumsHppFile() const;
|
||||||
std::string generateBitmasksToString() const;
|
void generateVulkanFormatTraitsHppFile() const;
|
||||||
std::string generateCommandDefinitions() const;
|
void generateVulkanFuncsHppFile() const;
|
||||||
std::string generateEnums() const;
|
void generateVulkanHandlesHppFile() const;
|
||||||
std::string generateEnumsToString() const;
|
void generateVulkanHashHppFile() const;
|
||||||
std::string generateFormatTraits() const;
|
void generateVulkanHppFile() const;
|
||||||
std::string generateHandles() const;
|
void generateVulkanRAIIHppFile() const;
|
||||||
std::string generateHandleHashStructures() const;
|
void generateStructsHppFile() const;
|
||||||
std::string generateIndexTypeTraits() const;
|
void generateToStringHppFile() const;
|
||||||
std::string generateRAIICommandDefinitions() const;
|
void prepareRAIIHandles();
|
||||||
std::string generateRAIIDispatchers() const;
|
|
||||||
std::string generateRAIIHandles() const;
|
|
||||||
std::string generateStructForwardDeclarations() const;
|
|
||||||
std::string generateStructHashStructures() const;
|
|
||||||
std::string generateStructs() const;
|
|
||||||
void generateVulkanHppFile() const;
|
|
||||||
std::string const & getVulkanLicenseHeader() const;
|
|
||||||
void prepareRAIIHandles();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TypeInfo
|
struct TypeInfo
|
||||||
@ -452,9 +444,11 @@ private:
|
|||||||
std::set<size_t> const & templatedParams,
|
std::set<size_t> const & templatedParams,
|
||||||
bool chained,
|
bool chained,
|
||||||
bool raii ) const;
|
bool raii ) const;
|
||||||
std::string generateBaseTypes() const;
|
std::string generateBaseTypes() const;
|
||||||
std::string generateBitmask( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
|
std::string generateBitmask( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
|
||||||
|
std::string generateBitmasks() const;
|
||||||
std::string generateBitmasks( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
|
std::string generateBitmasks( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
|
||||||
|
std::string generateBitmasksToString() const;
|
||||||
std::string generateBitmasksToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
|
std::string generateBitmasksToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
|
||||||
std::string generateBitmaskToString( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
|
std::string generateBitmaskToString( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
|
||||||
std::string generateCallArgumentsEnhanced( CommandData const & commandData,
|
std::string generateCallArgumentsEnhanced( CommandData const & commandData,
|
||||||
@ -492,6 +486,7 @@ private:
|
|||||||
bool raii ) const;
|
bool raii ) const;
|
||||||
std::string generateChainTemplates( std::vector<size_t> const & returnParams, bool chained ) const;
|
std::string generateChainTemplates( std::vector<size_t> const & returnParams, bool chained ) const;
|
||||||
std::string generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const;
|
std::string generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const;
|
||||||
|
std::string generateCommandDefinitions() const;
|
||||||
std::string
|
std::string
|
||||||
generateCommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
|
generateCommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
|
||||||
std::string generateCommandDefinitions( std::string const & command, std::string const & handle ) const;
|
std::string generateCommandDefinitions( std::string const & command, std::string const & handle ) const;
|
||||||
@ -653,7 +648,9 @@ private:
|
|||||||
std::set<std::string> & listedCommands,
|
std::set<std::string> & listedCommands,
|
||||||
std::string const & title ) const;
|
std::string const & title ) const;
|
||||||
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
|
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
|
||||||
|
std::string generateEnums() const;
|
||||||
std::string generateEnums( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
|
std::string generateEnums( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
|
||||||
|
std::string generateEnumsToString() const;
|
||||||
std::string generateEnumsToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
|
std::string generateEnumsToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
|
||||||
std::string generateEnumInitializer( TypeInfo const & type,
|
std::string generateEnumInitializer( TypeInfo const & type,
|
||||||
std::vector<std::string> const & arraySizes,
|
std::vector<std::string> const & arraySizes,
|
||||||
@ -661,12 +658,16 @@ private:
|
|||||||
bool bitmask ) const;
|
bool bitmask ) const;
|
||||||
std::string generateEnumToString( std::pair<std::string, EnumData> const & enumData ) const;
|
std::string generateEnumToString( std::pair<std::string, EnumData> const & enumData ) const;
|
||||||
std::string generateFailureCheck( std::vector<std::string> const & successCodes ) const;
|
std::string generateFailureCheck( std::vector<std::string> const & successCodes ) const;
|
||||||
|
std::string generateFormatTraits() const;
|
||||||
std::string generateFunctionPointerCheck( std::string const & function, std::string const & referencedIn ) const;
|
std::string generateFunctionPointerCheck( std::string const & function, std::string const & referencedIn ) const;
|
||||||
std::string generateHandle( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
|
std::string generateHandle( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
|
||||||
std::string generateHandleCommandDeclarations( std::set<std::string> const & commands ) const;
|
std::string generateHandleCommandDeclarations( std::set<std::string> const & commands ) const;
|
||||||
std::string generateHandleDependencies( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
|
std::string generateHandleDependencies( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
|
||||||
std::string generateHandleEmpty( HandleData const & handleData ) const;
|
std::string generateHandleEmpty( HandleData const & handleData ) const;
|
||||||
std::string generateHandleHashStructures( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
std::string generateHandleHashStructures( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||||
|
std::string generateHandleHashStructures() const;
|
||||||
|
std::string generateHandles() const;
|
||||||
|
std::string generateIndexTypeTraits() const;
|
||||||
std::string
|
std::string
|
||||||
generateLenInitializer( std::vector<MemberData>::const_iterator mit,
|
generateLenInitializer( std::vector<MemberData>::const_iterator mit,
|
||||||
std::map<std::vector<MemberData>::const_iterator, std::vector<std::vector<MemberData>::const_iterator>>::const_iterator litit,
|
std::map<std::vector<MemberData>::const_iterator, std::vector<std::vector<MemberData>::const_iterator>>::const_iterator litit,
|
||||||
@ -675,8 +676,10 @@ private:
|
|||||||
std::string generateObjectDeleter( std::string const & commandName, CommandData const & commandData, size_t initialSkipCount, size_t returnParam ) const;
|
std::string generateObjectDeleter( std::string const & commandName, CommandData const & commandData, size_t initialSkipCount, size_t returnParam ) const;
|
||||||
std::pair<std::string, std::string> generateProtection( std::string const & referencedIn, std::string const & protect ) const;
|
std::pair<std::string, std::string> generateProtection( std::string const & referencedIn, std::string const & protect ) const;
|
||||||
std::pair<std::string, std::string> generateProtection( std::string const & type, bool isAliased ) const;
|
std::pair<std::string, std::string> generateProtection( std::string const & type, bool isAliased ) const;
|
||||||
|
std::string generateRAIICommandDefinitions() const;
|
||||||
std::string
|
std::string
|
||||||
generateRAIICommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
|
generateRAIICommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
|
||||||
|
std::string generateRAIIDispatchers() const;
|
||||||
std::string generateRAIIHandle( std::pair<std::string, HandleData> const & handle,
|
std::string generateRAIIHandle( std::pair<std::string, HandleData> const & handle,
|
||||||
std::set<std::string> & listedHandles,
|
std::set<std::string> & listedHandles,
|
||||||
std::set<std::string> const & specialFunctions ) const;
|
std::set<std::string> const & specialFunctions ) const;
|
||||||
@ -808,6 +811,7 @@ private:
|
|||||||
std::tuple<std::string, std::string, std::string, std::string, std::string, std::string>
|
std::tuple<std::string, std::string, std::string, std::string, std::string, std::string>
|
||||||
generateRAIIHandleDetails( std::pair<std::string, HandleData> const & handle ) const;
|
generateRAIIHandleDetails( std::pair<std::string, HandleData> const & handle ) const;
|
||||||
std::string generateRAIIHandleForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
std::string generateRAIIHandleForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||||
|
std::string generateRAIIHandles() const;
|
||||||
std::string generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
std::string generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
||||||
std::map<std::string, CommandData>::const_iterator constructorIt ) const;
|
std::map<std::string, CommandData>::const_iterator constructorIt ) const;
|
||||||
std::string generateRAIIHandleVectorSizeCheck( std::string const & name,
|
std::string generateRAIIHandleVectorSizeCheck( std::string const & name,
|
||||||
@ -845,11 +849,14 @@ private:
|
|||||||
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
|
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
|
||||||
std::string generateStructConstructorArgument( bool listedArgument, MemberData const & memberData, bool withDefault ) const;
|
std::string generateStructConstructorArgument( bool listedArgument, MemberData const & memberData, bool withDefault ) const;
|
||||||
std::string generateStructHashStructure( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
|
std::string generateStructHashStructure( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||||
|
std::string generateStructHashStructures() const;
|
||||||
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;
|
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;
|
||||||
|
std::string generateStructs() const;
|
||||||
std::string generateStructure( std::pair<std::string, StructureData> const & structure ) const;
|
std::string generateStructure( std::pair<std::string, StructureData> const & structure ) const;
|
||||||
std::string generateStructExtendsStructs() const;
|
std::string generateStructExtendsStructs() const;
|
||||||
std::string
|
std::string
|
||||||
generateStructExtendsStructs( std::vector<RequireData> const & requireData, std::set<std::string> & listedStructs, std::string const & title ) const;
|
generateStructExtendsStructs( std::vector<RequireData> const & requireData, std::set<std::string> & listedStructs, std::string const & title ) const;
|
||||||
|
std::string generateStructForwardDeclarations() const;
|
||||||
std::string generateStructForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
std::string generateStructForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||||
std::tuple<std::string, std::string, std::string, std::string> generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
|
std::tuple<std::string, std::string, std::string, std::string> generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
|
||||||
std::string generateStructSetter( std::string const & structureName, std::vector<MemberData> const & memberData, size_t index ) const;
|
std::string generateStructSetter( std::string const & structureName, std::vector<MemberData> const & memberData, size_t index ) const;
|
||||||
|
@ -13300,4 +13300,4 @@ namespace std
|
|||||||
#endif // 14 <= VULKAN_HPP_CPP_VERSION
|
#endif // 14 <= VULKAN_HPP_CPP_VERSION
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
#endif // VULKAN_HASH_HPP
|
#endif
|
||||||
|
@ -7668,4 +7668,4 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VULKAN_HPP_NAMESPACE
|
} // namespace VULKAN_HPP_NAMESPACE
|
||||||
#endif // VULKAN_TO_STRING_HPP
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user