Open fzwoch opened 8 years ago
Some more insight how these things are probably supposed to show up in the Xcode project file. The original was created with premake5 and I modified the project file in Xcode so that the custom build command would be build.
Upon saving the Xcode file it changes a few other things as well. I threw things out which seemed minor to me and try to focus on the hopefully important sections.
The custom build rule file is added to the PBXBuildFile
section:
/* Begin PBXBuildFile section */
4DA31F3F12936C0EC6C0E2B20BB08003581BB94FBC84400 /* cpuid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A06AF316668520005E6191DC09734800D773427298992800 /* cpuid.cpp */; };
+ 574CC34D1D1BE911004195A7 /* cpuidasm.asm in Sources */ = {isa = PBXBuildFile; fileRef = B6DB97B718F77800745F6CF561685C0059FE15EA6072CC0 /* cpuidasm.asm */; };
/* End PBXBuildFile section */
right after the PBXBuildFile
section there is a PBXBuildRule
section created. I had to use the ${DERIVED_FILES_DIR}
for the destination file and as well as the output file variables so that the linker would find the created object file. Not sure if premake itself should take care of this somehow
but ${DERIVED_FILES_DIR}
seems to end up in an absolute path which seems randomly generated for the current temporary compile directories.
I used a general *.asm
rule for this test here. I guess premake5 should create a build rule for every file it adds via this rule and be an exact file match?
+/* Begin PBXBuildRule section */
+ 574CC34C1D1BE654004195A7 /* PBXBuildRule */ = {
+ isa = PBXBuildRule;
+ compilerSpec = com.apple.compilers.proxy.script;
+ filePatterns = "*.asm";
+ fileType = pattern.proxy;
+ isEditable = 1;
+ outputFiles = (
+ "${DERIVED_FILES_DIR}/obj/cpuidasm.o",
+ );
+ script = "yasm -f macho64 --prefix=_ -DARCH_X86_64 cpuidasm.asm -o ${DERIVED_FILES_DIR}/obj/cpuidasm.o";
+ };
+/* End PBXBuildRule section */
+
the PBXBuildRules
are added to the buildRules
variable:
buildRules = (
+ 574CC34C1D1BE654004195A7 /* PBXBuildRule */,
);
the custom build file is also added to the PBXSourcesBuildPhase
files section:
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 574CC34D1D1BE911004195A7 /* cpuidasm.asm in Sources */,
4DA31F3F12936C0EC6C0E2B20BB08003581BB94FBC84400 /* cpuid.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
If I can find some more free time I might try to take a look at the premake5/lua magic - but not sure if i can the grasp of it. If someone can take a deep breath and gets some rough code snippets out on how things may end up working I would be very happy!
Currently custom build commands are not working. Specified files end up in the project's file list, however no action is being performed for these files.
Example:
I have seen Xcode4 projects where this works - so it should be a doable from a Xcode point of view. Unfortunately I know too little about lua, premake and Xcode4 project file syntax to hack this in myself. :(
I can probably dig up some Xcode4 samples where these rules are present if that is necessary. If there is any other info needed I will try to deliver it - if I can. Would be great so see this supported on the Xcode side as well.