build script: add portmidi target

This commit is contained in:
alexey.lysiuk 2020-12-21 11:47:13 +02:00
parent e90852ca2d
commit b356e8ca44
2 changed files with 86 additions and 0 deletions

View file

@ -1131,6 +1131,32 @@ class PngTarget(ConfigureMakeStaticDependencyTarget):
Target.update_prefix_shell_script(builder.prefix_path + '/bin/libpng16-config')
class PortMidiTarget(CMakeTarget):
def __init__(self, name='portmidi'):
super().__init__(name)
def prepare_source(self, builder: 'Builder'):
builder.download_source(
'https://downloads.sourceforge.net/project/portmedia/portmidi/217/portmidi-src-217.zip',
'08e9a892bd80bdb1115213fb72dc29a7bf2ff108b378180586aa65f3cfd42e0f')
def detect(self, builder: 'Builder') -> bool:
return os.path.exists(builder.source_path + 'pm_common/portmidi.h')
def post_build(self, builder: 'Builder'):
if os.path.exists(self.prefix):
shutil.rmtree(self.prefix)
include_path = self.prefix + os.sep + 'include'
os.makedirs(include_path)
shutil.copy(builder.source_path + 'pm_common/portmidi.h', include_path)
shutil.copy(builder.source_path + 'porttime/porttime.h', include_path)
lib_path = self.prefix + os.sep + 'lib' + os.sep
os.makedirs(lib_path)
shutil.copy(builder.build_path + 'libportmidi_s.a', lib_path + 'libportmidi.a')
class SamplerateTarget(ConfigureMakeStaticDependencyTarget):
def __init__(self, name='samplerate'):
super().__init__(name)
@ -1662,6 +1688,7 @@ class Builder(object):
PcreTarget(),
PkgConfigTarget(),
PngTarget(),
PortMidiTarget(),
SamplerateTarget(),
Sdl2Target(),
Sdl2ImageTarget(),

59
patch/portmidi.patch Normal file
View file

@ -0,0 +1,59 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,8 +36,6 @@
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused")
-set(CMAKE_OSX_ARCHITECTURES i386 ppc x86_64 CACHE STRING "change to needed architecture for a smaller library" FORCE)
-
PROJECT(portmidi)
if(UNIX)
@@ -68,10 +66,3 @@
include_directories(pm_common porttime)
add_subdirectory(pm_common)
-add_subdirectory(pm_test)
-
-add_subdirectory(pm_dylib)
-
-# Cannot figure out how to make an xcode Java application with CMake
-add_subdirectory(pm_java)
-
--- a/pm_common/CMakeLists.txt
+++ b/pm_common/CMakeLists.txt
@@ -21,13 +21,6 @@
set(LINUX_FLAGS "-DPMALSA")
endif(APPLE OR WIN32)
-if(APPLE)
- set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk CACHE
- PATH "-isysroot parameter for compiler" FORCE)
- set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5" CACHE
- STRING "needed in conjunction with CMAKE_OSX_SYSROOT" FORCE)
-endif(APPLE)
-
macro(prepend_path RESULT PATH)
set(${RESULT})
foreach(FILE ${ARGN})
@@ -109,20 +102,3 @@
set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi_s")
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")
-
-# 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)
-# .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)