ZeroTierOne/java/CMakeLists.txt
Grant Limberg e8cdff3eaf Merge branch 'adamierymenko-dev' into android-jni-dev
also update for changed function calls that now accept a local address

# Conflicts:
#	include/ZeroTierOne.h
#	java/CMakeLists.txt
#	java/jni/Android.mk
#	java/jni/ZT1_jnicache.cpp
#	java/jni/ZT1_jnilookup.h
#	java/jni/ZT1_jniutils.cpp
#	java/jni/com_zerotierone_sdk_Node.cpp
2015-09-26 13:47:55 -07:00

91 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.2)
project(ZeroTierOneJNI)
find_package(Java COMPONENTS Development)
message("JAVA_HOME: $ENV{JAVA_HOME}")
if(WIN32)
set(Java_INCLUDE_DIRS $ENV{JAVA_HOME}/include)
endif()
if(APPLE)
set(Java_INCLUDE_DIRS "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/JavaVM.framework/Headers")
endif()
message("Java Include Dirs: ${Java_INCLUDE_DIRS}")
if(WIN32)
add_definitions(-DNOMINMAX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W3 /MP")
endif()
if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386 -arch x86_64 -Wall -O3 -flto -fPIE -fvectorize -fstack-protector -mmacosx-version-min=10.7 -Wno-unused-private-field")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -fno-rtti")
endif()
set(src_files
../ext/lz4/lz4.c
../ext/json-parser/json.c
../ext/http-parser/http_parser.c
../node/C25519.cpp
../node/CertificateOfMembership.cpp
../node/Defaults.cpp
../node/Dictionary.cpp
../node/Identity.cpp
../node/IncomingPacket.cpp
../node/InetAddress.cpp
../node/Multicaster.cpp
../node/Network.cpp
../node/NetworkConfig.cpp
../node/Node.cpp
../node/OutboundMulticast.cpp
../node/Packet.cpp
../node/Peer.cpp
../node/Poly1305.cpp
../node/Salsa20.cpp
../node/SelfAwareness.cpp
../node/SHA512.cpp
../node/Switch.cpp
../node/Topology.cpp
../node/Utils.cpp
../osdep/Http.cpp
../osdep/OSUtils.cpp
jni/com_zerotierone_sdk_Node.cpp
jni/ZT_jniutils.cpp
jni/ZT_jnicache.cpp
)
set(include_dirs
${CMAKE_CURRENT_SOURCE_DIR}/../include/
${CMAKE_CURRENT_SOURCE_DIR}/../node/
${Java_INCLUDE_DIRS})
if(WIN32)
set(include_dirs
${include_dirs}
${Java_INCLUDE_DIRS}/win32)
endif()
include_directories(
${include_dirs}
)
add_library(${PROJECT_NAME} SHARED ${src_files})
if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".jnilib")
endif()
set(link_libs )
if(WIN32)
set(link_libs
wsock32
ws2_32
)
endif()
target_link_libraries(${PROJECT_NAME} ${link_libs})