Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0408aa1a authored by hhakim's avatar hhakim
Browse files

Handle easily the excluding of faust_torch.cpp from cpp files to compile.

No need to add each new file manually.
parent 7a445c97
No related branches found
No related tags found
No related merge requests found
...@@ -25,9 +25,14 @@ if(${USE_MATIO_STATIC_LIBS}) ...@@ -25,9 +25,14 @@ if(${USE_MATIO_STATIC_LIBS})
if(FAUST_TORCH) if(FAUST_TORCH)
set(PY_EXT_SOURCES "${PY_EXT_SOURCES}+glob('${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR}/*.cpp')") set(PY_EXT_SOURCES "${PY_EXT_SOURCES}+glob('${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR}/*.cpp')")
else() else()
set(PY_EXT_SOURCES "${PY_EXT_SOURCES}+['${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR}/faust_Slice.cpp']") # add all cpp files except faust_torch.cpp
# WARNING: add manually other files here file(GLOB LIN_OP_CPP_FILES ${FAUST_LINEAR_OPERATOR_CPU_SRC_DIR}/*.cpp)
#TODO: use a cmake file(GLOB) list and ignore faust_torch.cpp to construct the py list foreach(CPP_FILE IN LISTS LIN_OP_CPP_FILES)
if(NOT ${CPP_FILE} MATCHES .*faust_torch.cpp)
message(STATUS "OK to add:"${CPP_FILE})
set(PY_EXT_SOURCES "${PY_EXT_SOURCES}+['${CPP_FILE}']")
endif()
endforeach()
endif() endif()
# extract the name (without .lib suffix) and the path of each libs: # extract the name (without .lib suffix) and the path of each libs:
# 1/ matio # 1/ matio
...@@ -186,6 +191,7 @@ configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/_FaustCorePy.pyx ${FAUST_PYTHON_BIN_D ...@@ -186,6 +191,7 @@ configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/_FaustCorePy.pyx ${FAUST_PYTHON_BIN_D
############### generate pxd file ############### generate pxd file
set(REAL_FPP double)
set(CPP_CORE_CLASS FaustCoreCppCPU) set(CPP_CORE_CLASS FaustCoreCppCPU)
configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/FaustCoreCy.pxd ${FAUST_PYTHON_BIN_DIR}/FaustCoreCy.pxd COPYONLY) configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/FaustCoreCy.pxd ${FAUST_PYTHON_BIN_DIR}/FaustCoreCy.pxd COPYONLY)
configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/FaustCoreGenCy.pxd.in ${FAUST_PYTHON_BIN_DIR}/FaustCoreGenCyCPU.pxd @ONLY) configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/FaustCoreGenCy.pxd.in ${FAUST_PYTHON_BIN_DIR}/FaustCoreGenCyCPU.pxd @ONLY)
...@@ -205,7 +211,7 @@ endif() ...@@ -205,7 +211,7 @@ endif()
########## end of pxd file generation ########## end of pxd file generation
# This function generates pyx files from generic ones (pyx.in) # This function generates pyx files from generic ones (pyx.in)
function (Generate_pyx TYPE_NAME TYPE PROC CORE_OBJ_SUFFIX FUNC_TYPE_SUFFIX) function (Generate_pyx TYPE_NAME TYPE REAL_TYPE_NAME REAL_TYPE PROC CORE_OBJ_SUFFIX FUNC_TYPE_SUFFIX CORE_OBJ_REAL_SUFFIX)
# warning: TYPE is used in configure_file # warning: TYPE is used in configure_file
set(CORE_CLASS_CPU FaustCoreGen${TYPE_NAME}CPU) set(CORE_CLASS_CPU FaustCoreGen${TYPE_NAME}CPU)
set(CORE_CLASS_GPU FaustCoreGen${TYPE_NAME}GPU) set(CORE_CLASS_GPU FaustCoreGen${TYPE_NAME}GPU)
...@@ -221,7 +227,9 @@ function (Generate_pyx TYPE_NAME TYPE PROC CORE_OBJ_SUFFIX FUNC_TYPE_SUFFIX) ...@@ -221,7 +227,9 @@ function (Generate_pyx TYPE_NAME TYPE PROC CORE_OBJ_SUFFIX FUNC_TYPE_SUFFIX)
set(CPP_CORE_CLASS FaustCoreCpp${PROC}) set(CPP_CORE_CLASS FaustCoreCpp${PROC})
set(CORE_CLASS FaustCoreGen${TYPE_NAME}${PROC}) set(CORE_CLASS FaustCoreGen${TYPE_NAME}${PROC})
set(CORE_CLASS_REAL FaustCoreGen${REAL_TYPE_NAME}${PROC})
set(CORE_OBJ core_faust_${CORE_OBJ_SUFFIX}) set(CORE_OBJ core_faust_${CORE_OBJ_SUFFIX})
set(CORE_OBJ_REAL core_faust_${CORE_OBJ_REAL_SUFFIX})
set(PYX_LIST _FaustCoreGen _FaustAlgoGenProc) set(PYX_LIST _FaustCoreGen _FaustAlgoGenProc)
if(${PROC} MATCHES CPU) if(${PROC} MATCHES CPU)
list(APPEND PYX_LIST _FaustAlgoGen) # this pyx is only on CPU list(APPEND PYX_LIST _FaustAlgoGen) # this pyx is only on CPU
...@@ -237,9 +245,9 @@ function (Generate_pyx TYPE_NAME TYPE PROC CORE_OBJ_SUFFIX FUNC_TYPE_SUFFIX) ...@@ -237,9 +245,9 @@ function (Generate_pyx TYPE_NAME TYPE PROC CORE_OBJ_SUFFIX FUNC_TYPE_SUFFIX)
endfunction() endfunction()
foreach(PROC IN LISTS PROC_LIST) foreach(PROC IN LISTS PROC_LIST)
Generate_pyx(Dbl double ${PROC} dbl "") Generate_pyx(Dbl double Dbl double ${PROC} dbl "" dbl)
if(BUILD_COMPLEX_PYX) if(BUILD_COMPLEX_PYX)
Generate_pyx(CplxDbl complex ${PROC} cplx _cplx) Generate_pyx(CplxDbl complex Dbl double ${PROC} cplx _cplx dbl)
# Generate and include the complex-only class # Generate and include the complex-only class
configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/_FaustAlgoCplxDblGenProc.pyx.in ${FAUST_PYTHON_BIN_DIR}/_FaustAlgoCplxDblGen${PROC}.pyx @ONLY) configure_file(${FAUST_PYTHON_SRC_SRC_DIR}/_FaustAlgoCplxDblGenProc.pyx.in ${FAUST_PYTHON_BIN_DIR}/_FaustAlgoCplxDblGen${PROC}.pyx @ONLY)
file(READ ${FAUST_PYTHON_BIN_DIR}/_FaustAlgoCplxDblGen${PROC}.pyx PYX_VAR) file(READ ${FAUST_PYTHON_BIN_DIR}/_FaustAlgoCplxDblGen${PROC}.pyx PYX_VAR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment