2012-12-20 2 views
10

기본 노드 모듈을 작성 중이며 버전을 빌드하고 디버그 할 수 있기를 바랍니다.gyp - 링크 라이브러리의 맛을 지정하는 방법

노드 모듈은 서로 다른 두 개의 디렉토리에 디버그 및 릴리스 버전이있는 다른 라이브러리에 연결됩니다.

지금 여기서 내가 막힌 곳입니다. 현재 구성중인 라이브러리 디렉토리를 어떻게 지정합니까?

내가 configurations.debug.link_settings 키에,하지만 오류 얻을 설정 시도했다 : 'link_settings이

답변

14

binding.gyp 대상에서 발견, 디버그 구성에서 허용되지는 분명히이 가능하지 않습니다 크로스 플랫폼 방식. 이렇게하면 두 시간의 실험을 할 수 있습니다.

Mac 및 Windows 용 애드온을 빌드하는 gyp 파일입니다.

//This example assumes you have an external library 'thelibrary', located in 
//./external/thelibrary 
//With the two flavors, debug and release in lib/debug and lib/release 
{ 
    "targets": [ 
     { 
      "target_name": "addon", 
      "sources": [ 
       "src/addon.cpp", 
       "src/expose_the_library.cpp" 
      ], 
      "include_dirs": [ 
       "external/thelibrary/include" 
      ], 
      "cflags!": [ 
       "-fno-exceptions" 
      ], 
      "cflags_cc!": [ 
       "-fno-exceptions" 
      ], 
      "conditions": [ 
       [ 
        "OS=='mac'", 
        { 
         "defines": [ 
          "__MACOSX_CORE__" 
         ], 
         "architecture": "i386", 
         "xcode_settings": { 
          "GCC_ENABLE_CPP_EXCEPTIONS": "YES" 
         }, 
         "link_settings": { 
          "libraries": [ 
           "-lthelibrary", 
           "-framework", 
           "IOBluetooth" //this is how you use a framework on OSX 
          ], 
          "configurations": { 
           "Debug": { 
            "xcode_settings": { 
             "OTHER_LDFLAGS": [ 
              "-Lexternal/thelibrary/lib/debug" 
             ] 
            } 
           }, 
           "Release": { 
            "xcode_settings": { 
             "OTHER_LDFLAGS": [ 
              "-Lexternal/thelibrary/lib/release" 
             ] 
            } 
           } 
          } 
         } 
        } 
       ], 
       [ 
        "OS=='win'", 
        { 
         "link_settings": { 
          "libraries": [ 
           "-lthelibrary.lib", 
          ] 
         }, 
         "configurations": { 
          "Debug": { 
           "msvs_settings": { 
            "VCCLCompilerTool": { 
             "ExceptionHandling": "0", 
             "AdditionalOptions": [ 
              "/MP /EHsc" 
             ] 
            }, 
            "VCLibrarianTool": { 
             "AdditionalOptions": [ 
              "/LTCG" 
             ] 
            }, 
            "VCLinkerTool": { 
             "LinkTimeCodeGeneration": 1, 
             "LinkIncremental": 1, 
             "AdditionalLibraryDirectories": [ 
              "../external/thelibrary/lib/debug" 
             ] 
            } 
           } 
          }, 
          "Release": { 
           "msvs_settings": { 
            "VCCLCompilerTool": { 
             "RuntimeLibrary": 0, 
             "Optimization": 3, 
             "FavorSizeOrSpeed": 1, 
             "InlineFunctionExpansion": 2, 
             "WholeProgramOptimization": "true", 
             "OmitFramePointers": "true", 
             "EnableFunctionLevelLinking": "true", 
             "EnableIntrinsicFunctions": "true", 
             "RuntimeTypeInfo": "false", 
             "ExceptionHandling": "0", 
             "AdditionalOptions": [ 
              "/MP /EHsc" 
             ] 
            }, 
            "VCLibrarianTool": { 
             "AdditionalOptions": [ 
              "/LTCG" 
             ] 
            }, 
            "VCLinkerTool": { 
             "LinkTimeCodeGeneration": 1, 
             "OptimizeReferences": 2, 
             "EnableCOMDATFolding": 2, 
             "LinkIncremental": 1, 
             "AdditionalLibraryDirectories": [ 
              "../external/thelibrary/lib/release" 
             ] 
            } 
           } 
          } 
         } 
        } 
       ] 
      ] 
     } 
    ] 
} 
+0

나는 gcc의 버전 :( – OrangeDog

+0

이름은 [MSVSSettings.py]를 사용 올바른 설정을 찾을 추가 (https://code.google.com/p/gyp/source/browse/trunk/pylib/ 필요 gyp/MSVSSettings.py? r = 904 # 431) – Karl2011