Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
move porttime into src directory and make src/portmidi directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Jul 16, 2021
1 parent 517897c commit 85c89cf
Show file tree
Hide file tree
Showing 25 changed files with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(PortMIDI VERSION 235.0)

option(BUILD_SHARED_LIBS "Build dynamic library" ON)

add_library(PortTime porttime/porttime.c)
add_library(PortTime src/porttime/porttime.c)
target_include_directories(PortTime PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
Expand All @@ -14,39 +14,51 @@ set_target_properties(PortTime PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
)

add_library(PortMIDI src/common/portmidi.c src/common/pmutil.c)
add_library(PortMIDI
src/portmidi/common/portmidi.c
src/portmidi/common/pmutil.c
)
set_target_properties(PortMIDI PROPERTIES OUTPUT_NAME portmidi)
set_target_properties(PortMIDI PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
)
target_include_directories(PortMIDI PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/common>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/portmidi/common>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(PortMIDI PRIVATE pm_common porttime)

# FreeBSD has a reimplementation of alsalib, so don't restrict the ALSA backend strictly to Linux.
if(UNIX AND NOT APPLE)
find_package(ALSA REQUIRED)
target_sources(PortTime PRIVATE porttime/ptlinux.c)
target_sources(PortMIDI PRIVATE src/linux/pmlinux.c src/linux/pmlinuxalsa.c src/linux/finddefault.c)
target_sources(PortTime PRIVATE src/porttime/ptlinux.c)
target_sources(PortMIDI PRIVATE
src/portmidi/linux/pmlinux.c
src/portmidi/linux/pmlinuxalsa.c
src/portmidi/linux/finddefault.c)
target_link_libraries(PortMIDI PRIVATE ALSA::ALSA)
elseif(APPLE)
find_library(COREAUDIO_LIBRARY CoreAudio REQUIRED)
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
find_library(COREMIDI_LIBRARY CoreMidi REQUIRED)
find_library(CORESERVICES_LIBRARY CoreServices REQUIRED)

target_sources(PortTime PRIVATE porttime/ptmacosx_mach.c)
target_sources(PortTime PRIVATE src/porttime/ptmacosx_mach.c)
target_link_libraries(PortTime PRIVATE ${COREAUDIO_LIBRARY} ${COREFOUNDATION_LIBRARY})

target_sources(PortMIDI PRIVATE src/mac/pmmac.c src/mac/pmmacosxcm.c src/mac/finddefault.c src/mac/readbinaryplist.c)
target_sources(PortMIDI PRIVATE
src/portmidi/mac/pmmac.c
src/portmidi/mac/pmmacosxcm.c
src/portmidi/mac/finddefault.c
src/portmidi/mac/readbinaryplist.c)
target_link_libraries(PortMIDI PRIVATE ${COREAUDIO_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREMIDI_LIBRARY} ${CORESERVICES_LIBRARY})
elseif(WIN32)
target_sources(PortTime PRIVATE porttime/ptwinmm.c)
target_sources(PortTime PRIVATE src/porttime/ptwinmm.c)
target_link_libraries(PortTime PRIVATE winmm)
target_sources(PortMIDI PRIVATE src/windows/pmwin.c src/windows/pmwinmm.c)
target_sources(PortMIDI PRIVATE
src/portmidi/windows/pmwin.c
src/portmidi/windows/pmwinmm.c)
target_link_libraries(PortMIDI PRIVATE winmm)
else()
message(FATAL_ERROR "Operating system not supported.")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 85c89cf

Please sign in to comment.