Created
September 23, 2013 14:50
-
-
Save sonOfRa/6671578 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) | |
find_package(JNI REQUIRED) | |
set(NEED_JNI_MD y) | |
else() | |
if(NOT DEFINED NEED_JNI_MD) | |
set(NEED_JNI_MD y) | |
endif() | |
if(NOT DEFINED JNI_H) | |
message(FATAL_ERROR "Need to specify jni.h location when cross-compiling. Please specify location with -DJNI_H=/path/to/jni.h") | |
endif() | |
if(NOT DEFINED JNI_MD_H) | |
if(NOT ${NEED_JNI_MD} MATCHES n) | |
message(FATAL_ERROR "Need to specify jni_md.h location when cross-compiling. Please specify location with -DJNI_MD_H=/path/to/jni_md.h. When building for a platform without jni_md.h (e.g. Android), set -DNEED_JNI_MD=n") | |
endif() | |
endif() | |
set(JAVA_INCLUDE_PATH ${JNI_H}) | |
if(NOT ${NEED_JNI_MD} MATCHES n) | |
set(JAVA_INCLUDE_PATH2 ${JNI_MD_H}) | |
endif() | |
endif() | |
find_package(libtoxcore REQUIRED) | |
if(${NEED_JNI_MD} MATCHES "y") | |
include_directories( | |
"${JNI_HEADER_LOCATION}" | |
"${JAVA_INCLUDE_PATH}" | |
"${JAVA_INCLUDE_PATH2}" | |
"${libtoxcore_INCLUDE_DIRS}" | |
) | |
else() | |
include_directories( | |
"${JNI_HEADER_LOCATION}" | |
"${JAVA_INCLUDE_PATH}" | |
"${libtoxcore_INCLUDE_DIRS}" | |
) | |
endif() | |
add_library( | |
${LIB_TARGET_NAME} | |
SHARED | |
callbacks.h | |
JTox.c | |
) | |
if(CMAKE_SYSTEM_NAME STREQUAL Windows) | |
set(WS2_32 ws2_32) | |
endif() | |
target_link_libraries( | |
${LIB_TARGET_NAME} | |
${libtoxcore_LIBRARIES} | |
${WS2_32} | |
) | |
add_dependencies(${LIB_TARGET_NAME} ${JAR_TARGET_NAME}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment