Adds Objective C++ Build capabilities to cscore mac (#1029)

This commit is contained in:
Thad House
2018-05-14 19:34:26 -07:00
committed by Peter Johnson
parent 406e18663d
commit 1d6eb629ad
3 changed files with 35 additions and 0 deletions

View File

@@ -5,6 +5,10 @@ ext {
devMain = 'edu.wpi.cscore.DevMain'
}
if (OperatingSystem.current().isMacOsX()) {
apply plugin: 'objective-cpp'
}
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
ext {
@@ -15,6 +19,21 @@ ext {
staticCvConfigs = [cscoreJNI: []]
useJava = true
useCpp = true
splitSetup = {
if (it.targetPlatform.operatingSystem.name == 'osx') {
it.sources {
macObjCpp(ObjectiveCppSourceSet) {
source {
srcDirs = ['src/main/native/objcpp']
include '**/*.mm'
}
exportedHeaders {
srcDirs 'src/main/native/include'
}
}
}
}
}
}
def examplesMap = [:];

View File

@@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>
@interface XYZPerson : NSObject
- (void)sayHello;
@end
@implementation XYZPerson
- (void)sayHello {
NSLog(@"Hello, World!");
}
@end

View File

@@ -21,8 +21,10 @@ def macCompilerArgs = ['-std=c++14', '-Wall', '-Wextra', '-Werror', '-pedantic-e
'-Wno-unused-const-variable', '-pthread']
def macCCompilerArgs = ['-Wall', '-Wextra', '-Werror', '-pedantic-errors', '-fPIC', '-g',
'-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-unused-private-field']
def macObjCLinkerArgs = ['-std=c++14', '-stdlib=libc++','-fobjc-arc', '-g', '-fPIC', '-Wall', '-Wextra', '-Werror']
def macReleaseCompilerArgs = ['-O2']
def macDebugCompilerArgs = ['-O0']
def macLinkerArgs = ['-framework', 'CoreFoundation', '-framework', 'AVFoundation', '-framework', 'Foundation', '-framework', 'CoreMedia', '-framework', 'CoreVideo']
def mac32BitArg = '-m32'
def buildAll = project.hasProperty('buildAll')
@@ -158,6 +160,8 @@ if (!project.hasProperty('onlyAthena')) {
CCompilerArgs = macCCompilerArgs
debugCompilerArgs = macDebugCompilerArgs
releaseCompilerArgs = macReleaseCompilerArgs
objCppCompilerArgs = macObjCLinkerArgs
linkerArgs = macLinkerArgs
releaseStripBinaries = true
compilerFamily = 'Clang'
detectPlatform = mac64PlatformDetect