212 lines
8.2 KiB
Diff
212 lines
8.2 KiB
Diff
--- CMakeLists.txt.old 2010-08-03 21:46:45.000000000 +0100
|
|
+++ CMakeLists.txt 2010-08-03 21:50:17.000000000 +0100
|
|
@@ -65,6 +65,8 @@
|
|
endif(CMAKE_LIBRARY_OUTPUT_DIRECTORY MATCHES ${BAD_DIR})
|
|
endif(UNIX)
|
|
|
|
+option(PORTMIDI_ENABLE_JAVA "Enable Java bindings support" ON)
|
|
+
|
|
include_directories(pm_common porttime)
|
|
add_subdirectory(pm_common)
|
|
|
|
@@ -73,5 +77,9 @@
|
|
add_subdirectory(pm_dylib)
|
|
|
|
# Cannot figure out how to make an xcode Java application with CMake
|
|
-add_subdirectory(pm_java)
|
|
+if(PORTMIDI_ENABLE_JAVA)
|
|
+ set(JAR_INSTALL_DIR share/java
|
|
+ CACHE STRING "Define directory name for jar installation")
|
|
+ add_subdirectory(pm_java)
|
|
+endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
--- pm_common/CMakeLists.txt.old 2010-10-01 13:33:52.000000000 +0100
|
|
+++ pm_common/CMakeLists.txt 2010-10-01 14:02:55.000000000 +0100
|
|
@@ -62,19 +62,23 @@
|
|
${COREMIDI_LIB} ${CORESERVICES_LIB}
|
|
CACHE INTERNAL "")
|
|
|
|
- set(JAVAVM_LIB "${FRAMEWORK_PATH}/JavaVM.framework")
|
|
- set(JAVA_INCLUDE_PATHS ${JAVAVM_LIB}/Headers)
|
|
+ if(PORTMIDI_ENABLE_JAVA)
|
|
+ set(JAVAVM_LIB "${FRAMEWORK_PATH}/JavaVM.framework")
|
|
+ set(JAVA_INCLUDE_PATHS ${JAVAVM_LIB}/Headers)
|
|
+ endif(PORTMIDI_ENABLE_JAVA)
|
|
message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT})
|
|
else(APPLE)
|
|
# LINUX settings...
|
|
- include(FindJNI)
|
|
- message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
|
|
- message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
|
|
- message(STATUS "JAVA_INCLUDE_PATH2 is " ${JAVA_INCLUDE_PATH2})
|
|
- message(STATUS "JAVA_JVM_LIBRARY is " ${JAVA_JVM_LIBRARY})
|
|
- set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
- # libjvm.so is found relative to JAVA_INCLUDE_PATH:
|
|
- set(JAVAVM_LIB ${JAVA_JVM_LIBRARY}/libjvm.so)
|
|
+ if(PORTMIDI_ENABLE_JAVA)
|
|
+ include(FindJNI)
|
|
+ message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
|
|
+ message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
|
|
+ message(STATUS "JAVA_INCLUDE_PATH2 is " ${JAVA_INCLUDE_PATH2})
|
|
+ message(STATUS "JAVA_JVM_LIBRARY is " ${JAVA_JVM_LIBRARY})
|
|
+ set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
+ # libjvm.so is found relative to JAVA_INCLUDE_PATH:
|
|
+ set(JAVAVM_LIB ${JAVA_JVM_LIBRARY}/libjvm.so)
|
|
+ endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
set(LINUXSRC pmlinuxalsa pmlinux finddefault)
|
|
prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
|
|
@@ -88,10 +92,12 @@
|
|
# /MD is multithread DLL, /MT is multithread. Change to static:
|
|
include(../pm_win/static.cmake)
|
|
|
|
- include(FindJNI)
|
|
+ if(PORTMIDI_ENABLE_JAVA)
|
|
+ include(FindJNI)
|
|
|
|
- set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
- # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
|
|
+ set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
+ # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
|
|
+ endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
set(WINSRC pmwin pmwinmm)
|
|
prepend_path(LIBSRC ../pm_win/ ${WINSRC})
|
|
@@ -99,29 +105,39 @@
|
|
set(PM_NEEDED_LIBS winmm.lib)
|
|
endif(WIN32)
|
|
endif(UNIX)
|
|
-set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
|
|
+
|
|
+if(PORTMIDI_ENABLE_JAVA)
|
|
+ set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
|
|
+endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
# this completes the list of library sources by adding shared code
|
|
list(APPEND LIBSRC pmutil portmidi)
|
|
|
|
# now add the shared files to make the complete list of library sources
|
|
add_library(portmidi-static ${LIBSRC})
|
|
-set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi_s")
|
|
+set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi")
|
|
target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})
|
|
|
|
-# define the jni library
|
|
-include_directories(${JAVA_INCLUDE_PATHS})
|
|
-
|
|
-set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
|
|
-add_library(pmjni SHARED ${JNISRC})
|
|
-target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
|
|
-set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
|
|
+if(PORTMIDI_ENABLE_JAVA)
|
|
+ # define the jni library
|
|
+ include_directories(${JAVA_INCLUDE_PATHS})
|
|
+
|
|
+ set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
|
|
+ add_library(pmjni SHARED ${JNISRC})
|
|
+ target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
|
|
+ set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
|
|
+endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
# install the libraries (Linux and Mac OS X command line)
|
|
if(UNIX)
|
|
- INSTALL(TARGETS portmidi-static pmjni
|
|
- LIBRARY DESTINATION /usr/local/lib
|
|
- ARCHIVE DESTINATION /usr/local/lib)
|
|
+ INSTALL(TARGETS portmidi-static
|
|
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
|
|
+ ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
|
+ if(PORTMIDI_ENABLE_JAVA)
|
|
+ INSTALL(TARGETS pmjni
|
|
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
|
|
+ ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
|
+ endif(PORTMIDI_ENABLE_JAVA)
|
|
# .h files installed by pm_dylib/CMakeLists.txt, so don't need them here
|
|
# INSTALL(FILES portmidi.h ../porttime/porttime.h
|
|
# DESTINATION /usr/local/include)
|
|
--- pm_dylib/CMakeLists.txt 2010-10-01 13:33:56.000000000 +0100
|
|
+++ pm_dylib/CMakeLists.txt 2010-10-11 15:13:47.000000000 +0100
|
|
@@ -63,7 +63,8 @@
|
|
message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT})
|
|
else(APPLE)
|
|
# LINUX settings...
|
|
- include(FindJNI)
|
|
+ if(PORTMIDI_ENABLE_JAVA)
|
|
+ include(FindJNI)
|
|
# message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
|
|
# message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
|
|
# note: should use JAVA_JVM_LIB_PATH, but it is not set properly
|
|
@@ -75,11 +76,8 @@
|
|
# JAVA_INCLUDE_PATH2; if no, then we need to make both JAVA_INCLUDE_PATH
|
|
# and JAVA_INCLUDE_PATH2 set by user (will need clear documentation
|
|
# because JAVA_INCLUDE_PATH2 is pretty obscure)
|
|
- set(JAVA_INCLUDE_PATH ${JAVA_INCLUDE_PATH-UNKNOWN}
|
|
- CACHE STRING "where to find Java SDK include directory")
|
|
- set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/linux)
|
|
- # libjvm.so is found relative to JAVA_INCLUDE_PATH:
|
|
- set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../jre/lib/i386/client/libjvm.so)
|
|
+ set(JAVAVM_LIB ${JAVA_JVM_LIBRARY})
|
|
+ endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
set(LINUXSRC pmlinuxalsa pmlinux finddefault)
|
|
prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
|
|
@@ -91,13 +89,15 @@
|
|
if(WIN32)
|
|
# /MDd is multithread debug DLL, /MTd is multithread debug
|
|
# /MD is multithread DLL, /MT is multithread
|
|
-
|
|
- include(FindJNI)
|
|
- # note: should use JAVA_JVM_LIB_PATH, but it is not set properly
|
|
- set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../lib/jvm.lib)
|
|
|
|
- set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
- # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
|
|
+ if(PORTMIDI_ENABLE_JAVA)
|
|
+ include(FindJNI)
|
|
+ # note: should use JAVA_JVM_LIB_PATH, but it is not set properly
|
|
+ set(JAVAVM_LIB ${JAVA_INCLUDE_PATH}/../lib/jvm.lib)
|
|
+
|
|
+ set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
+ # message(STATUS "JAVA_INCLUDE_PATHS: " ${JAVA_INCLUDE_PATHS})
|
|
+ endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
set(WINSRC pmwin pmwinmm)
|
|
prepend_path(LIBSRC ../pm_win/ ${WINSRC})
|
|
@@ -106,7 +106,10 @@
|
|
# message(STATUS "JAVAVM_LIB: " ${JAVAVM_LIB})
|
|
endif(WIN32)
|
|
endif(UNIX)
|
|
+
|
|
+if(PORTMIDI_ENABLE_JAVA)
|
|
set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVAVM_LIB})
|
|
+endif(PORTMIDI_ENABLE_JAVA)
|
|
|
|
# this completes the list of library sources by adding shared code
|
|
set(SHARED_FILES pmutil portmidi)
|
|
@@ -120,8 +123,8 @@
|
|
# install the libraries (Linux and Mac OS X command line)
|
|
if(UNIX)
|
|
INSTALL(TARGETS portmidi-dynamic
|
|
- LIBRARY DESTINATION /usr/local/lib
|
|
- ARCHIVE DESTINATION /usr/local/lib)
|
|
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
|
|
+ ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
|
INSTALL(FILES ../pm_common/portmidi.h ../porttime/porttime.h
|
|
- DESTINATION /usr/local/include)
|
|
+ DESTINATION include)
|
|
endif(UNIX)
|
|
--- pm_java/CMakeLists.txt.old 2010-08-03 21:47:24.000000000 +0100
|
|
+++ pm_java/CMakeLists.txt 2010-08-03 22:03:54.000000000 +0100
|
|
@@ -39,9 +39,9 @@
|
|
|
|
# install the libraries (Linux only)
|
|
INSTALL(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults.jar
|
|
- DESTINATION /usr/share/java)
|
|
+ DESTINATION ${JAR_INSTALL_DIR})
|
|
INSTALL(PROGRAMS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pmdefaults
|
|
- DESTINATION /usr/local/bin)
|
|
+ DESTINATION bin)
|
|
endif(APPLE)
|
|
endif(UNIX)
|
|
# In windows, use pm_java/make.bat
|