mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
cmake function audacity_module abstracts common module setup steps...
... But leaving the wxDEBUG definition in each. It should not be in the reused function.
This commit is contained in:
parent
20e818cb9e
commit
938bbeb4f9
@ -204,3 +204,74 @@ macro( check_for_platform_version )
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# Set up for defining a module target.
|
||||||
|
# All modules depend on the application.
|
||||||
|
# Pass a name and sources, and a list of other targets.
|
||||||
|
# Use the interface compile definitions and include directories of the
|
||||||
|
# other targets, and link to them.
|
||||||
|
# More defines, and more target libraries (maybe generator expressions)
|
||||||
|
# may be given too.
|
||||||
|
function( audacity_module NAME SOURCES IMPORT_TARGETS
|
||||||
|
ADDITIONAL_DEFINES ADDITIONAL_LIBRARIES )
|
||||||
|
|
||||||
|
set( TARGET ${NAME} )
|
||||||
|
set( TARGET_ROOT ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
|
|
||||||
|
message( STATUS "========== Configuring ${TARGET} ==========" )
|
||||||
|
|
||||||
|
def_vars()
|
||||||
|
|
||||||
|
add_library( ${TARGET} MODULE )
|
||||||
|
|
||||||
|
# compute INCLUDES
|
||||||
|
unset( INCLUDES )
|
||||||
|
foreach( IMPORT ${IMPORT_TARGETS} )
|
||||||
|
unset( PROPS )
|
||||||
|
get_target_property( PROPS ${IMPORT} INTERFACE_INCLUDE_DIRECTORIES )
|
||||||
|
if (PROPS)
|
||||||
|
list( APPEND INCLUDES PUBLIC ${PROPS} )
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
list( APPEND INCLUDES PUBLIC ${TARGET_ROOT} )
|
||||||
|
|
||||||
|
# compute DEFINES
|
||||||
|
unset( DEFINES )
|
||||||
|
foreach( IMPORT ${IMPORT_TARGETS} )
|
||||||
|
unset( PROPS )
|
||||||
|
get_target_property( PROPS ${IMPORT} INTERFACE_COMPILE_DEFINITIONS )
|
||||||
|
if (PROPS)
|
||||||
|
list( APPEND DEFINES ${PROPS} )
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
list( APPEND DEFINES ${ADDITIONAL_DEFINES} )
|
||||||
|
|
||||||
|
set( LOPTS
|
||||||
|
PRIVATE
|
||||||
|
$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>
|
||||||
|
)
|
||||||
|
|
||||||
|
# compute LIBRARIES
|
||||||
|
set( LIBRARIES PRIVATE Audacity )
|
||||||
|
foreach( IMPORT ${IMPORT_TARGETS} )
|
||||||
|
list( APPEND LIBRARIES "${IMPORT}" )
|
||||||
|
endforeach()
|
||||||
|
list( APPEND LIBRARIES ${ADDITIONAL_LIBRARIES} )
|
||||||
|
|
||||||
|
set_target_property_all( ${TARGET} LIBRARY_OUTPUT_DIRECTORY "${_MODDIR}" )
|
||||||
|
set_target_properties( ${TARGET}
|
||||||
|
PROPERTIES
|
||||||
|
PREFIX ""
|
||||||
|
FOLDER "modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
# list( TRANSFORM SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/" )
|
||||||
|
list( PREPEND SOURCES "PRIVATE" )
|
||||||
|
|
||||||
|
organize_source( "${TARGET_ROOT}" "" "${SOURCES}" )
|
||||||
|
target_sources( ${TARGET} PRIVATE ${SOURCES} )
|
||||||
|
target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
||||||
|
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
||||||
|
target_link_options( ${TARGET} PRIVATE ${LOPTS} )
|
||||||
|
target_link_libraries( ${TARGET} PRIVATE ${LIBRARIES} )
|
||||||
|
endfunction()
|
||||||
|
@ -1,27 +1,5 @@
|
|||||||
|
|
||||||
set( TARGET mod-null )
|
set( TARGET mod-null )
|
||||||
set( TARGET_ROOT ${CMAKE_CURRENT_SOURCE_DIR} )
|
set( DEFINES
|
||||||
|
|
||||||
message( STATUS "========== Configuring ${TARGET} ==========" )
|
|
||||||
|
|
||||||
def_vars()
|
|
||||||
|
|
||||||
add_library( ${TARGET} MODULE EXCLUDE_FROM_ALL )
|
|
||||||
|
|
||||||
list( APPEND SOURCES
|
|
||||||
PRIVATE
|
|
||||||
${TARGET_ROOT}/ModNullCallback.cpp
|
|
||||||
${TARGET_ROOT}/ModNullCallback.h
|
|
||||||
)
|
|
||||||
|
|
||||||
get_target_property( INCLUDES wxWidgets INTERFACE_INCLUDE_DIRECTORIES )
|
|
||||||
list( APPEND INCLUDES
|
|
||||||
PUBLIC
|
|
||||||
${TARGET_ROOT}
|
|
||||||
)
|
|
||||||
|
|
||||||
get_target_property( DEFINES wxWidgets INTERFACE_COMPILE_DEFINITIONS )
|
|
||||||
list( APPEND DEFINES
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
# This is needed until the transition to cmake is complete and
|
# This is needed until the transition to cmake is complete and
|
||||||
# the Windows pragmas are removed from ModNullCallback.cpp.
|
# the Windows pragmas are removed from ModNullCallback.cpp.
|
||||||
@ -30,29 +8,11 @@ list( APPEND DEFINES
|
|||||||
# debug versions of wxWidgets...even if the build is for Release.
|
# debug versions of wxWidgets...even if the build is for Release.
|
||||||
wxDEBUG_LEVEL=0
|
wxDEBUG_LEVEL=0
|
||||||
)
|
)
|
||||||
|
set( SOURCES
|
||||||
list( APPEND LOPTS
|
ModNullCallback.cpp
|
||||||
PRIVATE
|
ModNullCallback.h
|
||||||
$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>
|
|
||||||
)
|
)
|
||||||
|
audacity_module( ${TARGET} "${SOURCES}" "wxWidgets"
|
||||||
|
"${DEFINES}" "" )
|
||||||
|
|
||||||
list( APPEND LIBRARIES
|
set_target_properties( ${TARGET} PROPERTIES EXCLUDE_FROM_ALL YES )
|
||||||
PRIVATE
|
|
||||||
Audacity
|
|
||||||
$<$<PLATFORM_ID:Windows>:wxWidgets>
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_property_all( ${TARGET} LIBRARY_OUTPUT_DIRECTORY "${_MODDIR}" )
|
|
||||||
set_target_properties( ${TARGET}
|
|
||||||
PROPERTIES
|
|
||||||
PREFIX ""
|
|
||||||
FOLDER "modules"
|
|
||||||
)
|
|
||||||
|
|
||||||
organize_source( "${TARGET_ROOT}" "" "${SOURCES}" )
|
|
||||||
target_sources( ${TARGET} PRIVATE ${SOURCES} )
|
|
||||||
target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
|
||||||
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
|
||||||
target_link_options( ${TARGET} PRIVATE ${LOPTS} )
|
|
||||||
target_link_libraries( ${TARGET} PRIVATE ${LIBRARIES} )
|
|
||||||
|
|
||||||
|
@ -1,32 +1,9 @@
|
|||||||
|
|
||||||
set( TARGET mod-nyq-bench )
|
set( TARGET mod-nyq-bench )
|
||||||
set( TARGET_ROOT ${CMAKE_CURRENT_SOURCE_DIR} )
|
set( SOURCES
|
||||||
|
NyqBench.cpp
|
||||||
message( STATUS "========== Configuring ${TARGET} ==========" )
|
NyqBench.h
|
||||||
|
|
||||||
def_vars()
|
|
||||||
|
|
||||||
add_library( ${TARGET} MODULE EXCLUDE_FROM_ALL )
|
|
||||||
|
|
||||||
list( APPEND SOURCES
|
|
||||||
PRIVATE
|
|
||||||
${TARGET_ROOT}/NyqBench.cpp
|
|
||||||
${TARGET_ROOT}/NyqBench.h
|
|
||||||
)
|
)
|
||||||
|
set( DEFINES
|
||||||
get_target_property( wx_INCLUDES wxWidgets INTERFACE_INCLUDE_DIRECTORIES )
|
|
||||||
get_target_property( pa_INCLUDES portaudio-v19 INTERFACE_INCLUDE_DIRECTORIES )
|
|
||||||
get_target_property( ny_INCLUDES libnyquist INTERFACE_INCLUDE_DIRECTORIES )
|
|
||||||
list( APPEND INCLUDES
|
|
||||||
PUBLIC
|
|
||||||
${wx_INCLUDES}
|
|
||||||
${pa_INCLUDES}
|
|
||||||
${ny_INCLUDES}
|
|
||||||
${TARGET_ROOT}
|
|
||||||
)
|
|
||||||
|
|
||||||
get_target_property( DEFINES wxWidgets INTERFACE_COMPILE_DEFINITIONS )
|
|
||||||
list( APPEND DEFINES
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
# This is needed until the transition to cmake is complete and
|
# This is needed until the transition to cmake is complete and
|
||||||
# the Windows pragmas are removed from NyqBench.cpp. Without
|
# the Windows pragmas are removed from NyqBench.cpp. Without
|
||||||
@ -35,29 +12,7 @@ list( APPEND DEFINES
|
|||||||
# versions of wxWidgets...even if the build is for Release.
|
# versions of wxWidgets...even if the build is for Release.
|
||||||
wxDEBUG_LEVEL=0
|
wxDEBUG_LEVEL=0
|
||||||
)
|
)
|
||||||
|
audacity_module( ${TARGET} "${SOURCES}" "wxWidgets;portaudio-v19;libnyquist"
|
||||||
|
"${DEFINES}" "" )
|
||||||
|
|
||||||
list( APPEND LOPTS
|
set_target_properties( ${TARGET} PROPERTIES EXCLUDE_FROM_ALL YES )
|
||||||
PRIVATE
|
|
||||||
$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>
|
|
||||||
)
|
|
||||||
|
|
||||||
list( APPEND LIBRARIES
|
|
||||||
PRIVATE
|
|
||||||
Audacity
|
|
||||||
$<$<PLATFORM_ID:Windows>:wxWidgets>
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_property_all( ${TARGET} LIBRARY_OUTPUT_DIRECTORY "${_MODDIR}" )
|
|
||||||
set_target_properties( ${TARGET}
|
|
||||||
PROPERTIES
|
|
||||||
PREFIX ""
|
|
||||||
FOLDER "modules"
|
|
||||||
)
|
|
||||||
|
|
||||||
organize_source( "${TARGET_ROOT}" "" "${SOURCES}" )
|
|
||||||
target_sources( ${TARGET} PRIVATE ${SOURCES} )
|
|
||||||
target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
|
||||||
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
|
||||||
target_link_options( ${TARGET} PRIVATE ${LOPTS} )
|
|
||||||
target_link_libraries( ${TARGET} PRIVATE ${LIBRARIES} )
|
|
||||||
|
|
||||||
|
@ -1,27 +1,8 @@
|
|||||||
|
set( SOURCES
|
||||||
set( TARGET mod-script-pipe )
|
PipeServer.cpp
|
||||||
set( TARGET_ROOT ${CMAKE_CURRENT_SOURCE_DIR} )
|
ScripterCallback.cpp
|
||||||
|
|
||||||
message( STATUS "========== Configuring ${TARGET} ==========" )
|
|
||||||
|
|
||||||
def_vars()
|
|
||||||
|
|
||||||
add_library( ${TARGET} MODULE )
|
|
||||||
|
|
||||||
list( APPEND SOURCES
|
|
||||||
PRIVATE
|
|
||||||
${TARGET_ROOT}/PipeServer.cpp
|
|
||||||
${TARGET_ROOT}/ScripterCallback.cpp
|
|
||||||
)
|
)
|
||||||
|
set( DEFINES
|
||||||
get_target_property( INCLUDES wxWidgets INTERFACE_INCLUDE_DIRECTORIES )
|
|
||||||
list( APPEND INCLUDES
|
|
||||||
PUBLIC
|
|
||||||
${TARGET_ROOT}
|
|
||||||
)
|
|
||||||
|
|
||||||
get_target_property( DEFINES wxWidgets INTERFACE_COMPILE_DEFINITIONS )
|
|
||||||
list( APPEND DEFINES
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
BUILDING_SCRIPT_PIPE
|
BUILDING_SCRIPT_PIPE
|
||||||
|
|
||||||
@ -32,29 +13,5 @@ list( APPEND DEFINES
|
|||||||
# debug versions of wxWidgets...even if the build is for Release.
|
# debug versions of wxWidgets...even if the build is for Release.
|
||||||
wxDEBUG_LEVEL=0
|
wxDEBUG_LEVEL=0
|
||||||
)
|
)
|
||||||
|
audacity_module( mod-script-pipe "${SOURCES}" "wxWidgets"
|
||||||
list( APPEND LOPTS
|
"${DEFINES}" "" )
|
||||||
PRIVATE
|
|
||||||
$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>
|
|
||||||
)
|
|
||||||
|
|
||||||
list( APPEND LIBRARIES
|
|
||||||
PRIVATE
|
|
||||||
Audacity
|
|
||||||
$<$<PLATFORM_ID:Windows,CYGWIN>:wxWidgets>
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_property_all( ${TARGET} LIBRARY_OUTPUT_DIRECTORY "${_MODDIR}" )
|
|
||||||
set_target_properties( ${TARGET}
|
|
||||||
PROPERTIES
|
|
||||||
PREFIX ""
|
|
||||||
FOLDER "modules"
|
|
||||||
)
|
|
||||||
|
|
||||||
organize_source( "${TARGET_ROOT}" "" "${SOURCES}" )
|
|
||||||
target_sources( ${TARGET} PRIVATE ${SOURCES} )
|
|
||||||
target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
|
||||||
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
|
||||||
target_link_options( ${TARGET} PRIVATE ${LOPTS} )
|
|
||||||
target_link_libraries( ${TARGET} PRIVATE ${LIBRARIES} )
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user