mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-22 14:22:23 +00:00
90 lines
2.1 KiB
CMake
90 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/
|
|
${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}) |