如何将 qmake 项目移植到 cmake
How to port a qmake project to cmake
我想"port" this C++ project, which uses qmake
(i.e., a Tool.pro 文件)进行构建,cmake
.
本质上,我是在询问如何通过查看上面的 Tool.pro
文件来编写必要的 CMakeLists.txt
文件。
这是我目前所做的:
include_directories(../lib/cudd-2.5.0/include BFAbstractionLibrary)
add_executable(slugs BFAbstractionLibrary/bddDump.cpp BFAbstractionLibrary/BFCuddVarVector.cpp BFAbstractionLibrary/BFCudd.cpp BFAbstractionLibrary/BFCuddManager.cpp \
BFAbstractionLibrary/BFCuddVarCube.cpp tools.cpp synthesisAlgorithm.cpp synthesisContextBasics.cpp variableManager.cpp \
BFAbstractionLibrary/BFCuddMintermEnumerator.cpp)
add_library(lcudd ../lib/cudd-2.5.0/cudd)
add_library(ldddmp ../lib/cudd-2.5.0/dddmp)
add_library(lmtr ../lib/cudd-2.5.0/mtr)
add_library(lepd ../lib/cudd-2.5.0/epd)
add_library(lst ../lib/cudd-2.5.0/st)
add_library(lutil ../lib/cudd-2.5.0/util)
target_link_libraries(slugs lcudd, lutil, lmtr, lst, ldddmp, lepd)
这肯定缺少 Tool.pro
文件中存在的 header。我也不确定如何处理 Tool.pro
文件前 24 行的标志。
你能给我指明正确的方向吗?
- PS1。我已经看过 CMake 教程。
- PS2。我努力了
两个脚本:
q2c
、qmake2cmake
。前者基本上建立了一个
空 CMakeLists.txt
文件。后者建了个貌似OK
文件,但 make
失败,说它找不到一些 header 文件(位于子目录中)。
- PS3。我已经使用
qmake
. 成功构建了项目
在牺牲了上面 Tool.pro
文件的一些模块化和复杂性之后,我能够使用 cmake
构建项目。这是我写的 CMakeLists.txt
文件:
project( slugs )
cmake_minimum_required( VERSION 2.6 )
add_definitions ( -Wall )
add_definitions ( -D USE_CUDD )
set ( BDDFLAGS "-mtune=native -malign-double -DHAVE_IEEE_754 -DBSD -DCUDD_COMPILER_OPTIONS_SET" ) # hardcoded for x86_64
add_definitions ( ${BDDFLAGS} )
set ( CMAKE_BUILD_TYPE Debug )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=gnu++0x -Wall -Wextra ${BDDFLAGS}")
include_directories ( ../lib/cudd-2.5.0/include BFAbstractionLibrary )
set ( slugs_HDRS
BFAbstractionLibrary/BF.h
BFAbstractionLibrary/BFCudd.h
gr1context.hpp
variableTypes.hpp
variableManager.hpp
extensionExtractExplicitStrategy.hpp
extensionRoboticsSemantics.hpp
extensionWeakenSafetyAssumptions.hpp
extensionBiasForAction.hpp
extensionComputeCNFFormOfTheSpecification.hpp
extensionCounterstrategy.hpp
extensionExtractExplicitCounterstrategy.hpp
extensionIncrementalSynthesis.hpp
extensionFixedPointRecycling.hpp
extensionInteractiveStrategy.hpp
extensionIROSfastslow.hpp
extensionAnalyzeInitialPositions.hpp
extensionAnalyzeAssumptions.hpp
BFAbstractionLibrary/BFCuddMintermEnumerator.h
extensionComputeInterestingRunOfTheSystem.hpp
extensionAnalyzeSafetyLivenessInteraction.hpp
extensionAbstractWinningTraceGenerator.hpp
extensionInterleave.hpp
extensionPermissiveExplicitStrategy.hpp
extensionIncompleteInformationEstimatorSynthesis.hpp
extensionNondeterministicMotion.hpp
extensionExtractSymbolicStrategy.hpp
extensionTwoDimensionalCost.hpp
)
set ( slugs_SRCS
main.cpp
BFAbstractionLibrary/bddDump.cpp
BFAbstractionLibrary/BFCuddVarVector.cpp
BFAbstractionLibrary/BFCudd.cpp
BFAbstractionLibrary/BFCuddManager.cpp
BFAbstractionLibrary/BFCuddVarCube.cpp
tools.cpp
synthesisAlgorithm.cpp
synthesisContextBasics.cpp
variableManager.cpp
BFAbstractionLibrary/BFCuddMintermEnumerator.cpp
)
set ( slugs_LIBS
-L../lib/cudd-2.5.0/cudd
-L../lib/cudd-2.5.0/util
-L../lib/cudd-2.5.0/mtr
-L../lib/cudd-2.5.0/st
-L../lib/cudd-2.5.0/dddmp
-L../lib/cudd-2.5.0/epd
-lcudd
-ldddmp
-lmtr
-lepd
-lst
-lutil
)
add_executable ( slugs ${slugs_SRCS} )
target_link_libraries (slugs ${slugs_LIBS})
我想"port" this C++ project, which uses qmake
(i.e., a Tool.pro 文件)进行构建,cmake
.
本质上,我是在询问如何通过查看上面的 Tool.pro
文件来编写必要的 CMakeLists.txt
文件。
这是我目前所做的:
include_directories(../lib/cudd-2.5.0/include BFAbstractionLibrary)
add_executable(slugs BFAbstractionLibrary/bddDump.cpp BFAbstractionLibrary/BFCuddVarVector.cpp BFAbstractionLibrary/BFCudd.cpp BFAbstractionLibrary/BFCuddManager.cpp \
BFAbstractionLibrary/BFCuddVarCube.cpp tools.cpp synthesisAlgorithm.cpp synthesisContextBasics.cpp variableManager.cpp \
BFAbstractionLibrary/BFCuddMintermEnumerator.cpp)
add_library(lcudd ../lib/cudd-2.5.0/cudd)
add_library(ldddmp ../lib/cudd-2.5.0/dddmp)
add_library(lmtr ../lib/cudd-2.5.0/mtr)
add_library(lepd ../lib/cudd-2.5.0/epd)
add_library(lst ../lib/cudd-2.5.0/st)
add_library(lutil ../lib/cudd-2.5.0/util)
target_link_libraries(slugs lcudd, lutil, lmtr, lst, ldddmp, lepd)
这肯定缺少 Tool.pro
文件中存在的 header。我也不确定如何处理 Tool.pro
文件前 24 行的标志。
你能给我指明正确的方向吗?
- PS1。我已经看过 CMake 教程。
- PS2。我努力了
两个脚本:
q2c
、qmake2cmake
。前者基本上建立了一个 空CMakeLists.txt
文件。后者建了个貌似OK 文件,但make
失败,说它找不到一些 header 文件(位于子目录中)。 - PS3。我已经使用
qmake
. 成功构建了项目
在牺牲了上面 Tool.pro
文件的一些模块化和复杂性之后,我能够使用 cmake
构建项目。这是我写的 CMakeLists.txt
文件:
project( slugs )
cmake_minimum_required( VERSION 2.6 )
add_definitions ( -Wall )
add_definitions ( -D USE_CUDD )
set ( BDDFLAGS "-mtune=native -malign-double -DHAVE_IEEE_754 -DBSD -DCUDD_COMPILER_OPTIONS_SET" ) # hardcoded for x86_64
add_definitions ( ${BDDFLAGS} )
set ( CMAKE_BUILD_TYPE Debug )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=gnu++0x -Wall -Wextra ${BDDFLAGS}")
include_directories ( ../lib/cudd-2.5.0/include BFAbstractionLibrary )
set ( slugs_HDRS
BFAbstractionLibrary/BF.h
BFAbstractionLibrary/BFCudd.h
gr1context.hpp
variableTypes.hpp
variableManager.hpp
extensionExtractExplicitStrategy.hpp
extensionRoboticsSemantics.hpp
extensionWeakenSafetyAssumptions.hpp
extensionBiasForAction.hpp
extensionComputeCNFFormOfTheSpecification.hpp
extensionCounterstrategy.hpp
extensionExtractExplicitCounterstrategy.hpp
extensionIncrementalSynthesis.hpp
extensionFixedPointRecycling.hpp
extensionInteractiveStrategy.hpp
extensionIROSfastslow.hpp
extensionAnalyzeInitialPositions.hpp
extensionAnalyzeAssumptions.hpp
BFAbstractionLibrary/BFCuddMintermEnumerator.h
extensionComputeInterestingRunOfTheSystem.hpp
extensionAnalyzeSafetyLivenessInteraction.hpp
extensionAbstractWinningTraceGenerator.hpp
extensionInterleave.hpp
extensionPermissiveExplicitStrategy.hpp
extensionIncompleteInformationEstimatorSynthesis.hpp
extensionNondeterministicMotion.hpp
extensionExtractSymbolicStrategy.hpp
extensionTwoDimensionalCost.hpp
)
set ( slugs_SRCS
main.cpp
BFAbstractionLibrary/bddDump.cpp
BFAbstractionLibrary/BFCuddVarVector.cpp
BFAbstractionLibrary/BFCudd.cpp
BFAbstractionLibrary/BFCuddManager.cpp
BFAbstractionLibrary/BFCuddVarCube.cpp
tools.cpp
synthesisAlgorithm.cpp
synthesisContextBasics.cpp
variableManager.cpp
BFAbstractionLibrary/BFCuddMintermEnumerator.cpp
)
set ( slugs_LIBS
-L../lib/cudd-2.5.0/cudd
-L../lib/cudd-2.5.0/util
-L../lib/cudd-2.5.0/mtr
-L../lib/cudd-2.5.0/st
-L../lib/cudd-2.5.0/dddmp
-L../lib/cudd-2.5.0/epd
-lcudd
-ldddmp
-lmtr
-lepd
-lst
-lutil
)
add_executable ( slugs ${slugs_SRCS} )
target_link_libraries (slugs ${slugs_LIBS})