Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
faust group
faust
Commits
06d39154
Commit
06d39154
authored
5 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Remove the mingw/cython build code in CMakeLists.txt (issue #91)
parent
38b10b94
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrapper/python/CMakeLists.txt
+2
-69
2 additions, 69 deletions
wrapper/python/CMakeLists.txt
with
2 additions
and
69 deletions
wrapper/python/CMakeLists.txt
+
2
−
69
View file @
06d39154
...
...
@@ -217,8 +217,7 @@ if(UNIX)
COMMENT
"Creating pyfaust
${
PY_VER
}
"
)
endforeach
()
elseif
(
WIN32
)
if
(
NOT
${
CMAKE_GENERATOR
}
MATCHES
"MinGW Makefiles"
)
# TODO: replace by MATCHES Visual Studio ?
if
(
NOT
${
CMAKE_GENERATOR
}
MATCHES
"Visual Studio"
)
foreach
(
PYTHON_EXE IN LISTS PYTHON_EXES
)
exec_program
(
"
${
PYTHON_EXE
}
"
ARGS
"--version"
OUTPUT_VARIABLE PY_VER RETURN_VALUE PY_RES
)
#message(STATUS "PY_VER=${PY_VER}")
...
...
@@ -235,75 +234,9 @@ elseif(WIN32)
set
(
PY3_MINOR_VER
${
PY3_MINOR_VER
}
PARENT_SCOPE
)
endif
()
endforeach
()
else
()
# ${CMAKE_GENERATOR} MATCHES "MinGW Makefiles"
# manually compiling cython extension instead of using setup.py in order to avoid visual studio to meddle in the compilation (we use mingw gcc here)
if
(
CYTHON_EXES_LEN AND NOT NOPY2
)
foreach
(
INDEX RANGE 0
${
CYTHON_EXES_LEN
}
1
)
#message(STATUS "INDEX=${INDEX}")
if
(
${
INDEX
}
LESS
${
CYTHON_EXES_LEN
}
)
list
(
GET CYTHON_EXES
${
INDEX
}
CYTHON_EXE
)
#list(GET PYTH0N_EXES ${INDEX} PYTHON_EXE)
# workaround to the previous command which fails to retrieve PYTHON_EXES item
if
(
${
INDEX
}
EQUAL 0
)
string
(
REGEX REPLACE
"(.*);.*$"
"
\\
1"
PYTHON_EXE
"
${
PYTHON_EXES
}
"
)
else
()
string
(
REGEX REPLACE
".*;(.*)$"
"
\\
1"
PYTHON_EXE
"
${
PYTHON_EXES
}
"
)
endif
()
string
(
REGEX REPLACE
"(.*)(/|
\\\\
).*"
"
\\
1"
PYTHON_PARENT_PATH
${
PYTHON_EXE
}
)
#message(STATUS "PYTHON_PARENT_PATH=${PYTHON_PARENT_PATH}")
#message(STATUS "PYTHON_EXE=${PYTHON_EXE}, PYTHON_EXES=${PYTHON_EXES}, INDEX=${INDEX}")
# get abbreviated python version
exec_program
(
"
${
PYTHON_EXE
}
"
ARGS
"--version"
OUTPUT_VARIABLE PY_VER RETURN_VALUE PY_RES
)
#message(STATUS "PY_VER=${PY_VER}")
string
(
REGEX REPLACE
"Python ([0-9]
\\
.[0-9]).*$"
"
\\
1."
PY_VER_WITH_POINTS
${
PY_VER
}
)
string
(
REGEX REPLACE
"Python ([0-9])
\\
.([0-9]).*$"
"
\\
1
\\
2"
PY_VER
${
PY_VER
}
)
#message(STATUS "PY_VER=${PY_VER}")
# set header inclusion flags
string
(
REGEX REPLACE
","
";-I"
FAUST_PY_CFLAGS
${
FAUST_PYTHON_INCLUDE_DIR
}
)
string
(
REGEX REPLACE
"'"
""
FAUST_PY_CFLAGS
${
FAUST_PY_CFLAGS
}
)
set
(
FAUST_PY_CFLAGS
"
${
FAUST_PY_CFLAGS
}
;-I
${
PYTHON_PARENT_PATH
}
\\
include"
)
# get numpy header dir
execute_process
(
COMMAND
"
${
PYTHON_EXE
}
"
"-c"
"import numpy;print(numpy.get_include())"
OUTPUT_VARIABLE NUMPY_INCLUDE ERROR_VARIABLE PY_ERR RESULT_VARIABLE PY_RES
)
#message(STATUS "NUMPY_INCLUDE=${NUMPY_INCLUDE}")
set
(
FAUST_PY_CFLAGS
"-I
${
FAUST_PY_CFLAGS
}
;-I
${
NUMPY_INCLUDE
}
"
)
string
(
REGEX REPLACE
"
\n
"
""
FAUST_PY_CFLAGS
${
FAUST_PY_CFLAGS
}
)
string
(
REGEX REPLACE
";?-I"
";-I"
FAUST_PY_CFLAGS
${
FAUST_PY_CFLAGS
}
)
# find libfaust.a to statically link it into the python wrapper lib
#find_library(FAUST_LIB_PATH libfaust.a PATHS ${PROJECT_BINARY_DIR}/lib PATH_SUFFIXES release debug NO_DEFAULT_PATH)
# use rather generated expression to point to faust target file below ("$<TARGET_FILE:${FAUST_TARGET}>")
#message(STATUS "FAUST_LIB_PATH=${FAUST_LIB_PATH}")
find_library
(
MATIO_STATIC_LIB_PATH libmatio.a PATHS
${
MATIO_LIB_DIR
}
NO_DEFAULT_PATH
)
set
(
PYTHON_STATIC_LIB_PATH PYTHON_STATIC_LIB_PATH-NOTFOUND
)
# forcing search of lib (otherwise could be stuck to the previous iteration python)
find_library
(
PYTHON_STATIC_LIB_PATH libpython
${
PY_VER
}
.a PATHS
${
PYTHON_PARENT_PATH
}
PATH_SUFFIXES libs NO_DEFAULT_PATH
)
#message(STATUS "PYTHON_STATIC_LIB_PATH=${PYTHON_STATIC_LIB_PATH}")
if
(
PY_VER MATCHES 3
)
set
(
PY_DYNLIB
"_FaustCorePy.cp
${
PY_VER
}
-win_amd64.pyd"
)
set
(
PY3_VER
${
PY_VER_WITH_POINTS
}
)
string
(
REGEX REPLACE
".*([0-9])$"
"
\\
1"
PY3_MINOR_VER
${
PY_VER
}
)
set
(
PY3_MINOR_VER
${
PY3_MINOR_VER
}
PARENT_SCOPE
)
else
()
#py 2.7.x
set
(
PY_DYNLIB
"_FaustCorePy.pyd"
)
endif
()
set
(
PY_STATIC_LIBS
"$<TARGET_FILE:
${
FAUST_TARGET
}
>;
${
MATIO_STATIC_LIB_PATH
}
;
${
PYTHON_STATIC_LIB_PATH
}
"
)
string
(
REGEX REPLACE
"
\n
"
";"
PY_STATIC_LIBS
"
${
PY_STATIC_LIBS
}
"
)
add_custom_command
(
TARGET
${
FAUST_PYTHON_TARGET
}
COMMAND
${
CYTHON_EXE
}
ARGS
"--cplus"
"-o"
"
${
FAUST_PYTHON_BIN_DIR
}
/_FaustCorePy.cpp"
"
${
FAUST_PYTHON_BIN_DIR
}
/_FaustCorePy.pyx"
# patch the weird bug: missing cmath include in cython generated cpp code
COMMAND echo \
#include ^<cmath^> ">" "FAUST_CORE_TMP_FILE"
COMMAND type
ARGS
"FAUST_CORE_TMP_FILE"
"_FaustCorePy.cpp"
">"
"_FaustCorePy.cpp2"
2>NUL
COMMAND type
ARGS
"_FaustCorePy.cpp2"
">"
"_FaustCorePy.cpp"
2>NUL
COMMAND
${
CMAKE_CXX_COMPILER
}
ARGS
"-std=c++11"
"-shared"
"-DMS_WIN64"
"-s"
"-O3"
"
${
WIN32_GCC_OMP
}
"
"-o"
"
${
PY_DYNLIB
}
"
"
${
FAUST_PYTHON_BIN_DIR
}
/_FaustCorePy.cpp"
${
FAUST_PY_CFLAGS
}
${
PY_STATIC_LIBS
}
COMMENT
"Creating pyfaust
${
PY_VER
}
"
)
endif
()
endforeach
()
endif
()
endif
()
else
()
message
(
FATAL_ERROR
"
Win32 python Faust version is supported only when compiling with MinGW
"
)
message
(
FATAL_ERROR
"
Not handled system.
"
)
endif
()
#install the python wrapper
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment