cmake_minimum_required(VERSION 2.6)
project(spmod_puredata)

ADD_SUBDIRECTORY(oscpack)
INCLUDE_DIRECTORIES (oscpack)

set(spmod_puredata_SRCS
	puredatawrapper.h
	puredatawrapper.cpp
	puredataconfig.h
	puredataconfig.cpp
	vumeter.h
	vumeter.cpp
	valuerange.h
	oscinout.h
	oscinout.cpp
	playwithvoice.h
	playwithvoice.cpp
	mod_puredata.cpp
)

if (NOT ENABLE_WXWIDGETS)
	message (FATAL_ERROR "Currently requires wxWidgets")
endif(NOT ENABLE_WXWIDGETS)

find_package(wxWidgets COMPONENTS core base net REQUIRED)

add_library (spmod_puredata MODULE ${spmod_puredata_SRCS})
target_link_libraries(spmod_puredata spcore)
target_link_libraries(spmod_puredata oscpack)
target_link_libraries(spmod_puredata ${wxWidgets_LIBRARIES})

INSTALL (TARGETS spmod_puredata RUNTIME DESTINATION ${LIBRUNTIMEDIR} LIBRARY DESTINATION ${PLUGINDIR})
if (WIN32)
	if (MSVC)
		install_to_msvc_build_directory( "${EXECUTABLE_OUTPUT_PATH}" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxbase28ud_vc_custom.dll")		
	endif(MSVC)
	install(FILES "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxbase28ud_net_vc_custom.dll" DESTINATION "${BINDIR}" CONFIGURATIONS Debug)
	install(FILES "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxbase28u_net_vc_custom.dll" DESTINATION "${BINDIR}" CONFIGURATIONS Release RelWithDebInfo)
endif(WIN32)