How to I add an icon to my c++ executable using Gradle?
up vote
1
down vote
favorite
I want to add an icon to my cpp executable (.exe). I can't seem to find anything regarding it. I'm using the cpp plugin in Gradle. I have a folder in the project directory called etc with an icon in it.
I have seen posts how to do it in visual studio or eclipse but I want to do it in Gradle so when I build, the executable with already have the icon.
My code:
apply plugin: 'cpp'
model {
components {
main(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs "${projectDir}\source"
include "**\*.cpp"
}
exportedHeaders {
srcDirs "${projectDir}\source"
include "**\*.h"
}
}
}
}
}
platforms {
windows_x86 {
operatingSystem "windows"
architecture "x86"
}
}
repositories {
libs(PrebuiltLibraries) {
def libDir = "${projectDir}\lib\"
ms {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "ms.dll")
sharedLibraryLinkFile = file(libDir + "ms.lib")
}
}
conf {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "conf.dll")
sharedLibraryLinkFile = file(libDir + "conf.lib")
}
}
supp {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "supp.dll")
sharedLibraryLinkFile = file(libDir + "supp.lib")
}
}
}
}
toolChains {
mingw_x86(Gcc) {
path "C:\MinGW\bin"
eachPlatform() {
cCompiler.executable "gcc"
cppCompiler.executable "g++"
linker.executable "g++"
assembler.executable "as"
staticLibArchiver.executable "ar"
}
target("windows_x86")
}
}
binaries {
withType(NativeExecutableBinarySpec) {
if (toolChain in Gcc) {
cppCompiler.args "-m32"
cppCompiler.args "-c"
cppCompiler.args "-w"
cppCompiler.args "-I${projectDir}\include"
cppCompiler.args "-std=c++11"
cppCompiler.args "-MMD"
cppCompiler.args "-MP"
linker.args "-Llib"
lib library: "ms", linkage: "shared"
lib library: "conf", linkage: "shared"
lib library: "supp", linkage: "shared"
}
}
}
}
c++ windows gradle icons mingw
add a comment |
up vote
1
down vote
favorite
I want to add an icon to my cpp executable (.exe). I can't seem to find anything regarding it. I'm using the cpp plugin in Gradle. I have a folder in the project directory called etc with an icon in it.
I have seen posts how to do it in visual studio or eclipse but I want to do it in Gradle so when I build, the executable with already have the icon.
My code:
apply plugin: 'cpp'
model {
components {
main(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs "${projectDir}\source"
include "**\*.cpp"
}
exportedHeaders {
srcDirs "${projectDir}\source"
include "**\*.h"
}
}
}
}
}
platforms {
windows_x86 {
operatingSystem "windows"
architecture "x86"
}
}
repositories {
libs(PrebuiltLibraries) {
def libDir = "${projectDir}\lib\"
ms {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "ms.dll")
sharedLibraryLinkFile = file(libDir + "ms.lib")
}
}
conf {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "conf.dll")
sharedLibraryLinkFile = file(libDir + "conf.lib")
}
}
supp {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "supp.dll")
sharedLibraryLinkFile = file(libDir + "supp.lib")
}
}
}
}
toolChains {
mingw_x86(Gcc) {
path "C:\MinGW\bin"
eachPlatform() {
cCompiler.executable "gcc"
cppCompiler.executable "g++"
linker.executable "g++"
assembler.executable "as"
staticLibArchiver.executable "ar"
}
target("windows_x86")
}
}
binaries {
withType(NativeExecutableBinarySpec) {
if (toolChain in Gcc) {
cppCompiler.args "-m32"
cppCompiler.args "-c"
cppCompiler.args "-w"
cppCompiler.args "-I${projectDir}\include"
cppCompiler.args "-std=c++11"
cppCompiler.args "-MMD"
cppCompiler.args "-MP"
linker.args "-Llib"
lib library: "ms", linkage: "shared"
lib library: "conf", linkage: "shared"
lib library: "supp", linkage: "shared"
}
}
}
}
c++ windows gradle icons mingw
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to add an icon to my cpp executable (.exe). I can't seem to find anything regarding it. I'm using the cpp plugin in Gradle. I have a folder in the project directory called etc with an icon in it.
I have seen posts how to do it in visual studio or eclipse but I want to do it in Gradle so when I build, the executable with already have the icon.
My code:
apply plugin: 'cpp'
model {
components {
main(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs "${projectDir}\source"
include "**\*.cpp"
}
exportedHeaders {
srcDirs "${projectDir}\source"
include "**\*.h"
}
}
}
}
}
platforms {
windows_x86 {
operatingSystem "windows"
architecture "x86"
}
}
repositories {
libs(PrebuiltLibraries) {
def libDir = "${projectDir}\lib\"
ms {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "ms.dll")
sharedLibraryLinkFile = file(libDir + "ms.lib")
}
}
conf {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "conf.dll")
sharedLibraryLinkFile = file(libDir + "conf.lib")
}
}
supp {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "supp.dll")
sharedLibraryLinkFile = file(libDir + "supp.lib")
}
}
}
}
toolChains {
mingw_x86(Gcc) {
path "C:\MinGW\bin"
eachPlatform() {
cCompiler.executable "gcc"
cppCompiler.executable "g++"
linker.executable "g++"
assembler.executable "as"
staticLibArchiver.executable "ar"
}
target("windows_x86")
}
}
binaries {
withType(NativeExecutableBinarySpec) {
if (toolChain in Gcc) {
cppCompiler.args "-m32"
cppCompiler.args "-c"
cppCompiler.args "-w"
cppCompiler.args "-I${projectDir}\include"
cppCompiler.args "-std=c++11"
cppCompiler.args "-MMD"
cppCompiler.args "-MP"
linker.args "-Llib"
lib library: "ms", linkage: "shared"
lib library: "conf", linkage: "shared"
lib library: "supp", linkage: "shared"
}
}
}
}
c++ windows gradle icons mingw
I want to add an icon to my cpp executable (.exe). I can't seem to find anything regarding it. I'm using the cpp plugin in Gradle. I have a folder in the project directory called etc with an icon in it.
I have seen posts how to do it in visual studio or eclipse but I want to do it in Gradle so when I build, the executable with already have the icon.
My code:
apply plugin: 'cpp'
model {
components {
main(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs "${projectDir}\source"
include "**\*.cpp"
}
exportedHeaders {
srcDirs "${projectDir}\source"
include "**\*.h"
}
}
}
}
}
platforms {
windows_x86 {
operatingSystem "windows"
architecture "x86"
}
}
repositories {
libs(PrebuiltLibraries) {
def libDir = "${projectDir}\lib\"
ms {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "ms.dll")
sharedLibraryLinkFile = file(libDir + "ms.lib")
}
}
conf {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "conf.dll")
sharedLibraryLinkFile = file(libDir + "conf.lib")
}
}
supp {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(libDir + "supp.dll")
sharedLibraryLinkFile = file(libDir + "supp.lib")
}
}
}
}
toolChains {
mingw_x86(Gcc) {
path "C:\MinGW\bin"
eachPlatform() {
cCompiler.executable "gcc"
cppCompiler.executable "g++"
linker.executable "g++"
assembler.executable "as"
staticLibArchiver.executable "ar"
}
target("windows_x86")
}
}
binaries {
withType(NativeExecutableBinarySpec) {
if (toolChain in Gcc) {
cppCompiler.args "-m32"
cppCompiler.args "-c"
cppCompiler.args "-w"
cppCompiler.args "-I${projectDir}\include"
cppCompiler.args "-std=c++11"
cppCompiler.args "-MMD"
cppCompiler.args "-MP"
linker.args "-Llib"
lib library: "ms", linkage: "shared"
lib library: "conf", linkage: "shared"
lib library: "supp", linkage: "shared"
}
}
}
}
c++ windows gradle icons mingw
c++ windows gradle icons mingw
edited 7 hours ago
asked 9 hours ago
Osher Shuman
113
113
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203313%2fhow-to-i-add-an-icon-to-my-c-executable-using-gradle%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password