2015-03-02 138 views
2

我想「移植」this C++ project,它使用qmake(即Tool.pro文件)來構建,移植到cmake如何將qmake項目移植到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文件頭。我也不確定我在Tool.pro文件的前24行中的標誌。

請問您能指點我正確的方向嗎?

  • PS1。我已經看過CMake教程。
  • PS2。我試過 兩個腳本:q2cqmake2cmake。前者基本上建立了 空的CMakeLists.txt文件。後者構建了一個貌似OK 文件,但後來make失敗,說它無法找到某個頭文件(位於子目錄中)。
  • PS3。我已經成功用qmake建成了這個項目。
+0

我沒有一個答案,但你確定你檢查了所有可用的資源嗎?標準谷歌搜索的前三個結果會產生這些非常好看的資源(對不起,無法格式化):http://www.executionunit.com/blog/2014/01/22/moving-from-qmake- to-cmake/http://www.cmake.org/Wiki/CMake:ConvertFromQmake https://wiki.sofa-framework.org/wiki/SwitchingToCMake – 2015-03-02 17:10:23

+0

我檢查了三個中的第一個。我會看看其他兩個,謝謝! – 2015-03-02 17:22:04

+0

查看https://stackoverflow.com/questions/43763416/how-to-convert-qmake-to-cmake – 2017-10-24 06:53:55

回答

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})