성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] 제가 큰 실수를 했군요. ^^; Delegate를 통한 Bein...
[정성태] Working with Rust Libraries from C#...
[정성태] Detecting blocking calls using asyn...
[정성태] 아쉽게도, 커뮤니티는 아니고 개인 블로그입니다. ^^
[정성태] 질문이 잘 이해가 안 됩니다. 우선, 해당 소스코드에서 ILis...
[양승조
] var대신 dinamic으로 선언해서 해결은 했습니다. 맞는 해...
[양승조
] 또 막혔습니다. ㅠㅠ var list = props[i].Ge...
[양승조
] 아. 감사합니다. 어제는 안됐던것 같은데....정신을 차려야겠네...
[정성태] "props[i].GetValue(props[i])" 코드에서 ...
[정성태] 저렇게 조각 코드 말고, 실제로 재현이 되는 예제 프로젝트를 압...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>C/C++ 프로젝트 빌드 속도 개선 - UnityBuild를 아세요?</h1> <p> 오호... ^^ 2월달 마이크로소프트웨어 잡지에 보니 재미있는 내용이 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > 마이크로소프트웨어 - 게임 개발 사례로 살펴본 C++ 프로젝트의 빌드 속도 개선 ; <a target='tab' href='http://www.imaso.co.kr/?doc=bbs/gnuboard.php&wr_id=39176&bo_table=article'>http://www.imaso.co.kr/?doc=bbs/gnuboard.php&wr_id=39176&bo_table=article</a> </pre> <br /> 다른 것은 그렇다 치고, "UnityBuild"라는 것에 대해 소개하고 있는데요. NDC 2010(넥슨 개발자 컨퍼런스)에서도 UnityBuild에 관한 발표가 있었다고 합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > 송창규, unity build로 빌드타임 반토막내기, NDC2010 ; <a target='tab' href='http://www.slideshare.net/devcatpublications/ndc2010-unity-build'>http://www.slideshare.net/devcatpublications/ndc2010-unity-build</a> </pre> <br /> 원리는 매우 간단합니다. ^^ CPP 파일을 하나로 묶어서 필요 없는 header 파일의 처리 횟수를 줄이자는 것!<br /> <br /> 그러면서, Visual Studio를 위해서 "Earlgrey.BuildTools에 포함된 UnityBuild" 도구를 잠깐 언급하고 있는데요.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > earlgrey - Providing the fundamental of the online game server. ; <a target='tab' href='http://code.google.com/p/earlgrey/downloads/list'>http://code.google.com/p/earlgrey/downloads/list</a> </pre> <br /> 소개만 할 뿐, 구체적인 사용법이 없어서 ... ^^ 이렇게 제가 소개하는 글을 쓰는 기회를 가로채 보았습니다.<br /> <br /> <hr style='width: 50%' /><br /> <br /> 그런데, 소개만 한 데에는 다 이유가 있더군요. ^^ 정말 사용법이 간단합니다. 우선, <a target='tab' href='http://code.google.com/p/earlgrey/downloads/list'>earlgrey 다운로드 사이트</a>에서 최신의 Earlgrey.BuildTools 파일을 다운로드해 압축을 해제합니다.<br /> <br /> 일단, 기본적인 내용은 /UserGuid/Help/Earlgrey.Build.Tools.chm 파일에 모두 제공되니 참고하시고.<br /> <br /> 예를 들기 위해, 단순하게 Visual Studio에서 Visual C++ Windows 프로젝트를 하나 만들었다고 할 때, 보통 다음과 같이 빌드를 해줄 수 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > D:\TestApp>msbuild testapp.sln 또는 D:\TestApp>msbuild BuildTest.vcxproj * 좀 더 구체적인 빌드 방법은 다음의 글을 참조. MSBuild를 이용한 VC++ 프로젝트 빌드 ; <a target='tab' href='http://www.sysnet.pe.kr/2/0/871'>http://www.sysnet.pe.kr/2/0/871</a> </pre> <br /> 자, 그럼 위의 프로젝트를 UnityBuild로 해볼까요? ^^ 압축을 풀은 폴더의 /UnityBuild/UnityBuild.ConsoleUi.exe 실행 파일을 이용해서 바로 위에서 msbuild를 수행한 것처럼 적용해 주면 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > D:\unitybuilder\TestApp><span style='color: blue; font-weight: bold'>..\Earlgrey.BuildTools\UnityBuild\UnityBuild.ConsoleUi.exe -i testapp.sln</span> working ... <span style='color: blue; font-weight: bold'>[Error] There is an error in XML document (2, 2).</span> </pre> <br /> 아... 글쎄 ^^ 세상일이 언제나 그렇게 쉽게 되진 않답니다. UnityBuild.ConsoleUi.exe의 명령행 옵션에 보니까 verbose 모드가 있군요. 이걸로 원인을 알 수 있을까요? ^^<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > D:\unitybuilder\TestApp><span style='color: blue; font-weight: bold'>..\Earlgrey.BuildTools\UnityBuild\UnityBuild.ConsoleUi.exe -i testapp.sln -v</span> [Switches] * Input file path is "testapp.sln". * Verbose mode is turned on. * Current optimization level is 'Normal'. working ... <span style='color: blue; font-weight: bold'>[Error] There is an error in XML document (2, 2).</span> </pre> <br /> 그래도 안되는군요. 설마... Visual Studio 2010을 지원하지 못해서 그러는 것은 아니겠지... 하면서도 혹시나 싶어서, Visual Studio 2008로 C++ 프로젝트를 만들어서 테스트해 보았는데... 오호~~~ 잘 됩니다. ^^<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > D:\UnityBuild><span style='color: blue; font-weight: bold'>UnityBuild.ConsoleUi.exe -i .\testapp\TestApp.sln</span> working ... converted! </pre> <br /> 위와 같이 실행하면, TestApp.sln에 포함된 Visual C++ 프로젝트 파일을 다음과 같이 변경해 줍니다.<br /> <br /> <img alt='how_to_use_unitybuild_1.png' src='/SysWebRes/bbs/how_to_use_unitybuild_1.png' /><br /> <br /> 잘 보시면, "UnityBuild"라는 논리 폴더가 새롭게 생겼고, 그 하위에 "UnityBuild-00001.cpp"와 "UnityBuild-00002.cpp" 파일을 포함하고 "Excluded from Build" 상태로 설정되어 있습니다.<br /> <br /> 파일 내용을 보면, 다음과 같습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > [UnityBuild-00001.cpp] #include "StdAfx.h" #include "stdafx.cpp" [UnityBuild-00002.cpp] #include "StdAfx.h" #include "test1.cpp" #include "TestApp.cpp" </pre> <br /> 보시는 것처럼, 원리가 엄청 간단합니다. 일단 stdafx.cpp에 대해서는 파일 하나가 할당되고, 그 외의 CPP 파일들은 하나로 묶이고 있습니다.<br /> <br /> 위에서는 원본 csproj 파일이 변경되었는데, 별도의 프로젝트 파일이 생성되길 원한다면 다음과 같이 "-c" 옵션을 주면 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > D:\UnityBuild>UnityBuild.ConsoleUi.exe -i .\testapp\TestApp.sln <span style='color: blue; font-weight: bold'>-c</span> working ... converted! </pre> <br /> 그럼, 새로운 솔루션과 프로젝트 파일이 다음과 같이 생성됩니다.<br /> <br /> <img alt='how_to_use_unitybuild_2.png' src='/SysWebRes/bbs/how_to_use_unitybuild_2.png' /><br /> <br /> <div style='BACKGROUND-COLOR: #ccffcc; padding: 10px 10px 5px 10px; MARGIN: 0px 10px 10px 10px; FONT-FAMILY: Malgun Gothic, Consolas, Verdana; COLOR: #005555'> TestApp.sln<br /> --> TestApp-UnityBuild.sln<br /> <br /> TestApp.vcproj<br /> --> TestApp-UnityBuild.vcproj<br /> </div><br /> <br /> 그건 그렇다 치고... 그런데 좀 이상하군요. 별도로 생성된 프로젝트조차도 UnityBuild-xxxxx.cpp 파일들이 여전히 "Excluded from Build" 설정으로 되어 있습니다. 이러면 UnityBuild의 효과를 보기 위해서는 일일이 수작업으로 설정을 반대로 해주어야 합니다. (왜 이렇게 만들어 놨을까요? 음... 아직도 이해가 안됩니다.)<br /> <br /> 결국, 뭉쳐진 파일들로 빌드를 하기 위해서는 다음 그림에서 보는 것처럼, Unity-Build-xxxxx.cpp 파일들이 빌드 대상이 되도록 하고 다른 파일들을 빼주어야 합니다. 또한 이런 경우 "precompiled header" 문제가 발생하는데, 프로젝트 속성 창에서 "Configuration Properties" / "C/C++" / "Precompiled Headers" 범주의 "Create/Use Precompiled Header" 옵션을 기존의 "Use Precompiled Header (/Yu)" 값에서 "Create Precompiled Headers (/Yc)"로 바꿔주어야 합니다.<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='how_to_use_unitybuild_3.png' src='/SysWebRes/bbs/how_to_use_unitybuild_3.png' /><br /> <br /> <hr style='width: 50%' /><br /> <br /> "UnityBuild.ConsoleUi.exe" 프로그램이 비록 (내일 모레면 Visual Studio 11 베타 버전이 나오는 마당에 아직도) Visual Studio 2010을 지원하지 않고, 수작업으로 다시 손을 봐야 하는 단점이 있지만, 사실 개념이 워낙 간단하기 때문에 위의 사항을 잘 이해하셨다면 (vcxproj 파일도 XML 형식이기 때문에) 이러한 단점을 수정한 도구를 만드는 것이 그렇게 어렵지 않다는 것을 아실 것입니다.<br /> <br /> 암튼... 재미난 ^^ 팁을 배웠다는 것만으로도 감사할 일입니다.<br /> </p><br /> <br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
3093
(왼쪽의 숫자를 입력해야 합니다.)