如何将qmake项目移植到cmake

时间:2015-03-02 16:42:44

标签: c++ cmake qmake cudd catkin

我想将“this C++ project”移植到qmake,使用cmake(即Tool.pro文件)进行构建。

基本上,我正在询问如何通过查看上面的CMakeLists.txt文件来编写必要的Tool.pro文件。

这是我到目前为止所做的:

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文件中存在的标头。我也不确定我要对Tool.pro文件的前24行中的标记做些什么。

你能指出我正确的方向吗?

  • PS1。我已经看过CMake教程了。
  • PS2。我试过了 两个脚本:q2cqmake2cmake。前者基本上建立了 空CMakeLists.txt个文件。后者建立了一个似乎没问题 文件,但然后make失败,说它找不到一些头文件(位于子目录中)。
  • PS3。我已使用qmake成功构建了项目。

1 个答案:

答案 0 :(得分:2)

在牺牲了上面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})