프로젝트를 진행하게 되면 기본적으로 사용하는 라이브러리들이 있습니다. 처음에는 프로젝트 공용으로 설정해놓고 사용했었는데, 이렇게 하니 새로운 라이브러리가 나왔을때 충돌 문제가 생겨버리더군요. 그래서 요즘에는 프로젝트 별로 헤더와 라입 경로를 직접 써주는 편입니다.

문제는 여러 프로젝트를 만들때 매번 프로젝트별 헤더를 연결해줘야 한다는 것입니다.
매번 프로젝트 설정 다이얼로그 열고 닫는 것도 상당히 귀찮은 일이죠.
이럴때 아래 파이썬 프로그램을 사용합니다.

import glob

incHead = "AdditionalIncludeDirectories"
libHead = "AdditionalLibraryDirectories"
incFiles = "$(YMIR_EXTLIB)/inc/gamebryo;$(YMIR_EXTLIB)/inc/directx;"
libFiles = "$(YMIR_EXTLIB)/lib/gamebryo/ReleaseDLL;$(YMIR_EXTLIB)/lib/directx;"

def ReplaceLine(oldLine):
    incPos = oldLine.find(incHead)
    if incPos >= 0:
        newLine = '%s="%s"' % (oldLine[:incPos+len(incHead)], incFiles)
        print oldLine
        print newLine
        return newLine

    libPos = oldLine.find(libHead)
    if libPos >= 0:
        newLine = '%s="%s"' % (oldLine[:libPos+len(libHead)], libFiles)
        print oldLine
        print newLine
        return newLine

    return oldLine


for name in glob.glob("*.vcproj"):
    print name

    oldLines = open(name).read().splitlines()
    newLines = [ReplaceLine(oldLine) for oldLine in oldLines]

    open(name + ".bak", "w").write("\n".join(oldLines))
    open(name, "w").write("\n".join(newLines))


짜잔 -_-)/
이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/08/04 12:28 2007/08/04 12:28
Tag ,