Vcpkg: How do I get vcpkg installed library directory to include them in build script

Created on 12 Oct 2019  路  9Comments  路  Source: microsoft/vcpkg

Hi,
I have a simple question about using vcpkg, I know how I can integrate it with vs but I wanted to include the installed libraries in build script of my code to install it using python install command. So far I could manually get the directory of E:\vcpkg\installed\x86-windows\include and add this directory to include path of my code and it works. But is there any environment variable so I can check to find where is installed directory of vcpkg? or even is it safe to use this directory directly?

question

All 9 comments

@am2222, you can use '${VCPKG_ROOT}\installed\${TRIPLET}\include' instead, but you should specify VCPKG_ROOT and TRIPLET.

@PhoebeHui Hi, Is that a kind of system environment? or it is CMAKE variable?

@am2222, it's environment variable that we used in portfile.cmake, it's not a system environment.

@PhoebeHui So I can not access it using python setup.py environment, right?

Right

call env ... msvc cmd

set include=%include%;e:\vcpkg....\include
set lib=%lib%;e:\vcpkg....\lib

python setup.py build

@Voskrese thanks so much.
I have one question related to lib environment variable I'd appreciate if you help me with it as well. If I set it I don't need to define it in setup.py anymore? Since I have a problem with my library, despite that I define the directory of vcpkg in setup.py it still raises link error.

ext_modules = [
    Extension(
        include_dirs=[],
        # extra_link_args=[r'"/LIBPATH:E:\Personal\SideWorks\vcpkg\installed\x86-windows\lib"'],
        libraries =['gdal','geos','geos_c'],
        library_dirs =['E:\Personal\SideWorks\vcpkg\installed\x86-windows\lib'],
        language='c++'
    ),
]

This is a part of my setup.py, I asked a detailed question about it in stackoverflow but I am not sure whether my problem is with wrong use of vcpkg or somewhere else.
https://stackoverflow.com/questions/58365268/link-library-lib-using-setup-py

python env in distutils.cfg

python3\Lib\distutils\distutils.cfg - global
site.cfg - local

https://github.com/Voskrese/vcpkg/blob/master/ports/python3-setuptools/distutils-rel.cfg.in

cmd

python setup.py build --build_ext --include_dirs=E:\Personal\SideWorks\vcpkg\installed\x86-windows\include --library_dirs=E:\Personal\SideWorks\vcpkg\installed\x86-windows\lib

@Voskrese thanks very much

Was this page helpful?
0 / 5 - 0 ratings