You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mnemonic.apache.org by yz...@apache.org on 2022/09/09 03:03:28 UTC

[mnemonic] branch master updated: MNEMONIC-763: Add CMakefile to memkind memory service for the compilation of native code

This is an automated email from the ASF dual-hosted git repository.

yzhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mnemonic.git


The following commit(s) were added to refs/heads/master by this push:
     new 40dd64d  MNEMONIC-763: Add CMakefile to memkind memory service for the compilation of native code
40dd64d is described below

commit 40dd64d5f114b399422bc59ab79134474f962691
Author: Xiaojin Jiao <xj...@apache.org>
AuthorDate: Mon Sep 5 12:11:41 2022 -0700

    MNEMONIC-763: Add CMakefile to memkind memory service for the compilation of native code
    
    Signed-off-by: Xiaojin Jiao <xj...@apache.org>
---
 .../src/main/native/CMakeLists.txt                 | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/native/CMakeLists.txt b/mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/native/CMakeLists.txt
new file mode 100644
index 0000000..a33fc5c
--- /dev/null
+++ b/mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/native/CMakeLists.txt
@@ -0,0 +1,55 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cmake_minimum_required(VERSION 3.12)
+project(vmemkindallocator)
+
+configure_file (
+  "${PROJECT_SOURCE_DIR}/config.h.in"
+    "${PROJECT_BINARY_DIR}/config.h"
+    )
+include_directories(${PROJECT_BINARY_DIR})
+
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../dist/native")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
+set(vmemkindallocator_VERSION_MAJOR 0)
+set(vmemkindallocator_VERSION_MINOR 0)
+set(CMAKE_BUILD_TYPE "Release")
+set(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -O0 -Wall -rdynamic -g -ggdb")
+set(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -O3 -Wall")
+
+find_package(JNI REQUIRED)
+include_directories(${JNI_INCLUDE_DIRS})
+
+find_package(Threads REQUIRED)
+include_directories(${CMAKE_THREAD_LIBS_INIT})
+
+find_library(LIBVMEMKIND_LIBRARIES NAMES libmemkind.a libvmemkind.so)
+if (NOT LIBVMEMKIND_LIBRARIES)
+   message(FATAL_ERROR "not found memkind library")
+endif (NOT LIBVMEMKIND_LIBRARIES)
+
+add_library(vmemkindallocator SHARED common.c org_apache_mnemonic_service_memory_internal_VMemServiceImpl.c)
+target_include_directories(vmemkindallocator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+target_link_libraries(vmemkindallocator ${LIBVMEMKIND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+
+include (InstallRequiredSystemLibraries)
+set (CPACK_RESOURCE_FILE_LICENSE
+  "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+set (CPACK_PACKAGE_VERSION_MAJOR "${vmemkindallocator_VERSION_MAJOR}")
+set (CPACK_PACKAGE_VERSION_MINOR "${vmemkindallocator_VERSION_MINOR}")
+include (CPack)