简体   繁体   English

使用maven2构建基于autotools的C / C ++包

[英]Using maven2 to build autotools-based C/C++ package

I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. 我正在研究所有互操作的集合MATLAB,Java和C / C ++组件,但具有截然不同的编译/安装步骤。 We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ build and unit tests. 我们目前不为MATLAB编译任何东西,使用maven2进行Java构建和单元测试,并使用autotools进行C / C ++构建和单元测试。

I would like to move everything to a single build and unit test system, using maven2, but have not been able to find a plugin that will allow the C/C++ codestream to remain autotools-based and simply wrap it in a maven build. 我想使用maven2将所有内容移动到单个构建和单元测试系统,但是无法找到允许C / C ++代码流保持基于autotools的插件,只需将其包装在maven构建中即可。 Having to rip out autotools support and recreate all the dependencies in maven is most likely a deal-breaker, so I'm looking for a way for maven and autotools to play nicely together, rather than having to choose between the two. 不得不撕掉autotools支持并重新创建maven中的所有依赖关系很可能是一个交易破坏者,所以我正在寻找一种方法让maven和autotools很好地一起玩,而不是必须在两者之间做出选择。

Is this possible or even desirable? 这是可能的还是可取的? Are there resources out there that I have overlooked? 有没有我忽略的资源?

I don't really know autotools, but can't you use the maven exec plugin , that lets you execute system commands (or Java programs)? 我真的不知道autotools,但你不能使用maven exec插件 ,它允许你执行系统命令(或Java程序)? For example: 例如:

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>exec-one</id>
          <phase>compile</phase>
          <configuration>
            <executable>autogen</executable>
            <arguments>
              <argument>-v</argument>
            </arguments>
          </configuration>
          <goals>
            <goal>exec</goal>
          </goals>
        </execution>

        <execution>
          <id>exec-two</id>
          <phase>compile</phase>
          <configuration>
            <executable>automake</executable>
            <arguments>
              <argument>-v</argument>
              <argument>[other arguments]</argument>
            </arguments>
          </configuration>
          <goals>
            <goal>exec</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

I didn't test the pom fragment above, but it gives you some hints about how to proceed. 我没有测试上面的pom片段,但它给你一些关于如何继续的提示。

You did overlook the maven cbuild parent suite. 你确实忽略了maven cbuild父套件。 take a look at the "make-maven-plugin" section for more details. 请查看“make-maven-plugin”部分以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM