2016-07-18 16:37:49 +02:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2016-01-28 15:44:31 +01:00
|
|
|
set(JNI_NATIVE_SOURCES
|
|
|
|
rocksjni/backupablejni.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/backupenginejni.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/checkpoint.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/clock_cache.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/columnfamilyhandle.cc
|
|
|
|
rocksjni/compaction_filter.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/compaction_options_fifo.cc
|
|
|
|
rocksjni/compaction_options_universal.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/comparator.cc
|
|
|
|
rocksjni/comparatorjnicallback.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/compression_options.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/env.cc
|
2016-09-29 23:04:41 +02:00
|
|
|
rocksjni/env_options.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/filter.cc
|
2017-05-24 20:13:25 +02:00
|
|
|
rocksjni/ingest_external_file_options.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/iterator.cc
|
|
|
|
rocksjni/loggerjnicallback.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/lru_cache.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/memtablejni.cc
|
|
|
|
rocksjni/merge_operator.cc
|
|
|
|
rocksjni/options.cc
|
|
|
|
rocksjni/ratelimiterjni.cc
|
|
|
|
rocksjni/remove_emptyvalue_compactionfilterjni.cc
|
|
|
|
rocksjni/restorejni.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/rocksdb_exception_test.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/rocksjni.cc
|
|
|
|
rocksjni/slice.cc
|
|
|
|
rocksjni/snapshot.cc
|
2016-09-29 23:04:41 +02:00
|
|
|
rocksjni/sst_file_writerjni.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/statistics.cc
|
2017-07-12 08:19:53 +02:00
|
|
|
rocksjni/statisticsjni.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
rocksjni/table.cc
|
|
|
|
rocksjni/transaction_log.cc
|
|
|
|
rocksjni/ttl.cc
|
|
|
|
rocksjni/write_batch.cc
|
|
|
|
rocksjni/write_batch_test.cc
|
2017-04-22 05:41:37 +02:00
|
|
|
rocksjni/write_batch_with_index.cc
|
|
|
|
rocksjni/writebatchhandlerjnicallback.cc
|
2016-01-28 15:44:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
set(NATIVE_JAVA_CLASSES
|
|
|
|
org.rocksdb.AbstractCompactionFilter
|
|
|
|
org.rocksdb.AbstractComparator
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.AbstractImmutableNativeReference
|
|
|
|
org.rocksdb.AbstractNativeReference
|
|
|
|
org.rocksdb.AbstractRocksIterator
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.AbstractSlice
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.AbstractWriteBatch
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.BackupableDBOptions
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.BackupEngine
|
|
|
|
org.rocksdb.BackupEngineTest
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.BlockBasedTableConfig
|
|
|
|
org.rocksdb.BloomFilter
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.Cache
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.Checkpoint
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.ClockCache
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.ColumnFamilyHandle
|
|
|
|
org.rocksdb.ColumnFamilyOptions
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.CompactionOptionsFIFO
|
|
|
|
org.rocksdb.CompactionOptionsUniversal
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.Comparator
|
|
|
|
org.rocksdb.ComparatorOptions
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.CompressionOptions
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.DBOptions
|
|
|
|
org.rocksdb.DirectComparator
|
|
|
|
org.rocksdb.DirectSlice
|
|
|
|
org.rocksdb.Env
|
2016-09-29 23:04:41 +02:00
|
|
|
org.rocksdb.EnvOptions
|
|
|
|
org.rocksdb.ExternalSstFileInfo
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.Filter
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.FlushOptions
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.HashLinkedListMemTableConfig
|
|
|
|
org.rocksdb.HashSkipListMemTableConfig
|
|
|
|
org.rocksdb.Logger
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.LRUCache
|
|
|
|
org.rocksdb.MemTableConfig
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.MergeOperator
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.NativeLibraryLoader
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.Options
|
|
|
|
org.rocksdb.PlainTableConfig
|
2016-10-13 00:00:37 +02:00
|
|
|
org.rocksdb.RateLimiter
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.ReadOptions
|
|
|
|
org.rocksdb.RemoveEmptyValueCompactionFilter
|
|
|
|
org.rocksdb.RestoreOptions
|
|
|
|
org.rocksdb.RocksDB
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.RocksDBExceptionTest
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.RocksEnv
|
|
|
|
org.rocksdb.RocksIterator
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.RocksIteratorInterface
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.RocksMemEnv
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.RocksMutableObject
|
|
|
|
org.rocksdb.RocksObject
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.SkipListMemTableConfig
|
|
|
|
org.rocksdb.Slice
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.Snapshot
|
|
|
|
org.rocksdb.SnapshotTest
|
2016-09-29 23:04:41 +02:00
|
|
|
org.rocksdb.SstFileWriter
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.Statistics
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.StringAppendOperator
|
|
|
|
org.rocksdb.TableFormatConfig
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.TransactionLogIterator
|
|
|
|
org.rocksdb.TtlDB
|
|
|
|
org.rocksdb.VectorMemTableConfig
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.WBWIRocksIterator
|
2016-01-28 15:44:31 +01:00
|
|
|
org.rocksdb.WriteBatch
|
|
|
|
org.rocksdb.WriteBatch.Handler
|
|
|
|
org.rocksdb.WriteBatchTest
|
|
|
|
org.rocksdb.WriteBatchTestInternalHelper
|
2017-04-22 05:41:37 +02:00
|
|
|
org.rocksdb.WriteBatchWithIndex
|
|
|
|
org.rocksdb.WriteOptions
|
2016-01-28 15:44:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
include_directories($ENV{JAVA_HOME}/include)
|
|
|
|
include_directories($ENV{JAVA_HOME}/include/win32)
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/java)
|
|
|
|
|
|
|
|
set(JAVA_TEST_LIBDIR ${PROJECT_SOURCE_DIR}/java/test-libs)
|
|
|
|
set(JAVA_TMP_JAR ${JAVA_TEST_LIBDIR}/tmp.jar)
|
|
|
|
set(JAVA_JUNIT_JAR ${JAVA_TEST_LIBDIR}/junit-4.12.jar)
|
|
|
|
set(JAVA_HAMCR_JAR ${JAVA_TEST_LIBDIR}/hamcrest-core-1.3.jar)
|
|
|
|
set(JAVA_MOCKITO_JAR ${JAVA_TEST_LIBDIR}/mockito-all-1.10.19.jar)
|
|
|
|
set(JAVA_CGLIB_JAR ${JAVA_TEST_LIBDIR}/cglib-2.2.2.jar)
|
|
|
|
set(JAVA_ASSERTJ_JAR ${JAVA_TEST_LIBDIR}/assertj-core-1.7.1.jar)
|
|
|
|
set(JAVA_TESTCLASSPATH "${JAVA_JUNIT_JAR}\;${JAVA_HAMCR_JAR}\;${JAVA_MOCKITO_JAR}\;${JAVA_CGLIB_JAR}\;${JAVA_ASSERTJ_JAR}")
|
|
|
|
|
|
|
|
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/java/classes)
|
2016-08-18 01:59:22 +02:00
|
|
|
file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/java/classes)
|
2016-01-28 15:44:31 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT EXISTS ${JAVA_TEST_LIBDIR})
|
2016-08-18 01:59:22 +02:00
|
|
|
file(MAKE_DIRECTORY mkdir ${JAVA_TEST_LIBDIR})
|
2016-01-28 15:44:31 +01:00
|
|
|
endif()
|
|
|
|
|
2017-04-22 05:41:37 +02:00
|
|
|
if (DEFINED CUSTOM_REPO_URL)
|
|
|
|
set(SEARCH_REPO_URL ${CUSTOM_REPO_URL}/)
|
|
|
|
set(CENTRAL_REPO_URL ${CUSTOM_REPO_URL}/)
|
|
|
|
else ()
|
|
|
|
set(SEARCH_REPO_URL "http://search.maven.org/remotecontent?filepath=")
|
|
|
|
set(CENTRAL_REPO_URL "http://central.maven.org/maven2/")
|
|
|
|
endif()
|
|
|
|
|
2016-01-28 15:44:31 +01:00
|
|
|
if(NOT EXISTS ${JAVA_JUNIT_JAR})
|
|
|
|
message("Downloading ${JAVA_JUNIT_JAR}")
|
2017-04-22 05:41:37 +02:00
|
|
|
file(DOWNLOAD ${SEARCH_REPO_URL}junit/junit/4.12/junit-4.12.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 15:44:31 +01:00
|
|
|
list(GET downloadStatus 0 error_code)
|
|
|
|
if(NOT error_code EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_JUNIT_JAR}")
|
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_JUNIT_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_HAMCR_JAR})
|
|
|
|
message("Downloading ${JAVA_HAMCR_JAR}")
|
2017-04-22 05:41:37 +02:00
|
|
|
file(DOWNLOAD ${SEARCH_REPO_URL}org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 15:44:31 +01:00
|
|
|
list(GET downloadStatus 0 error_code)
|
|
|
|
if(NOT error_code EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_HAMCR_JAR}")
|
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_HAMCR_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_MOCKITO_JAR})
|
|
|
|
message("Downloading ${JAVA_MOCKITO_JAR}")
|
2017-04-22 05:41:37 +02:00
|
|
|
file(DOWNLOAD ${SEARCH_REPO_URL}org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 15:44:31 +01:00
|
|
|
list(GET downloadStatus 0 error_code)
|
|
|
|
if(NOT error_code EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_MOCKITO_JAR}")
|
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_MOCKITO_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_CGLIB_JAR})
|
|
|
|
message("Downloading ${JAVA_CGLIB_JAR}")
|
2017-04-22 05:41:37 +02:00
|
|
|
file(DOWNLOAD ${SEARCH_REPO_URL}cglib/cglib/2.2.2/cglib-2.2.2.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 15:44:31 +01:00
|
|
|
list(GET downloadStatus 0 error_code)
|
|
|
|
if(NOT error_code EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_CGLIB_JAR}")
|
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_CGLIB_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_ASSERTJ_JAR})
|
|
|
|
message("Downloading ${JAVA_ASSERTJ_JAR}")
|
2017-04-22 05:41:37 +02:00
|
|
|
file(DOWNLOAD ${CENTRAL_REPO_URL}org/assertj/assertj-core/1.7.1/assertj-core-1.7.1.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 15:44:31 +01:00
|
|
|
list(GET downloadStatus 0 error_code)
|
|
|
|
if(NOT error_code EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_ASSERTJ_JAR}")
|
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_ASSERTJ_JAR})
|
|
|
|
endif()
|
|
|
|
|
2016-07-27 01:18:49 +02:00
|
|
|
if(WIN32)
|
|
|
|
set(JAVAC cmd /c javac)
|
|
|
|
set(JAVAH cmd /c javah)
|
|
|
|
else()
|
|
|
|
set(JAVAC javac)
|
|
|
|
set(JAVAH javah)
|
|
|
|
endif()
|
|
|
|
|
2017-07-12 21:04:55 +02:00
|
|
|
execute_process(COMMAND ${JAVAC} ${JAVAC_ARGS} -cp ${JAVA_TESTCLASSPATH} -d ${PROJECT_SOURCE_DIR}/java/classes ${PROJECT_SOURCE_DIR}/java/src/main/java/org/rocksdb/util/*.java ${PROJECT_SOURCE_DIR}/java/src/main/java/org/rocksdb/*.java ${PROJECT_SOURCE_DIR}/java/src/test/java/org/rocksdb/*.java)
|
2016-07-27 01:18:49 +02:00
|
|
|
execute_process(COMMAND ${JAVAH} -cp ${PROJECT_SOURCE_DIR}/java/classes -d ${PROJECT_SOURCE_DIR}/java/include -jni ${NATIVE_JAVA_CLASSES})
|
2016-01-28 15:44:31 +01:00
|
|
|
add_library(rocksdbjni${ARTIFACT_SUFFIX} SHARED ${JNI_NATIVE_SOURCES})
|
|
|
|
set_target_properties(rocksdbjni${ARTIFACT_SUFFIX} PROPERTIES COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/rocksdbjni${ARTIFACT_SUFFIX}.pdb")
|
2017-05-15 21:27:46 +02:00
|
|
|
target_link_libraries(rocksdbjni${ARTIFACT_SUFFIX} rocksdb${ARTIFACT_SUFFIX} ${LIBS})
|