From ae3c06568418098268041527c65da8391cb540ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20M=C3=BChleisen?= Date: Mon, 29 Apr 2024 14:38:56 +0200 Subject: [PATCH] arch --- .gitignore | 4 +++- CMakeLists.txt | 29 ++++++++++++++++++++++++----- CMakeLists.txt.in | 29 ++++++++++++++++++++++++----- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index c795b054..28bb9dc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -build \ No newline at end of file +build +.idea +cmake-build-debug \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a0da2b..6779e7e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,13 +37,32 @@ add_library(duckdb_java SHARED src/jni/duckdb_java.cpp src/jni/functions.cpp ${D target_compile_options(duckdb_java PRIVATE -fexceptions) target_link_libraries(duckdb_java duckdb-native ) + + +set(OS_NAME "unknown") +set(OS_ARCH "amd64") + +string(REGEX MATCH "(arm64|aarch64)" IS_ARM "${CMAKE_SYSTEM_PROCESSOR}") +if(IS_ARM) + set(OS_ARCH "arm64") +elseif(FORCE_32_BIT) + set(OS_ARCH "i386") +endif() + if(APPLE) - set(OS_NAME osx) - set(OS_ARCH universal) + set(OS_NAME "osx") endif() -#if(OVERRIDE_JDBC_OS_ARCH) -# set(OS_ARCH ${OVERRIDE_JDBC_OS_ARCH}) -#endif() +if(WIN32) + set(OS_NAME "windows") +endif() +if(UNIX AND NOT APPLE) + set(OS_NAME "linux") # sorry BSD +endif() + +if(OVERRIDE_JDBC_OS_ARCH) + set(OS_ARCH ${OVERRIDE_JDBC_OS_ARCH}) +endif() + string(JOIN "_" LIB_SUFFIX ".so" ${OS_NAME} ${OS_ARCH}) set_target_properties(duckdb_java PROPERTIES SUFFIX ${LIB_SUFFIX}) set_target_properties(duckdb_java PROPERTIES PREFIX "lib") diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in index 01fbb0a8..ae2f58a6 100644 --- a/CMakeLists.txt.in +++ b/CMakeLists.txt.in @@ -37,13 +37,32 @@ add_library(duckdb_java SHARED src/jni/duckdb_java.cpp src/jni/functions.cpp ${D target_compile_options(duckdb_java PRIVATE -fexceptions) target_link_libraries(duckdb_java duckdb-native ${LIBRARY_FILES}) + + +set(OS_NAME "unknown") +set(OS_ARCH "amd64") + +string(REGEX MATCH "(arm64|aarch64)" IS_ARM "${CMAKE_SYSTEM_PROCESSOR}") +if(IS_ARM) + set(OS_ARCH "arm64") +elseif(FORCE_32_BIT) + set(OS_ARCH "i386") +endif() + if(APPLE) - set(OS_NAME osx) - set(OS_ARCH universal) + set(OS_NAME "osx") endif() -#if(OVERRIDE_JDBC_OS_ARCH) -# set(OS_ARCH ${OVERRIDE_JDBC_OS_ARCH}) -#endif() +if(WIN32) + set(OS_NAME "windows") +endif() +if(UNIX AND NOT APPLE) + set(OS_NAME "linux") # sorry BSD +endif() + +if(OVERRIDE_JDBC_OS_ARCH) + set(OS_ARCH ${OVERRIDE_JDBC_OS_ARCH}) +endif() + string(JOIN "_" LIB_SUFFIX ".so" ${OS_NAME} ${OS_ARCH}) set_target_properties(duckdb_java PROPERTIES SUFFIX ${LIB_SUFFIX}) set_target_properties(duckdb_java PROPERTIES PREFIX "lib")