IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 游戏开发 -> Linux下编译fmt库 -> 正文阅读

[游戏开发]Linux下编译fmt库

下载

fmt的下载地址为https://github.com/fmtlib/fmt/tags,以下载版本8.1.1为例,下载后文件为fmt-8.1.1.tar.gz

编译

使用命令tar -zxvf fmt-8.1.1.tar.gz进行解压,解压完成后文件夹fmt-8.1.1中目录结构如下:

.
├── ChangeLog.rst
├── CMakeLists.txt
├── CONTRIBUTING.md
├── doc
├── include
├── LICENSE.rst
├── README.rst
├── src
├── support
└── test

使用命令mkdir build创建构建目录,然后进入build中(cd build),使用命令cmake ..构建工程,

[root@instance-1apocjsh build]# cmake ..
-- CMake version: 3.22.1
-- The CXX compiler identification is GNU 4.8.5
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Module support is disabled.
-- Version: 8.1.1
-- Build type: Release
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Failed
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - found
-- Target 'doc' disabled (requires doxygen)
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test HAVE_FNO_DELETE_NULL_POINTER_CHECKS
-- Performing Test HAVE_FNO_DELETE_NULL_POINTER_CHECKS - Success
-- FMT_PEDANTIC: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /root/fmt-8.1.1/build

再使用命令make -j16进行编译,

[root@instance-1apocjsh build]# make -j16
[  4%] Built target fmt
[  7%] Built target gtest
Consolidate compiler generated dependencies of target test-main
[ 13%] Built target test-main
Consolidate compiler generated dependencies of target args-test
[ 16%] Built target args-test
[ 18%] Building CXX object test/CMakeFiles/assert-test.dir/assert-test.cc.o
[ 20%] Linking CXX executable ../bin/assert-test
[ 20%] Built target assert-test
[ 21%] Building CXX object test/CMakeFiles/chrono-test.dir/chrono-test.cc.o
[ 23%] Linking CXX executable ../bin/chrono-test
[ 23%] Built target chrono-test
[ 24%] Building CXX object test/CMakeFiles/color-test.dir/color-test.cc.o
[ 26%] Linking CXX executable ../bin/color-test
[ 26%] Built target color-test
[ 27%] Building CXX object test/CMakeFiles/core-test.dir/core-test.cc.o
[ 29%] Linking CXX executable ../bin/core-test
[ 29%] Built target core-test
[ 30%] Building CXX object test/CMakeFiles/gtest-extra-test.dir/gtest-extra-test.cc.o
[ 32%] Linking CXX executable ../bin/gtest-extra-test
[ 32%] Built target gtest-extra-test
[ 33%] Building CXX object test/CMakeFiles/format-test.dir/format-test.cc.o
[ 35%] Linking CXX executable ../bin/format-test
[ 35%] Built target format-test
Consolidate compiler generated dependencies of target format-impl-test
[ 36%] Building CXX object test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o
[ 38%] Building CXX object test/CMakeFiles/format-impl-test.dir/gtest-extra.cc.o
[ 40%] Linking CXX executable ../bin/format-impl-test
[ 46%] Built target format-impl-test
[ 47%] Building CXX object test/CMakeFiles/ostream-test.dir/ostream-test.cc.o
[ 49%] Linking CXX executable ../bin/ostream-test
[ 49%] Built target ostream-test
[ 50%] Building CXX object test/CMakeFiles/compile-test.dir/compile-test.cc.o
[ 52%] Linking CXX executable ../bin/compile-test
[ 52%] Built target compile-test
Consolidate compiler generated dependencies of target compile-fp-test
[ 53%] Building CXX object test/CMakeFiles/compile-fp-test.dir/compile-fp-test.cc.o
[ 55%] Building CXX object test/CMakeFiles/compile-fp-test.dir/gtest-extra.cc.o
[ 56%] Linking CXX executable ../bin/compile-fp-test
[ 61%] Built target compile-fp-test
[ 63%] Building CXX object test/CMakeFiles/printf-test.dir/printf-test.cc.o
[ 64%] Linking CXX executable ../bin/printf-test
[ 64%] Built target printf-test
[ 66%] Building CXX object test/CMakeFiles/ranges-test.dir/ranges-test.cc.o
[ 67%] Building CXX object test/CMakeFiles/ranges-test.dir/ranges-odr-test.cc.o
[ 69%] Linking CXX executable ../bin/ranges-test
[ 69%] Built target ranges-test
[ 70%] Building CXX object test/CMakeFiles/scan-test.dir/scan-test.cc.o
[ 72%] Linking CXX executable ../bin/scan-test
[ 72%] Built target scan-test
Consolidate compiler generated dependencies of target unicode-test
[ 73%] Building CXX object test/CMakeFiles/unicode-test.dir/unicode-test.cc.o
[ 75%] Linking CXX executable ../bin/unicode-test
[ 81%] Built target unicode-test
[ 83%] Building CXX object test/CMakeFiles/xchar-test.dir/xchar-test.cc.o
[ 84%] Linking CXX executable ../bin/xchar-test
[ 84%] Built target xchar-test
[ 86%] Building CXX object test/CMakeFiles/enforce-checks-test.dir/enforce-checks-test.cc.o
[ 87%] Linking CXX executable ../bin/enforce-checks-test
[ 87%] Built target enforce-checks-test
Consolidate compiler generated dependencies of target posix-mock-test
[ 89%] Building CXX object test/CMakeFiles/posix-mock-test.dir/posix-mock-test.cc.o
[ 90%] Building CXX object test/CMakeFiles/posix-mock-test.dir/gtest-extra.cc.o
[ 92%] Building CXX object test/CMakeFiles/posix-mock-test.dir/util.cc.o
[ 93%] Linking CXX executable ../bin/posix-mock-test
[ 96%] Built target posix-mock-test
[ 98%] Building CXX object test/CMakeFiles/os-test.dir/os-test.cc.o
[100%] Linking CXX executable ../bin/os-test
[100%] Built target os-test

最后使用命令make install DESTDIR=目标目录进行安装。

[root@instance-1apocjsh build]# make install DESTDIR=xxx
Install the project...
-- Install configuration: "Release"
-- Installing: xxx/usr/local/lib64/libfmt.a
-- Installing: xxx/usr/local/lib64/cmake/fmt/fmt-config.cmake
-- Installing: xxx/usr/local/lib64/cmake/fmt/fmt-config-version.cmake
-- Installing: xxx/usr/local/lib64/cmake/fmt/fmt-targets.cmake
-- Installing: xxx/usr/local/lib64/cmake/fmt/fmt-targets-release.cmake
-- Installing: xxx/usr/local/include/fmt/args.h
-- Installing: xxx/usr/local/include/fmt/chrono.h
-- Installing: xxx/usr/local/include/fmt/color.h
-- Installing: xxx/usr/local/include/fmt/compile.h
-- Installing: xxx/usr/local/include/fmt/core.h
-- Installing: xxx/usr/local/include/fmt/format.h
-- Installing: xxx/usr/local/include/fmt/format-inl.h
-- Installing: xxx/usr/local/include/fmt/locale.h
-- Installing: xxx/usr/local/include/fmt/os.h
-- Installing: xxx/usr/local/include/fmt/ostream.h
-- Installing: xxx/usr/local/include/fmt/printf.h
-- Installing: xxx/usr/local/include/fmt/ranges.h
-- Installing: xxx/usr/local/include/fmt/xchar.h
-- Installing: xxx/usr/local/lib64/pkgconfig/fmt.pc

安装完成后,将目标目录中的include目录lib64目录放入到新建的fmt目录,最终供外部使用的fmt目录结构如下:

[root@instance-1apocjsh fmt]# tree
.
├── include
│   └── fmt
│       ├── args.h
│       ├── chrono.h
│       ├── color.h
│       ├── compile.h
│       ├── core.h
│       ├── format.h
│       ├── format-inl.h
│       ├── locale.h
│       ├── os.h
│       ├── ostream.h
│       ├── printf.h
│       ├── ranges.h
│       └── xchar.h
└── lib64
    ├── cmake
    │   └── fmt
    │       ├── fmt-config.cmake
    │       ├── fmt-config-version.cmake
    │       ├── fmt-targets.cmake
    │       └── fmt-targets-release.cmake
    ├── libfmt.a
    └── pkgconfig
        └── fmt.pc

6 directories, 19 files

使用

直接查看其Readme.md,非常详细。

  游戏开发 最新文章
6、英飞凌-AURIX-TC3XX: PWM实验之使用 GT
泛型自动装箱
CubeMax添加Rtthread操作系统 组件STM32F10
python多线程编程:如何优雅地关闭线程
数据类型隐式转换导致的阻塞
WebAPi实现多文件上传,并附带参数
from origin ‘null‘ has been blocked by
UE4 蓝图调用C++函数(附带项目工程)
Unity学习笔记(一)结构体的简单理解与应用
【Memory As a Programming Concept in C a
上一篇文章      下一篇文章      查看所有文章
加:2022-04-01 00:25:36  更:2022-04-01 00:26:44 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/23 18:55:53-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码