C++ with gradle

前端 未结 3 898
感动是毒
感动是毒 2020-12-23 21:19

In Gradle 1.10 Release notes http://www.gradle.org/docs/current/release-notes I see C++ build mentioned.

How to set up C++ project to build with gradle?

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-23 21:34

    Starting on Gradle 2.3 there have been major changes to native-component builds and the executables and libraries containers are not available anymore. Citing Gradle 2.3 Release notes:

    ... the DSL for defining native executables and libraries has fundamentally changed. The executables and libraries containers have been removed, and components are now added by type to the components container owned by the model registry. Another major change is that source sets for a component are now declared directly within the component definition, instead of being configured on the sources block.

    The updated Gradle code compatible with Gradle 2.3+ will therefore look like:

    model {
      components {
        hello(NativeExecutableSpec) {
          sources {
            cpp {
              source {
                srcDir "src/foo/bar"
              }
            }
          }
        }
      }
    }
    

    You can learn more about the new model in Gradle user guide here.

提交回复
热议问题