-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[portmidi] Add non-Windows support, refactory install process #19710
Merged
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6c59dc4
[portmidi] Add *inx support, refactory install process
c2dfe41
update support
b2c1c0a
version
b9e8a62
Re-fix dynamic build and use
3597a2f
version
fb961a3
Fix build on *inx
3313a9f
version
9f29626
Re-fix installation
4ad76aa
version
2e49565
Add MAYBE_UNUSED_VARIABLES
d68cadb
version
c787acd
Merge remote-tracking branch 'origin/master' into HEAD
BillyONeal 2dbe907
Change macro judgment value and macro value
96316a0
version stuff
ff5414b
Merge branch 'dev/jack/19694' of https://github.com/JackBoosY/vcpkg i…
9905394
Update versions/p-/portmidi.json
JackBoosY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/portmidi/trunk/CMakeLists.txt b/portmidi/trunk/CMakeLists.txt | ||
index 4919b78..d387a26 100644 | ||
--- a/portmidi/trunk/CMakeLists.txt | ||
+++ b/portmidi/trunk/CMakeLists.txt | ||
@@ -68,10 +68,14 @@ endif(UNIX) | ||
include_directories(pm_common porttime) | ||
add_subdirectory(pm_common) | ||
|
||
+if (0) | ||
add_subdirectory(pm_test) | ||
+endif() | ||
|
||
add_subdirectory(pm_dylib) | ||
|
||
# Cannot figure out how to make an xcode Java application with CMake | ||
+if (JAVA_SUPPORT) | ||
add_subdirectory(pm_java) | ||
+endif() | ||
|
||
diff --git a/portmidi/trunk/pm_common/CMakeLists.txt b/portmidi/trunk/pm_common/CMakeLists.txt | ||
index 01866e3..915cf9f 100644 | ||
--- a/portmidi/trunk/pm_common/CMakeLists.txt | ||
+++ b/portmidi/trunk/pm_common/CMakeLists.txt | ||
@@ -113,17 +113,25 @@ target_link_libraries(portmidi-static ${PM_NEEDED_LIBS}) | ||
# define the jni library | ||
include_directories(${JAVA_INCLUDE_PATHS}) | ||
|
||
+if (JAVA_SUPPORT) | ||
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() | ||
|
||
# install the libraries (Linux and Mac OS X command line) | ||
if(1) | ||
- INSTALL(TARGETS portmidi-static pmjni | ||
+ INSTALL(TARGETS portmidi-static | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
+ if (JAVA_SUPPORT) | ||
+ INSTALL(TARGETS pmjni | ||
+ RUNTIME DESTINATION bin | ||
+ LIBRARY DESTINATION lib | ||
+ ARCHIVE DESTINATION lib) | ||
+ endif() | ||
# .h files installed by pm_dylib/CMakeLists.txt, so don't need them here | ||
INSTALL(FILES portmidi.h ../porttime/porttime.h | ||
DESTINATION include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
diff --git a/portmidi/trunk/pm_common/CMakeLists.txt b/portmidi/trunk/pm_common/CMakeLists.txt | ||
index cbeeade..01866e3 100644 | ||
--- a/portmidi/trunk/pm_common/CMakeLists.txt | ||
+++ b/portmidi/trunk/pm_common/CMakeLists.txt | ||
@@ -104,8 +104,9 @@ set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY}) | ||
# this completes the list of library sources by adding shared code | ||
list(APPEND LIBSRC pmutil portmidi) | ||
|
||
+if (NOT BUILD_SHARED_LIBS) | ||
# now add the shared files to make the complete list of library sources | ||
-add_library(portmidi-static ${LIBSRC}) | ||
+add_library(portmidi-static STATIC ${LIBSRC}) | ||
set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi_s") | ||
target_link_libraries(portmidi-static ${PM_NEEDED_LIBS}) | ||
|
||
@@ -118,11 +119,13 @@ target_link_libraries(pmjni ${JNI_EXTRA_LIBS}) | ||
set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib") | ||
|
||
# install the libraries (Linux and Mac OS X command line) | ||
-if(UNIX) | ||
+if(1) | ||
INSTALL(TARGETS portmidi-static pmjni | ||
- LIBRARY DESTINATION /usr/local/lib | ||
- ARCHIVE DESTINATION /usr/local/lib) | ||
+ RUNTIME DESTINATION bin | ||
+ LIBRARY DESTINATION lib | ||
+ ARCHIVE DESTINATION lib) | ||
# .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) | ||
-endif(UNIX) | ||
+ INSTALL(FILES portmidi.h ../porttime/porttime.h | ||
+ DESTINATION include) | ||
+endif(1) | ||
+endif() | ||
diff --git a/portmidi/trunk/pm_common/portmidi.h b/portmidi/trunk/pm_common/portmidi.h | ||
index e07991e..aee6985 100644 | ||
--- a/portmidi/trunk/pm_common/portmidi.h | ||
+++ b/portmidi/trunk/pm_common/portmidi.h | ||
@@ -109,7 +109,7 @@ typedef unsigned int uint32_t; | ||
#ifdef _WINDLL | ||
#define PMEXPORT __declspec(dllexport) | ||
#else | ||
-#define PMEXPORT | ||
+#define PMEXPORT __declspec(dllimport) | ||
#endif | ||
|
||
#ifndef FALSE | ||
diff --git a/portmidi/trunk/pm_dylib/CMakeLists.txt b/portmidi/trunk/pm_dylib/CMakeLists.txt | ||
index f693dd6..f2994d1 100644 | ||
--- a/portmidi/trunk/pm_dylib/CMakeLists.txt | ||
+++ b/portmidi/trunk/pm_dylib/CMakeLists.txt | ||
@@ -113,15 +113,21 @@ set(SHARED_FILES pmutil portmidi) | ||
prepend_path(SHARED_PATHS ../pm_common/ ${SHARED_FILES}) | ||
list(APPEND LIBSRC ${SHARED_PATHS}) | ||
|
||
+if (BUILD_SHARED_LIBS) | ||
add_library(portmidi-dynamic SHARED ${LIBSRC}) | ||
set_target_properties(portmidi-dynamic PROPERTIES OUTPUT_NAME "portmidi") | ||
target_link_libraries(portmidi-dynamic ${PM_NEEDED_LIBS}) | ||
+if (MSVC) | ||
+ target_compile_definitions(portmidi-dynamic PRIVATE _WINDLL) | ||
+endif() | ||
|
||
# install the libraries (Linux and Mac OS X command line) | ||
-if(UNIX) | ||
+if(1) | ||
INSTALL(TARGETS portmidi-dynamic | ||
- LIBRARY DESTINATION /usr/local/lib | ||
- ARCHIVE DESTINATION /usr/local/lib) | ||
+ RUNTIME DESTINATION bin | ||
+ LIBRARY DESTINATION lib | ||
+ ARCHIVE DESTINATION lib) | ||
INSTALL(FILES ../pm_common/portmidi.h ../porttime/porttime.h | ||
- DESTINATION /usr/local/include) | ||
-endif(UNIX) | ||
+ DESTINATION include) | ||
+endif(1) | ||
+endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,26 @@ | ||
vcpkg_fail_port_install(ON_TARGET "linux" "osx" "uwp" ON_ARCH "arm") | ||
vcpkg_fail_port_install(ON_TARGET "uwp" ON_ARCH "arm") | ||
|
||
vcpkg_from_sourceforge( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO portmedia | ||
FILENAME "portmedia-code-r234.zip" | ||
SHA512 cbc332d89bc465450b38245a83cc300dfd2e1e6de7c62284edf754ff4d8a9aa3dc49a395dcee535ed9688befb019186fa87fd6d8a3698898c2acbf3e6b7a0794 | ||
PATCHES | ||
fix-build-install.patch | ||
add-feature-options.patch | ||
) | ||
|
||
# Alter path to main portmidi root | ||
set(SOURCE_PATH "${SOURCE_PATH}/portmidi/trunk") | ||
|
||
# Mark portmidi-static as static, disable pmjni library depending on the Java SDK | ||
|
||
file(READ "${SOURCE_PATH}/pm_common/CMakeLists.txt" PM_CMAKE) | ||
string(REPLACE "add_library(portmidi-static \${LIBSRC})" "add_library(portmidi-static STATIC \${LIBSRC})" PM_CMAKE "${PM_CMAKE}") | ||
string(REPLACE "add_library(pmjni SHARED \${JNISRC})" "# Removed pmjni" PM_CMAKE "${PM_CMAKE}") | ||
string(REPLACE "target_link_libraries(pmjni \${JNI_EXTRA_LIBS})" "# Removed pmjni" PM_CMAKE "${PM_CMAKE}") | ||
string(REPLACE "set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION \"jnilib\")" "# Removed pmjni" PM_CMAKE "${PM_CMAKE}") | ||
file(WRITE "${SOURCE_PATH}/pm_common/CMakeLists.txt" "${PM_CMAKE}") | ||
|
||
# Run cmake configure step | ||
vcpkg_configure_cmake( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}/portmidi/trunk" | ||
OPTIONS | ||
-DJAVA_SUPPORT=OFF | ||
-DJAVA_INCLUDE_PATH= | ||
-DJAVA_INCLUDE_PATH2= | ||
-DJAVA_JVM_LIBRARY= | ||
) | ||
|
||
# Run cmake build step, nothing is installed on Windows | ||
vcpkg_build_cmake() | ||
|
||
file(INSTALL ${SOURCE_PATH}/pm_common/portmidi.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) | ||
file(INSTALL ${SOURCE_PATH}/porttime/porttime.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) | ||
vcpkg_cmake_install() | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/portmidi_s.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) | ||
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/portmidi_s.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) | ||
else() | ||
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/portmidi.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) | ||
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/portmidi.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) | ||
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/portmidi.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) | ||
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/portmidi.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) | ||
endif() | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
|
||
file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/portmidi RENAME copyright) | ||
file(INSTALL "${SOURCE_PATH}/portmidi/trunk/license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "portmidi", | ||
"version-string": "0.234", | ||
"port-version": 1, | ||
"description": "Free, cross-platform, open-source I/O library for MIDI", | ||
"homepage": "https://sourceforge.net/projects/portmedia/", | ||
"supports": "!(uwp | arm)", | ||
"dependencies": [ | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This target
pmjni
requires java executable on local machine, so I disabled it.In source/portmidi/trunk/pm_java/CMakeLists.txt: