我目前正在从家用Windows PC上运行代码,通过SSH连接在Linux PC上进行编译。 但是由于生成的程序创build了一个GUI,所以我不能真正testing它。 是否有可能创build,除了Linux程序,我可以运行在我的家用电脑上的Windows EXE? 这是我的CMakeLists(使用QT5):
cmake_minimum_required(VERSION 2.8.11) project(p3) set(CMAKE_PREFIX_PATH $ENV{QT5_QMAKE_DIR}) MESSAGE(STATUS "QT5_QMAKE_DIR: " ${CMAKE_PREFIX_PATH}) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_AUTOMOC ON) # Possibly set this to DEBUG for testing set(CMAKE_BUILD_TYPE Release) include_directories(${CMAKE_CURRENT_BINARY_DIR}) #project source directories find_package(Qt5Widgets REQUIRED) find_package(Qt5Core REQUIRED) find_package(Qt5Gui REQUIRED) find_package(OpenMP) if (OPENMP_FOUND) message("OPENMP FOUND") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") endif() include_directories( ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ) add_definitions(${Qt5Widgets_DEFINITIONS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") if(UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() add_executable(p3 #.cpps and .hs ) set_property(TARGET p3 PROPERTY CXX_STANDARD 11) target_link_libraries(p3 ${Qt5Widgets_LIBRARIES})
您可以使用Linux托管的MinGW,但您必须自己构建Qt。 这是一个复杂的过程,并不是所有的Linux应用程序都能在Windows上完美运行。
也许,您可以使用支持X11的 Windows托管的SSH客户端(例如MobaXterm )来使用SSH X11转发 ,从服务器获取应用程序窗口?