需求是要弄一个用 pip 发布的python 包,使用 boost-python 桥接 原C++代码,发布时不想带 boost-python 的运行时库,因此需要弄静态的 boost-python库,在 Windows平台下使用vcpkg 的自定义 triplet实现。

在 vcpkg\triplets 根目录下新建 x64-windows-dynamic.cmake

  1. set(VCPKG_TARGET_ARCHITECTURE x64)
  2. set(VCPKG_CRT_LINKAGE dynamic)
  3. set(VCPKG_LIBRARY_LINKAGE static)
  4. if(PORT MATCHES "python3")
  5. set(VCPKG_LIBRARY_LINKAGE dynamic)
  6. endif()

上面的设置使得对python3 这个port完全动态编译,这个库是 boost-python 的依赖库;对于 boost库,运行时库是动态的(/MD),但库本身是静态的,由于vcpkg采用统一的命名规范,与 boost windows平台下库的名称不太一样。

之后使用vcpkg install boost-python:x64-windows-dynamic,同样方法安装其他库即可(均为链接动态的CRT和静态的库本身)

初始化cmake 项目时使用

  1. cmake "-GVisual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-dynamic ..

其中VCPKG_ROOT是环境变量,指向本机vcpkg的安装目录。

使用custom 的 setup.py 进行打包

  1. python setup.py bdist_wheel

输入用户名和密码上传到pypi.org

  1. python -m twine uplodat dist\package.whl

package.whl换成你实际的包名。

然后在有相同python版本的windows电脑上(比如都是python3.6)可以用 pip install package 进行测试。

vcpkg custom triplet的更多相关文章

  1. How to Use vcpkg On Windows

    Introduction If you do any sort of C++ development on Windows, then you know that library/package ma ...

  2. win10 + vs2017 + vcpkg —— VC++ 打包工具

    vcpkg 是微软 C++ 团队开发的在 Windows 上运行的 C/C++ 项目包管理工具,可以帮助您在 Windows 平台上获取 C 和 C++ 库. vcpkg 自身也是使用 C++ 开发的 ...

  3. CPPRESTSDK 编译

    首先要 git clone这个库git clone git://github.com/Microsoft/cpprestsdk.git然后git 一下 Vcpkg.\vcpkg\bootstrap-v ...

  4. Visual Studio工具 vcpkg简介

    博客参考: https://blog.csdn.net/cjmqas/article/details/79282847#43-%E7%A7%BB%E9%99%A4%E5%85%A8%E5%B1%80% ...

  5. AutoMapper:Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type

    异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 应用场景:ViewModel==>Mode映射的时候出错 AutoMappe ...

  6. Spring Enable annotation – writing a custom Enable annotation

    原文地址:https://www.javacodegeeks.com/2015/04/spring-enable-annotation-writing-a-custom-enable-annotati ...

  7. SharePoint2013 Set a custom application page as site welcome page

    本文主要介绍如何添加一个custom application page as site welcome page 1.首先创建一个sharepoint 2013 empty solution, add ...

  8. WebComponent魔法堂:深究Custom Element 之 从过去看现在

    前言  说起Custom Element那必然会想起那个相似而又以失败告终的HTML Component.HTML Component是在IE5开始引入的新技术,用于对原生元素作功能"增强& ...

  9. WebComponent魔法堂:深究Custom Element 之 标准构建

    前言  通过<WebComponent魔法堂:深究Custom Element 之 面向痛点编程>,我们明白到其实Custom Element并不是什么新东西,我们甚至可以在IE5.5上定 ...

随机推荐

  1. 初次使用Windbg检查C#程序内存

    1. 下载windbg并安装. 我下载的是 Windbg 6.12.注意,windbg分32位和64位,由分析环境的位数决定.我这里安装的是32位的.安装过程很简单,一路next就可以. 2. 准备被 ...

  2. 【读后感】读《漫谈“大学生的四个learn”》之后有感

    在看完<许纪霖教授在上海财经大学演讲——漫谈“大学生的四个Learn”>(下问简称<四l>)之后突然有点话想说.其实我对这篇文章有感的,所以想写这篇文章来说说看,我对四个lea ...

  3. axios与vue的配合使用事例,实现缓存和重复加载的控制

    import Vue from "vue"; import qs from "qs"; import Store from "../vuex/stor ...

  4. Mac端StartUML的安装和破解

    **本人安装的是StarUML-3.0.1版本** 一.下载与安装 1. 从官方网站下载,网址:http://staruml.io/ 2. dmg文件下载完成后,双击安装. 二.破解 1. 安装npm ...

  5. Ajax学习笔记——基本原理

    Ajax(Asynchronous JavaScript + XML)不是语音,不是框架,也不能算是一种技术,而是一种模式.通过这种模式实现不重新加载整个页面的情况下,与服务器交换数据并更新部分网页内 ...

  6. Caused by: javax.persistence.NonUniqueResultException: result returns more than one elements

    Caused by: javax.persistence.NonUniqueResultException: result returns more than one elements at org. ...

  7. leetcode974

    这道题目描述很清晰,直接两层循环,代码如下: class Solution(object): def subarraysDivByK(self, A: 'List[int]', K: int) -&g ...

  8. 字母导航跳转react核心代码

    componentDidMount() { this.move(); } skipToDep(e) { let dom = document.getElementById(e); // 获取要跳至的字 ...

  9. TCPlayer web切换播放问题

    遇到播放的视频无法切换的问题,,即便是清除标签重新生成也不行~~ 需要使用自带的API ~别无他法 demo: http://imgcache.qq.com/open/qcloud/video/tcp ...

  10. springboot项目创建

    1.在eclipse中创建springboot项目,右键找到New,然后找到Spring Starter Project, 如果menu中找不到Spring Starter Project就选择oth ...