通过Cmake为Android Studio调试版本打开编译器优化

Bram 07/26/2017. 1 answers, 75 views
android-studio android-studio android-ndk android-ndk cmake

我为我的基于NDK的应用程序使用Android Studio 3.0。 对于C ++代码,我使用CMake作为外部构建器

这很好,我可以创建调试和释放二进制文件。

但是,我想打开一部分C ++代码(物理引擎)的编译器优化(例如-O3),不仅仅针对发布版本,还针对调试版本。

因此,按照原样创建大量调试版本,而不进行优化,但是,我希望在启用编译器优化的情况下构建一个静态库目标。

我怎么去解决这个问题?

我有一个静态库目标的CMakeLists,它使用顶级CMakeLists文件中的add_subdirectory()指令进行包含。

请注意,我指向我应用的build.gradle文件中的顶级CMakeLists,如下所示:

externalNativeBuild {
    cmake {
        path '../../Android/jni/CMakeLists.txt'
    }
} 

1 Answers


Bram 07/26/2017.

事实证明,你可以在你的CMakeLists.txt中使用像这样的配置规范的target_compile_options()宏:

target_compile_options(opende PRIVATE
"$<$:-O3>"
"$<$:-O3>"
) 

这个宏增加了现有的编译选项。


HighResolutionMusic.com - Download Hi-Res Songs

1 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
2 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
3 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
4 Imagine Dragons

Bad Liar flac

Imagine Dragons. 2018. Writer: Jorgen Odegard;Daniel Platzman;Ben McKee;Wayne Sermon;Aja Volkman;Dan Reynolds.
5 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
6 BTS

Waste It On Me flac

BTS. 2018. Writer: Steve Aoki;Jeff Halavacs;Ryan Ogren;Michael Gazzo;Nate Cyphert;Sean Foreman;RM.
7 Nicki Minaj

No Candle No Light flac

Nicki Minaj. 2018. Writer: Denisia “Blu June” Andrews;Kathryn Ostenberg;Brittany "Chi" Coney;Brian Lee;TJ Routon;Tushar Apte;ZAYN;Nicki Minaj.
8 Backstreet Boys

Chances flac

Backstreet Boys. 2018.
9 BlackPink

Kiss And Make Up flac

BlackPink. 2018. Writer: Soke;Kny Factory;Billboard;Chelcee Grimes;Teddy Park;Marc Vincent;Dua Lipa.
10 Little Mix

The Cure flac

Little Mix. 2018. Writer: Pete Kelleher;Camille Purcell;Tom Barnes;Ben Kohn.
11 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
12 Diplo

Close To Me flac

Diplo. 2018. Writer: Ellie Goulding;Savan Kotecha;Peter Svensson;Ilya;Swae Lee;Diplo.
13 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
14 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
15 Kelly Clarkson

Never Enough flac

Kelly Clarkson. 2018. Writer: Benj Pasek;Justin Paul.
16 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.
17 Frida Sundemo

Apologize flac

Frida Sundemo. 2018.
18 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
19 Imagine Dragons

Machine flac

Imagine Dragons. 2018. Writer: Wayne Sermon;Daniel Platzman;Dan Reynolds;Ben McKee;Alex Da Kid.
20 Billie Eilish

When The Party's Over flac

Billie Eilish. 2018. Writer: Billie Eilish;FINNEAS.

Related questions

Hot questions

Language

Popular Tags