Commits

Jason McKesson committed 3254e6b

Modifications to glload.

  • Participants
  • Parent commits d062caf

Comments (0)

Files changed (3)

modules/StructGLLoad.lua

 	--Main header files.
 	{ type="version-iter",
 		{ type="file", style="incl_hdr", name="VersionFilenameCore(basename, version, spec, options)",
-			{ type="block", name="IncludeGuardCore(hFile, version, spec, options)",
+			{ type="block", name="IncludeGuardVersionCore(hFile, version, spec, options)",
 				{ type="blank" },
 				{ type="write", name="IncludeIntType(hFile, spec, options)"},
 				{ type="write", name="IncludeIntExts(hFile, spec, options)"},
 				{ type="blank" },
 				{ type="sub-version-iter",
 					{ type="write", name="IncludeIntVersionCore(hFile, sub_version, specData, spec, options)"},
-					{ type="blank", last=true, },
 				},
 			},
 		},
 	{ type="version-iter",
 		{ type="filter", name="VersionHasCompProfile(version)",
 			{ type="file", style="incl_hdr", name="VersionFilenameComp(basename, version, spec, options)",
-				{ type="block", name="IncludeGuardComp(hFile, version, spec, options)",
+				{ type="block", name="IncludeGuardVersionComp(hFile, version, spec, options)",
 					{ type="blank" },
 					{ type="write", name="IncludeIntType(hFile, spec, options)"},
 					{ type="write", name="IncludeIntExts(hFile, spec, options)"},
 					{ type="sub-version-iter",
 						{ type="write", name="IncludeIntVersionCore(hFile, sub_version, specData, spec, options)"},
 						{ type="write", name="IncludeIntVersionComp(hFile, sub_version, specData, spec, options)"},
-						{ type="blank", last=true, },
 					},
 				},
 			},
 			{ type="version-iter",
 				{ type="write", name="IncludeIntVersionCore(hFile, version, specData, spec, options)"},
 				{ type="write", name="IncludeIntVersionComp(hFile, version, specData, spec, options)"},
-				{ type="blank", last=true, },
+			},
+		},
+	},
+
+	--Header that includes only core.
+	{ type="file", style="incl_hdr", name="CoreFilename(basename, spec, options)", cond="version-iter",
+		{ type="block", name="IncludeGuardCore(hFile, spec, options)",
+			{ type="blank" },
+			{ type="write", name="IncludeIntType(hFile, spec, options)"},
+			{ type="write", name="IncludeIntExts(hFile, spec, options)"},
+			{ type="blank" },
+			{ type="version-iter",
+				{ type="write", name="IncludeIntVersionCore(hFile, version, specData, spec, options)"},
 			},
 		},
 	},

modules/StyleGLLoad.lua

 		glload.GetAllBasename(spec, options)
 end
 
-function incl_hdr.WriteBlockBeginIncludeGuardCore(hFile, version, spec, options)
+function incl_hdr.CoreFilename(basename, spec, options)
+	local basename, dir = util.ParsePath(basename)
+	return dir .. glload.headerDirectory .. 
+		glload.GetCoreBasename(spec, options)
+end
+
+function incl_hdr.WriteBlockBeginIncludeGuardVersionCore(hFile, version, spec, options)
 	local includeGuard = glload.GetInclFileIncludeGuard(version, spec, options)
 	hFile:fmt("#ifndef %s\n", includeGuard)
 	hFile:fmt("#define %s\n", includeGuard)
 end
 
-function incl_hdr.WriteBlockEndIncludeGuardCore(hFile, version, spec, options)
+function incl_hdr.WriteBlockEndIncludeGuardVersionCore(hFile, version, spec, options)
 	hFile:fmt("#endif /*%s*/\n", glload.GetInclFileIncludeGuard(version, spec, options))
 end
 
-function incl_hdr.WriteBlockBeginIncludeGuardComp(hFile, version, spec, options)
+function incl_hdr.WriteBlockBeginIncludeGuardVersionComp(hFile, version, spec, options)
 	local includeGuard = glload.GetInclFileCompIncludeGuard(version, spec, options)
 	hFile:fmt("#ifndef %s\n", includeGuard)
 	hFile:fmt("#define %s\n", includeGuard)
 end
 
-function incl_hdr.WriteBlockEndIncludeGuardComp(hFile, version, spec, options)
+function incl_hdr.WriteBlockEndIncludeGuardVersionComp(hFile, version, spec, options)
 	hFile:fmt("#endif /*%s*/\n", glload.GetInclFileCompIncludeGuard(version, spec, options))
 end
 
 	hFile:fmt("#endif /*%s*/\n", glload.GetInclFileAllIncludeGuard(spec, options))
 end
 
+glload.CreateIncludeGuardWriters(incl_hdr, "IncludeGuardCore",
+	function(...) return glload.GetInclFileCoreIncludeGuard(...) end)
+
 function incl_hdr.WriteIncludeIntType(hFile, spec, options)
 	hFile:fmt('#include "%s"\n', glload.GetTypeHeaderBasename(spec, options))
 end
 -- Source CPP file.
 function cpp.source.GetFilename(basename, spec, options)
 	local basename, dir = util.ParsePath(basename)
+	--The extra _cpp is *on purpose*. Visual Studio checks object files
+	--by filename. So gl_load.c and gl_load.cpp generate the same object file.
+	--This confuses it.
 	return dir .. glload.sourceDirectory .. spec.FilePrefix() .. "load_cpp.cpp"
 end
 

modules/glload_util.lua

 	return spec.FilePrefix() .. "all.h"
 end
 
+function data.GetCoreBasename(spec, options)
+	return spec.FilePrefix() .. "core.h"
+end
+
 function data.GetTypeHeaderBasename(spec, options)
 	return data.internalPrefix .. spec.FilePrefix() .. "type.h"
 end
 	return spec.GetIncludeGuardString() .. "_GEN_ALL_H"
 end
 
+function data.GetInclFileCoreIncludeGuard(spec, options)
+	return spec.GetIncludeGuardString() .. "_GEN_CORE_H"
+end
+
 function data.GetInclFileLoaderIncludeGuard(spec, options)
 	return spec.GetIncludeGuardString() .. "_GEN_LOAD_FUNCTIONS_H"
 end
 	return spec.FilePrefix() .. "all.hpp"
 end
 
+function data.cpp.GetCoreBasename(spec, options)
+	return spec.FilePrefix() .. "core.hpp"
+end
+
 function data.cpp.GetTypeHeaderBasename(spec, options)
 	return data.internalPrefix .. spec.FilePrefix() .. "type.hpp"
 end
 	return spec.GetIncludeGuardString() .. "_GEN_ALL_HPP"
 end
 
+function data.cpp.GetInclFileCoreIncludeGuard(spec, options)
+	return spec.GetIncludeGuardString() .. "_GEN_CORE_HPP"
+end
+
 function data.cpp.GetInclFileLoaderIncludeGuard(spec, options)
 	return spec.GetIncludeGuardString() .. "_GEN_LOAD_FUNCTIONS_HPP"
 end