在Atom的.atom-build.yml

时间:2017-11-21 16:27:23

标签: makefile cmake yaml atom-editor

Atom Build package使用.atom-build.yml文件来指定项目构建目标,因此我创建了简单的.atom-build.yml以满足我的需求。一切都很好,除了一小部分。在其背景下:

targets:
    Run CMake for Windows:
        cmd: "cmake"
        atomCommandName: "Create Makefiles with CMake"
        args:
            - "-Bbuild"
            - "-H."
            - "-G\"MinGW Makefiles\""

在这个特定目标中,我想要cmake,因为Build CMake不起作用,或者我不知道如何使用它。使用时,Build包运行cmd /C以运行在cmd:之后使用参数args:编写的命令。因此,Atom中显示的调用是:

cmd /C cmake -Bbuild -H. -G"MinGW Makefiles"

使用-G选项,我定义了目标make环境,默认情况下为NMake Makefiles,我想要MinGW Makefiles。运行上面的目标后,cmake抛出错误:

CMake Error: Could not create named generator "MinGW

...并列出所有可用的发电机。显然,MinGW Makefiles中的空格使Makefiles被理解为下一个参数。我尝试使用\^转义它,但它无效。此外,我尝试将args移动到cmd字段,因为它将从单个命令行调用运行。

我的问题是:如何使用Atom Build软件包运行cmake目标,-G选项正确传递给cmake

编辑:

'-G "MinGW Makefiles"'错误仍然存​​在。

使用"-G ""MinGW Makefiles""" Atom抛出错误:

bad indentation of a sequence entry at line 15, column 19:
                - "-G""MinGW Makefiles"""
                      ^

1 个答案:

答案 0 :(得分:0)

我找到了使用上述参数运行m,n,p,q = a.shape r,s = b.shape[-2:] out = (b.reshape(m,n,p,r//p,q,s//q)*a[:,:,:,None,:,None]).reshape(b.shape) 的其他方法。我创建了cmake文件,其中包含:

PreLoad.cmake

此文件由set (CMAKE_MAKE_PROGRAM "C:/Program\ Files\ (x86)/GnuWin32/bin/make.exe" CACHE INTERNAL "" FORCE) set (CMAKE_GENERATOR "MinGW Makefiles" CACHE INTERNAL "" FORCE) set (EXECUTABLE_OUTPUT_PATH "build" CACHE INTERNAL "" FORCE) 在CMakeLists.txt之前提取,因此它会覆盖默认的cmake设置。其次,我修改了cmake

.atom-build.yml

Works 几乎完美 - Atom Build包不支持输入。

运行:

cmd: "g++"
atomCommandName: "Compile and run with g++"
name: "Compile and run single file C++ project"
args:
    - "{FILE_ACTIVE}"
    - "-o {FILE_ACTIVE_PATH}/application.exe &&"
    - "{FILE_ACTIVE_PATH}/application.exe"
targets:
    Run CMake:
        cmd: "cmake ."
        atomCommandName: "Create Makefiles with CMake"
    Build Makefile project:
        atomCommandName: "Make all"
        cmd: "make"
        args:
            - "-j4"
            - "all"
    Run application:
        atomCommandName: "Run application"
        cmd: "{FILE_ACTIVE_PATH}/build/application.exe"
    Full CMake build:
        atomCommandName: "Full CMake build"
        cmd: "cmake . && make -j4 all && {FILE_ACTIVE_PATH}/build/application.exe"

直接从命令提示符(或没有cmd /C cmake -Bbuild -H. -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=make )工作。然而,从Atom我得到:

cmd /C

这是The system cannot find the path specified. 错误。我不知道它为什么会持续存在。