Split the c++ source files into separate source sets for shared, lib and curses
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -18,6 +18,10 @@ allprojects {
|
|||||||
group = 'net.rubygrapefruit'
|
group = 'net.rubygrapefruit'
|
||||||
version = '0.5'
|
version = '0.5'
|
||||||
|
|
||||||
|
if (!project.hasProperty('release')) {
|
||||||
|
version = "${version}-dev"
|
||||||
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.5
|
sourceCompatibility = 1.5
|
||||||
targetCompatibility = 1.5
|
targetCompatibility = 1.5
|
||||||
|
|
||||||
@@ -131,18 +135,14 @@ libraries {
|
|||||||
sources {
|
sources {
|
||||||
nativePlatform {
|
nativePlatform {
|
||||||
cpp {
|
cpp {
|
||||||
source.srcDirs = ['src/main/cpp']
|
source.srcDirs = ['src/shared/cpp', 'src/main/cpp']
|
||||||
exportedHeaders.srcDirs = ['src/main/headers']
|
exportedHeaders.srcDirs = ['src/shared/headers']
|
||||||
source.exclude 'curses.cpp'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nativePlatformCurses {
|
nativePlatformCurses {
|
||||||
cpp {
|
cpp {
|
||||||
source.srcDirs = ['src/main/cpp']
|
source.srcDirs = ['src/shared/cpp', 'src/curses/cpp']
|
||||||
exportedHeaders.srcDirs = ['src/main/headers']
|
exportedHeaders.srcDirs = ['src/shared/headers']
|
||||||
source.include 'curses.cpp'
|
|
||||||
source.include 'generic.cpp'
|
|
||||||
source.include 'generic_posix.cpp'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,76 +1,76 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Adam Murdoch
|
* Copyright 2012 Adam Murdoch
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __INCLUDE_GENERIC_H__
|
#ifndef __INCLUDE_GENERIC_H__
|
||||||
#define __INCLUDE_GENERIC_H__
|
#define __INCLUDE_GENERIC_H__
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NATIVE_VERSION 17
|
#define NATIVE_VERSION 17
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Marks the given result as failed, using the given error message
|
* Marks the given result as failed, using the given error message
|
||||||
*/
|
*/
|
||||||
extern void mark_failed_with_message(JNIEnv *env, const char* message, jobject result);
|
extern void mark_failed_with_message(JNIEnv *env, const char* message, jobject result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Marks the given result as failed, using the given error message and the current value of errno/GetLastError()
|
* Marks the given result as failed, using the given error message and the current value of errno/GetLastError()
|
||||||
*/
|
*/
|
||||||
extern void mark_failed_with_errno(JNIEnv *env, const char* message, jobject result);
|
extern void mark_failed_with_errno(JNIEnv *env, const char* message, jobject result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Marks the given result as failed, using the given error message and error code
|
* Marks the given result as failed, using the given error message and error code
|
||||||
*/
|
*/
|
||||||
extern void mark_failed_with_code(JNIEnv *env, const char* message, int error_code, const char* error_code_message, jobject result);
|
extern void mark_failed_with_code(JNIEnv *env, const char* message, int error_code, const char* error_code_message, jobject result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Converts the given Java string to a NULL terminated wchar_str. Should call free() when finished.
|
* Converts the given Java string to a NULL terminated wchar_str. Should call free() when finished.
|
||||||
*
|
*
|
||||||
* Returns NULL on failure.
|
* Returns NULL on failure.
|
||||||
*/
|
*/
|
||||||
extern wchar_t*
|
extern wchar_t*
|
||||||
java_to_wchar(JNIEnv *env, jstring string, jobject result);
|
java_to_wchar(JNIEnv *env, jstring string, jobject result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Converts the given wchar_t string to a Java string.
|
* Converts the given wchar_t string to a Java string.
|
||||||
*
|
*
|
||||||
* Returns NULL on failure.
|
* Returns NULL on failure.
|
||||||
*/
|
*/
|
||||||
extern jstring wchar_to_java(JNIEnv* env, const wchar_t* chars, size_t len, jobject result);
|
extern jstring wchar_to_java(JNIEnv* env, const wchar_t* chars, size_t len, jobject result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Converts the given Java string to a NULL terminated char string. Should call free() when finished.
|
* Converts the given Java string to a NULL terminated char string. Should call free() when finished.
|
||||||
*
|
*
|
||||||
* Returns NULL on failure.
|
* Returns NULL on failure.
|
||||||
*/
|
*/
|
||||||
extern char* java_to_char(JNIEnv *env, jstring string, jobject result);
|
extern char* java_to_char(JNIEnv *env, jstring string, jobject result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Converts the given NULL terminated char string to a Java string.
|
* Converts the given NULL terminated char string to a Java string.
|
||||||
*
|
*
|
||||||
* Returns NULL on failure.
|
* Returns NULL on failure.
|
||||||
*/
|
*/
|
||||||
extern jstring char_to_java(JNIEnv* env, const char* chars, jobject result);
|
extern jstring char_to_java(JNIEnv* env, const char* chars, jobject result);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user