2009-10-26 3 views
0

내 iPhone 프로젝트 타겟 아키텍처가 시뮬레이터가 아닌 경우 인라인 asm을 사용하고 있습니다.Xcode : 아키텍처 별 파일 컴파일러 빌드 설정 빌드

인라인 asm 코드 중 일부는 팔 전용이며 엄지 손가락이 아니기 때문에 엄지 지침으로 코드를 컴파일하려고 시도하므로 iPhone 용으로 컴파일 할 때 c 플래그 -marm을 지정해야합니다. 내가 파일 특정 빌드 설정에서 -marm 플래그를 입력하면

그리고 여기가 문제가, GCC 출력 내가 시뮬레이터에 대한 컴파일하면 오류 :

cc1obj: error: unrecognized command line option "-marm"

이 옵션을 전달하는 방법이 유일한 타겟 아키텍처가 팔이면? 전역 C 플래그를 사용할 수 있다는 것을 알고 있지만 -marm 플래그로 전체 프로젝트를 컴파일하고 싶지 않습니다. 몇 개의 .m 파일 만 -marm으로하고 싶습니다.

감사 및 인사말,

+0

당신이 엑스 코드가에서 명령을 생성 할 때 옵션이 제대로 사용되고 있는지 확인 빌드 로그 봤어 :

여기에 내가 코드에 추가 된 의견은? –

답변

0

확인 문제의 해결책을 찾았습니다.

// the asm code only works with arm not with thumb, 
// so if you compile it and gcc trys to compile it as thumb 
// you will get an error. 
// to make gcc compile the file as arm and not thumb you need 
// to add -marm to the files compiler config (select the file 
// and press cmd + i and select the build tab and enter there 
// the problem is that if you try to compile for the simulator 
// it will fail, because intel gcc doesnt know the flat -marm. 
// To solve this add a new "User defined setting" in your targets 
// build settings with the name use_marm and give it the value "" 
// then add a build setting condition and select Any iPhone OS 
// Device and give it the value "-marm" 
// In your file's compiler flags add $use_marm 
// If you build for the device it will add -marm and if you 
// build for the simulator it wont.