2017-10-30 1 views
1

내 프로젝트 (C)는 빌드시 타사 종속성이 있습니다. 그러나 타사 라이브러리는 기본적으로 /lib 대신 /opt/에 설치되며 pkg-config에서 찾을 수 없습니다. mesonbuild의 문서에서 declare_dependency을 사용해야합니까? 내 서브 프로젝트로 처리 할 수있는 소스 코드가 없습니다. dependency()을 사용하여 정의한 경우 사용자 정의 위치를 ​​정의하는 데 올바른 인수를 찾을 수 없습니다.MesonBuild :`pkg-config`가 찾을 수없는 라이브러리에 의존성을 정의하는 법?

비표준 타사 라이브러리에 대한 종속성을 선언하는 방법은 무엇입니까?

답변

2

로서는 이것이 [declare_dependency()] 하위에 대한 herehere

주 사용 사례를 설명.

[dependency()] 발견 pkg-config [또는] 라이브러리 특정 대체 검출 로직과 외부 의존성 ...

넌 대신 find_library()을 사용하여 compiler 개체 및 include_directories()에 의해 제공됩니다. find_library()declare_dependency()이 반환하는 것과 같은 개체를 반환합니다. include_directories()은 디렉토리가 들어있는 불투명 한 오브젝트를 리턴합니다.

project('myproj', 'c') 

cc = meson.get_compiler('c') 
lib_hello = cc.find_library('hello', 
       dirs : ['/opt/hello']) 
inc_hello = include_directories('/opt/hello') 
exec = executable('app', 
        'main.c', 
        dependencies : [lib_hello], 
        include_directories : inc_hello) 
:

당신이 /opt/hello/libhello.so/opt/hello/hello.h, 당신이 할 수있는 C 컴파일러와 제 3 자 라이브러리와 헤더 파일을 사용하는 가정

관련 문제