Skip to content

Commit

Permalink
Change paths and CMakeLists details so pmdefaults works on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbdannenberg committed Dec 21, 2021
1 parent 14b6fbb commit d05eb81
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,23 @@ cmake_install.cmake
/portmidi.sln
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.vcxproj.user
/Makefile
/libpmjni.so
/pm_common/Makefile
/pm_common/libportmidi-static.a
/pm_java/Makefile
/pm_test/Makefile
/pm_test/fastrcv
/pm_test/latency
/pm_test/midiclock
/pm_test/midithread
/pm_test/midithru
/pm_test/mm
/pm_test/multivirtual
/pm_test/qtest
/pm_test/recvvirtual
/pm_test/sendvirtual
/pm_test/sysex
/pm_test/testio
/pm_test/virttest
22 changes: 17 additions & 5 deletions pm_java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ if(BUILD_PMDEFAULTS)

project(pmdefaults NONE)
include(UseJava)
add_jar(pmdefaults

if(UNIX)
# There seems to be a bug in CMake - Linux complains if NAMESPACE is
# missing, but Windows does not make a working VS solution if NAMESPACE
# is present, so this "add_jar" call is almost duplicated: here for
# Linux/macOS and below for Windows...
add_jar(pmdefaults
SOURCES pmdefaults/PmDefaults.java pmdefaults/PmDefaultsFrame.java
jportmidi/JPortMidi.java jportmidi/JPortMidiApi.java
jportmidi/JPortMidiException.java
# NAMESPACE did not seem to work on Windows - omitting it may
# cause out-of-source-tree builds to fail:
RESOURCES pmdefaults/portmusic_logo.png
RESOURCES NAMESPACE "." pmdefaults/portmusic_logo.png
MANIFEST pmdefaults/manifest.txt
OUTPUT_DIR pmdefaults)
if(UNIX)
if(BUILD_JAVA_NATIVE_INTERFACE)
include(FindJNI)
# message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
Expand Down Expand Up @@ -67,6 +70,15 @@ if(BUILD_PMDEFAULTS)
endif(APPLE)
else(UNIX)
if(WIN32)
add_jar(pmdefaults
SOURCES pmdefaults/PmDefaults.java pmdefaults/PmDefaultsFrame.java
jportmidi/JPortMidi.java jportmidi/JPortMidiApi.java
jportmidi/JPortMidiException.java
# NAMESPACE did not seem to work on Windows - omitting it may
# cause out-of-source-tree builds to fail:
RESOURCES pmdefaults/portmusic_logo.png
MANIFEST pmdefaults/manifest.txt
OUTPUT_DIR pmdefaults)
if(BUILD_JAVA_NATIVE_INTERFACE)
include(FindJNI)
# note: should use JAVA_JVM_LIB_PATH, but it is not set properly
Expand Down
9 changes: 8 additions & 1 deletion pm_java/pmdefaults/pmdefaults
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
java -Djava.library.path=../../Release:../../Debug -jar pmdefaults.jar > /dev/null
#!/bin/sh
# Run PmDefaults, the GUI to select default MIDI input and output for PortMidi
# Due to the locations of the .jar file and libpmjni, this script only runs
# from <portmidi-repo-path>/pm_java/pmdefaults. PmDefaults is minimally
# supported -- if you would like it to appear as an app on your desktop,
# contact the developer(s) and let us know it's actually being used.
# library path here includes directory locations for macOS and Linux.
java -Djava.library.path=../../Release:../../Debug:../.. -jar pmdefaults.jar > /dev/null

0 comments on commit d05eb81

Please sign in to comment.