Unverified Commit a39fd80c authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #239 from jcarpent/devel

Add support of stubs generation
parents 01681f00 990bb170
Pipeline #15924 passed with stage
in 54 minutes and 7 seconds
......@@ -4,7 +4,7 @@ on: [push,pull_request]
jobs:
hpp-fcl-conda:
name: hpp-fcl on ${{ matrix.os }} with Conda
name: CI on ${{ matrix.os }} with Conda
runs-on: ${{ matrix.os }}
strategy:
......@@ -14,10 +14,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init
with:
submodules: recursive
- uses: conda-incubator/setup-miniconda@v2
with:
......@@ -32,17 +30,17 @@ jobs:
conda activate hpp-fcl
conda install cmake -c main
conda install llvm-openmp -c conda-forge
- name: Build hpp-fcl
shell: bash -l {0}
run: |
conda activate hpp-fcl
echo $CONDA_PREFIX
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3)
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3) -DGENERATE_PYTHON_STUBS=ON
make -j2
make build_tests
export CTEST_OUTPUT_ON_FAILURE=1
......
......@@ -16,9 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init
with:
submodules: recursive
- uses: goanpeca/setup-miniconda@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
......@@ -29,7 +28,7 @@ jobs:
- name: Install cmake and update conda
run: |
conda install cmake -c main
- name: Build FCL
shell: cmd /C CALL {0}
env:
......@@ -42,7 +41,7 @@ jobs:
set PATH=%PATH:C:\hostedtoolcache\windows\Boost\1.72.0;=%
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
:: Create build
mkdir build
pushd build
......@@ -53,14 +52,19 @@ jobs:
-G "Visual Studio 16 2019" -T "ClangCl" -DCMAKE_GENERATOR_PLATFORM=x64 ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DGENERATE_PYTHON_STUBS=OFF ^
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
-DBUILD_PYTHON_INTERFACE=ON ^
..
:: Build and Install
cmake --build . --config Release --target install
:: Build stubs
git clone https://github.com/jcarpent/pybind11-stubgen.git
python "%CD%\pybind11-stubgen\pybind11_stubgen\__init__.py" -o %CONDA_PREFIX%\Lib\site-packages\hppfcl hppfcl --boost-python --ignore-invalid signature --no-setup-py --root-module-suffix ""
:: Testing
ctest --output-on-failure -C Release -V
......
......@@ -15,9 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init
with:
submodules: recursive
- uses: goanpeca/setup-miniconda@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
......@@ -28,7 +27,7 @@ jobs:
- name: Install cmake and update conda
run: |
conda install cmake -c main
- name: Build FCL
shell: cmd /C CALL {0}
env:
......@@ -41,7 +40,7 @@ jobs:
set PATH=%PATH:C:\hostedtoolcache\windows\Boost\1.72.0;=%
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
:: Create build
mkdir build
pushd build
......@@ -52,14 +51,20 @@ jobs:
-G "Visual Studio 16 2019" -T "v142" -DCMAKE_GENERATOR_PLATFORM=x64 ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DGENERATE_PYTHON_STUBS=OFF ^
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
-DBUILD_PYTHON_INTERFACE=ON ^
..
:: Build and Install
cmake --build . --config Release --target install
:: Build stubs
git clone https://github.com/jcarpent/pybind11-stubgen.git
python "%CD%\pybind11-stubgen\pybind11_stubgen\__init__.py" -o %CONDA_PREFIX%\Lib\site-packages\hppfcl hppfcl --boost-python --ignore-invalid signature --no-setup-py --root-module-suffix ""
:: Testing
ctest --output-on-failure -C Release -V
......
......@@ -56,6 +56,7 @@ include(cmake/python.cmake)
include(cmake/hpp.cmake)
include(cmake/apple.cmake)
include(cmake/ide.cmake)
include(CMakeDependentOption)
SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake-modules/
......@@ -64,11 +65,25 @@ SET(CMAKE_MODULE_PATH
# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
CMAKE_DEPENDENT_OPTION(GENERATE_PYTHON_STUBS "Generate the Python stubs associated to the Python library" OFF BUILD_PYTHON_INTERFACE OFF)
#IF(WIN32)
# # Set default Windows build paths
# SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
# ${PROJECT_BINARY_DIR}/Bin
# CACHE PATH "Single directory for all libraries")
# SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
# ${PROJECT_BINARY_DIR}/Bin
# CACHE PATH "Single directory for all executables")
# SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
# ${PROJECT_BINARY_DIR}/Bin
# CACHE PATH "Sing$le directory for all archives")
#ENDIF(WIN32)
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0")
if(BUILD_PYTHON_INTERFACE)
......
Subproject commit c969427bff5210670b857aa0bd52cfab7f406427
Subproject commit 9078d521dc23fabae72e3fe8d7c0068c68364eef
......@@ -32,6 +32,8 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
include(${PROJECT_SOURCE_DIR}/cmake/stubs.cmake)
ADD_CUSTOM_TARGET(python)
SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
......@@ -137,14 +139,21 @@ IF(UNIX AND NOT APPLE)
ENDIF()
IF(IS_ABSOLUTE ${PYTHON_SITELIB})
SET(${LIBRARY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${LIBRARY_NAME})
SET(ABSOLUTE_PYTHON_SITELIB ${PYTHON_SITELIB})
ELSE()
SET(${LIBRARY_NAME}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${LIBRARY_NAME})
SET(ABSOLUTE_PYTHON_SITELIB ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
ENDIF()
SET(${LIBRARY_NAME}_INSTALL_DIR ${ABSOLUTE_PYTHON_SITELIB}/${LIBRARY_NAME})
INSTALL(TARGETS ${LIBRARY_NAME}
DESTINATION ${${LIBRARY_NAME}_INSTALL_DIR})
# --- GENERATE STUBS
IF(GENERATE_PYTHON_STUBS)
LOAD_STUBGEN()
GENERATE_STUBS(${CMAKE_CURRENT_BINARY_DIR} ${LIBRARY_NAME} ${ABSOLUTE_PYTHON_SITELIB})
ENDIF(GENERATE_PYTHON_STUBS)
# --- INSTALL SCRIPTS
SET(PYTHON_FILES
__init__.py
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment