我成功地编译了最新版本的Boost库,并将其安装到了我的linux机器上。现在,我希望能够使用pkg-config来简化与GCC提供链接参数的过程。
既然我懒得手动编写自己的.pc文件,有没有脚本/工具可以自动生成所需的.pc文件,或者以其他方式使用boost标志更新pkg-config?
(如果有人已经拥有该.pc文件,也欢迎共享。)
发布于 2016-06-25 19:53:31
boost也面临着类似的问题。编写简单的python脚本来生成.pc文件。省去了我编写所有链接器命令的痛苦。我已经把它贴到https://github.com/nmante/pkg-config-generator上了。
从本质上讲,你给脚本一个库文件(.so、.a、.dylib文件)所在的目录,它就会生成链接器命令(例如-lboost_graph)。您可以根据自己的需求进行调整和分支。
下面是我为我的机器(Mac )生成的示例boost.pc文件。您可以手动调整它,也可以使用我的github program在您的机器上生成它。
# Package Information for pkg-config
prefix=/usr/local/Cellar/boost/1.60.0_2
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/boost
includedir_new=${prefix}/include
Name: Boost
Description: Boost is awesome
Version: 1.60.0
Libs: -L${exec_prefix}/lib -lboost_prg_exec_monitor-mt
-lboost_math_c99f-mt -lboost_unit_test_framework-mt
-lboost_container-mt -lboost_log_setup -lboost_math_tr1l
-lboost_graph-mt -lboost_wserialization-mt -lboost_log-mt
-lboost_math_c99f -lboost_type_erasure -lboost_signals-mt
-lboost_test_exec_monitor -lboost_filesystem -lboost_thread-mt
-lboost_math_tr1f-mt -lboost_date_time -lboost_timer
-lboost_math_tr1f -lboost_test_exec_monitor-mt -lboost_container
-lboost_math_tr1 -lboost_type_erasure-mt
-lboost_program_options-mt -lboost_graph -lboost_log_setup-mt
-lboost_random -lboost_system -lboost_system-mt -lboost_locale-mt
-lboost_wserialization -lboost_regex -lboost_exception
-lboost_timer-mt -lboost_signals -lboost_filesystem-mt
-lboost_math_c99-mt -lboost_math_tr1-mt -lboost_serialization-mt
-lboost_serialization -lboost_prg_exec_monitor -lboost_exception-mt
-lboost_coroutine -lboost_math_c99 -lboost_iostreams-mt
-lboost_random-mt -lboost_program_options -lboost_atomic-mt
-lboost_date_time-mt -lboost_math_c99l -lboost_math_tr1l-mt
-lboost_context-mt -lboost_regex-mt -lboost_coroutine-mt
-lboost_log -lboost_chrono-mt -lboost_wave-mt
-lboost_iostreams -lboost_chrono -lboost_unit_test_framework
-lboost_math_c99l-mt
Cflags: -I${includedir_old} -I${includedir_new}
https://stackoverflow.com/questions/3971703
复制相似问题