Skip to content

Commit

Permalink
Enable build under NixOS (LMMS#6855)
Browse files Browse the repository at this point in the history
Explicitly call the perl interpreter when building the SWH LADSPA plugins
  • Loading branch information
michaelgregorius authored Sep 20, 2023
1 parent 94d0b91 commit 7e8c79a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 18 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ SET(LMMS_BINARY_DIR ${CMAKE_BINARY_DIR})
SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR})

# CMAKE_POLICY Section
IF(COMMAND CMAKE_POLICY)
# TODO: Keep CMP0074 but remove this condition when cmake 3.12+ is guaranteed
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12)
# Needed for the SWH Ladspa plugins. See below.
CMAKE_POLICY(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables
ENDIF()
ENDIF(COMMAND CMAKE_POLICY)

# Import of windows.h breaks min()/max()
ADD_DEFINITIONS(-DNOMINMAX)
Expand Down Expand Up @@ -266,8 +273,17 @@ ELSE(WANT_CMT)
ENDIF(WANT_CMT)

IF(WANT_SWH)
SET(LMMS_HAVE_SWH TRUE)
SET(STATUS_SWH "OK")
IF(LMMS_BUILD_APPLE)
# Prefer system perl over Homebrew, MacPorts, etc
SET(Perl_ROOT "/usr/bin")
ENDIF()
FIND_PACKAGE(Perl)
IF(PERL_FOUND)
SET(LMMS_HAVE_SWH TRUE)
SET(STATUS_SWH "OK")
ELSE()
SET(STATUS_SWH "Skipping, perl is missing")
ENDIF()
ELSE(WANT_SWH)
SET(STATUS_SWH "not built as requested")
ENDIF(WANT_SWH)
Expand Down
3 changes: 2 additions & 1 deletion plugins/LadspaEffect/swh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SET(COMPILE_FLAGS "${COMPILE_FLAGS} ${PIC_FLAGS}")
# Loop over every XML file
FILE(GLOB XML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/*.xml")
LIST(SORT XML_SOURCES)

FOREACH(_item ${XML_SOURCES})
# Get library name and (soon to be) C file
GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE)
Expand All @@ -24,7 +25,7 @@ FOREACH(_item ${XML_SOURCES})
# Coerce XML source file to C
ADD_CUSTOM_COMMAND(
OUTPUT "${_out_file}"
COMMAND ./makestub.pl "${_item}" > "${_out_file}"
COMMAND "${PERL_EXECUTABLE}" ./makestub.pl "${_item}" > "${_out_file}"
DEPENDS "${_item}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ladspa"
VERBATIM
Expand Down

0 comments on commit 7e8c79a

Please sign in to comment.