C++ with gradle

前端 未结 3 910
感动是毒
感动是毒 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:27

    1. put this in build.gradle

      apply plugin: 'cpp'
      executables {
         hello {}
      }
      
    2. put your source file in src/hello/cpp/say_hello.cpp

    3. run 'gradle helloExecutable'

    4. your executable should be built to build/binaries/helloExecutable/hello

    Or, if you want your source in src/foo/bar then add

    sources {
        hello {
          cpp {
            source {
                srcDir "src/foo/bar"
            }
        }
    }
    

提交回复
热议问题