Skip to content

Commit

Permalink
add check for universal-ness
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Mühleisen committed Apr 29, 2024
1 parent 43025c3 commit f45dd3e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/Java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ jobs:
if: ${{ inputs.skip_tests != 'true' }}
shell: bash
run: make test
- name: See if this actually universal
shell: bash
run: lipo -archs build/release/libduckdb_java.so_osx_universal | grep "x86_64 arm64"
- name: Deploy
shell: bash
env:
Expand Down
23 changes: 13 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ set(DUCKDB_SRC_FILES src/duckdb/ub_src_catalog.cpp src/duckdb/ub_src_catalog_cat

set(CMAKE_JAVA_COMPILE_FLAGS -source 1.8 -target 1.8 -encoding utf-8)

add_definitions(-DDUCKDB_BUILD_LIBRARY)

if(MSVC)
add_definitions(/bigobj)
else()
Expand All @@ -36,16 +38,6 @@ else()
endif()


add_jar(duckdb_jdbc ${JAVA_SRC_FILES} META-INF/services/java.sql.Driver
GENERATE_NATIVE_HEADERS duckdb-native)
add_jar(duckdb_jdbc_tests ${JAVA_TEST_FILES} INCLUDE_JARS duckdb_jdbc)

add_library(duckdb_java SHARED src/jni/duckdb_java.cpp src/jni/functions.cpp ${DUCKDB_SRC_FILES})
target_compile_options(duckdb_java PRIVATE -fexceptions)
target_link_libraries(duckdb_java duckdb-native )



set(OS_NAME "unknown")
set(OS_ARCH "amd64")

Expand All @@ -59,6 +51,7 @@ endif()
if(APPLE)
set(OS_NAME "osx")
set(OS_ARCH "universal")
SET(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build architectures for Mac OS X" FORCE)
endif()
if(WIN32)
set(OS_NAME "windows")
Expand All @@ -71,6 +64,16 @@ if(OVERRIDE_JDBC_OS_ARCH)
set(OS_ARCH ${OVERRIDE_JDBC_OS_ARCH})
endif()


add_jar(duckdb_jdbc ${JAVA_SRC_FILES} META-INF/services/java.sql.Driver
GENERATE_NATIVE_HEADERS duckdb-native)
add_jar(duckdb_jdbc_tests ${JAVA_TEST_FILES} INCLUDE_JARS duckdb_jdbc)

add_library(duckdb_java SHARED src/jni/duckdb_java.cpp src/jni/functions.cpp ${DUCKDB_SRC_FILES})
target_compile_options(duckdb_java PRIVATE -fexceptions)
target_link_libraries(duckdb_java duckdb-native )


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")
Expand Down
24 changes: 12 additions & 12 deletions CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ set(DUCKDB_SRC_FILES ${SOURCE_FILES})

set(CMAKE_JAVA_COMPILE_FLAGS -source 1.8 -target 1.8 -encoding utf-8)

add_definitions(-DDUCKDB_BUILD_LIBRARY)

if(MSVC)
add_definitions(/bigobj)
else()
Expand All @@ -36,16 +38,6 @@ else()
endif()


add_jar(duckdb_jdbc ${JAVA_SRC_FILES} META-INF/services/java.sql.Driver
GENERATE_NATIVE_HEADERS duckdb-native)
add_jar(duckdb_jdbc_tests ${JAVA_TEST_FILES} INCLUDE_JARS duckdb_jdbc)

add_library(duckdb_java SHARED src/jni/duckdb_java.cpp src/jni/functions.cpp ${DUCKDB_SRC_FILES})
target_compile_options(duckdb_java PRIVATE -fexceptions)
target_link_libraries(duckdb_java duckdb-native ${LIBRARY_FILES})



set(OS_NAME "unknown")
set(OS_ARCH "amd64")

Expand All @@ -58,7 +50,8 @@ endif()

if(APPLE)
set(OS_NAME "osx")
set(OS_ARCH "universal")
set(OS_ARCH "universal")
SET(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build architectures for Mac OS X" FORCE)
endif()
if(WIN32)
set(OS_NAME "windows")
Expand All @@ -71,11 +64,18 @@ if(OVERRIDE_JDBC_OS_ARCH)
set(OS_ARCH ${OVERRIDE_JDBC_OS_ARCH})
endif()

add_jar(duckdb_jdbc ${JAVA_SRC_FILES} META-INF/services/java.sql.Driver
GENERATE_NATIVE_HEADERS duckdb-native)
add_jar(duckdb_jdbc_tests ${JAVA_TEST_FILES} INCLUDE_JARS duckdb_jdbc)

add_library(duckdb_java SHARED src/jni/duckdb_java.cpp src/jni/functions.cpp ${DUCKDB_SRC_FILES})
target_compile_options(duckdb_java PRIVATE -fexceptions)
target_link_libraries(duckdb_java duckdb-native ${LIBRARY_FILES})

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")


add_custom_command(
OUTPUT dummy_jdbc_target
DEPENDS duckdb_java duckdb_jdbc duckdb_jdbc_tests
Expand Down

0 comments on commit f45dd3e

Please sign in to comment.