From 20c4d6007bdf36d101aab1c43e0d6a1141b761e0 Mon Sep 17 00:00:00 2001 From: Jirawat I Date: Fri, 12 Mar 2021 17:43:03 +0700 Subject: [PATCH] Fixed macos conda-build and pypi upload - update libigl to 2.3.0 - add skipdownload external igl - update external.tar.gz - update macosx_sdk to 10.15 --- .azure-pipelines/azure-pipelines-osx.yml | 1 - .ci_support/osx_64.yaml | 2 +- .github/workflows/binary.yml | 2 +- .gitignore | 8 +-- .scripts/run_osx_build.sh | 2 +- CMakeLists.txt | 92 ++++++++++++++++++++++-- LICENSE.txt | 13 ---- README.md | 10 +-- cmake/FindLIBIGL.cmake | 11 ++- cmake/FindVCG.cmake | 2 +- recipe/bld.bat | 1 + recipe/build.sh | 17 ++++- recipe/meta.yaml | 1 + scripts/tar_external.sh | 2 +- setup.py | 2 +- 15 files changed, 127 insertions(+), 39 deletions(-) delete mode 100755 LICENSE.txt diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 2fea8bd..0cc507b 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -21,7 +21,6 @@ jobs: export CI=azure export GIT_BRANCH=$BUILD_SOURCEBRANCHNAME export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME}) - brew install libomp ./.scripts/run_osx_build.sh displayName: Run OSX build env: diff --git a/.ci_support/osx_64.yaml b/.ci_support/osx_64.yaml index 3419042..8ffad1e 100644 --- a/.ci_support/osx_64.yaml +++ b/.ci_support/osx_64.yaml @@ -1,5 +1,5 @@ MACOSX_DEPLOYMENT_TARGET: -- '10.9' +- '10.15' channel_sources: - conda-forge - defaults diff --git a/.github/workflows/binary.yml b/.github/workflows/binary.yml index a088933..fed4de1 100644 --- a/.github/workflows/binary.yml +++ b/.github/workflows/binary.yml @@ -29,7 +29,7 @@ jobs: with: submodules: true - - name: Install libomp for macos + - name: Install libomp (macOS) if: matrix.os == 'macos-latest' run: brew install libomp diff --git a/.gitignore b/.gitignore index c1eac0f..1663cf4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ -out +out* +build* .vs CMakeSettings.json diplib/lib main_sources.cmake python_sources.cmake -external/ +external*/ scripts/external.tar.gz -*.pyc -build_artifacts +*.pyc \ No newline at end of file diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index 83b1d28..f8a1b04 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -50,7 +50,7 @@ make_build_number ./ ./recipe ./.ci_support/${CONFIG}.yaml conda build ./recipe -m ./.ci_support/${CONFIG}.yaml --suppress-variables --clobber-file ./.ci_support/clobber_${CONFIG}.yaml ${EXTRA_CB_OPTIONS:-} -if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then +if [[ "${UPLOAD_PACKAGES}" -ne 'False' ]]; then echo -e "\n\nUploading the packages." upload_package ./ ./recipe ./.ci_support/${CONFIG}.yaml fi \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 74d79e7..a5c9c87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,20 @@ if(MSVC) # Enable parallel compilation for Visual Studio add_compile_options(/MP /bigobj /D_CRT_SECURE_NO_WARNINGS /Zc:__cplusplus) add_definitions(-DNOMINMAX -D_USE_MATH_DEFINES -DWIN32_LEAN_AND_MEAN) + # Silencing some compile warnings + add_compile_options( + # Type conversion warnings. These can be fixed with some effort and possibly more verbose code. + /wd4267 # conversion from 'size_t' to 'type', possible loss of data + /wd4244 # conversion from 'type1' to 'type2', possible loss of data + /wd4018 # signed/unsigned mismatch + /wd4305 # truncation from 'double' to 'float' + # This one is from template instantiations generated by autoexplicit.sh: + /wd4667 # no function template defined that matches forced instantiation () + # This one is easy to fix, just need to switch to safe version of C functions + /wd4996 # this function or variable may be unsafe + # This one is when using bools in adjacency matrices + /wd4804 #'+=': unsafe use of type 'bool' in operation + ) endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -30,8 +44,35 @@ message(STATUS "CMAKE SYSTEM NAME: ${CMAKE_SYSTEM_NAME}") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") message(STATUS "[OSX Detected]") - add_definitions(-D_DARWIN_C_SOURCE -D_GNU_SOURCE) + add_definitions(-D_DARWIN_C_SOURCE -D_GNU_SOURCE -D_XOPEN_SOURCE=600) add_compile_options(-faligned-allocation) + #[[ + find_program(brew brew) + if(brew) + execute_process(COMMAND "${brew}" --prefix + RESULT_VARIABLE brew_f + OUTPUT_VARIABLE brew_prefix + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(brew_f EQUAL 0) + list(APPEND CMAKE_MODULE_PATH ${brew_prefix}/share/cmake/Modules) + message(STATUS "Brew: ${brew} --prefix => ${brew_prefix}") + endif() + + execute_process(COMMAND "${brew}" --prefix eigen + RESULT_VARIABLE brew_f + OUTPUT_VARIABLE brew_prefix + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(brew_f EQUAL 0) + message(STATUS "Brew: ${brew} --prefix eigen => ${brew_prefix}") + set(ENV{EIGEN3_ROOT_DIR} "${brew_prefix}") + set(ENV{Eigen3_ROOT} "${brew_prefix}") + endif() + endif() + ]] endif() if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") @@ -49,7 +90,7 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/libigl/CMakeLists.txt" OR download_external_files( https://github.com/nodtem66/Scaffolder/releases/download/v1.5.1/external.tar.gz "${PROJECT_SOURCE_DIR}/scripts/external.tar.gz" - 30b7a0a4ad0a0830bab3fe9fc8405eb0a6cd93efd38a3791e7182703590a102a + bdfbd6d7a5643fca1fe7ca1db24d1fa1e3971e0b1d18a7225db1fdd94859f05d ) file(ARCHIVE_EXTRACT INPUT "${PROJECT_SOURCE_DIR}/scripts/external.tar.gz" DESTINATION ${PROJECT_SOURCE_DIR}) endif() @@ -96,11 +137,32 @@ if(BUILD_SCAFFOLDER) # Build binary add_executable(${PROJECT_NAME} ${MAIN_SOURCES} ${PROJECT_SOURCE_DIR}/src/Main.cpp) - target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include" ${TBB_INCLUDE_DIR} ${VCG_INCLUDE_DIR} ${EIGEN_INCLUDE_DIR} ${SOL2_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${OpenCTM_INCLUDE_DIR} "${OpenCTM_INCLUDE_DIR}/liblzma/") - target_link_libraries(${PROJECT_NAME} PRIVATE igl::core tbb Threads::Threads OpenMP::OpenMP_CXX ${LUA_LIBRARIES}) + target_include_directories(${PROJECT_NAME} PRIVATE + "${PROJECT_SOURCE_DIR}/include" + ${TBB_INCLUDE_DIR} + ${VCG_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIR} + ${SOL2_INCLUDE_DIR} + ${LUA_INCLUDE_DIR} + ${OpenCTM_INCLUDE_DIR} + "${OpenCTM_INCLUDE_DIR}/liblzma/" + ) + target_link_libraries(${PROJECT_NAME} PRIVATE + igl::core + tbb + Threads::Threads + OpenMP::OpenMP_CXX + ${LUA_LIBRARIES} + ) add_executable("${PROJECT_NAME}.SliceTest" ${MAIN_SOURCES} ${PROJECT_SOURCE_DIR}/src/SliceTest.cpp) - target_include_directories("${PROJECT_NAME}.SliceTest" PRIVATE "${PROJECT_SOURCE_DIR}/include" ${VCG_INCLUDE_DIR} ${EIGEN_INCLUDE_DIR} ${OpenCTM_INCLUDE_DIR} "${OpenCTM_INCLUDE_DIR}/liblzma/") + target_include_directories("${PROJECT_NAME}.SliceTest" PRIVATE + "${PROJECT_SOURCE_DIR}/include" + ${VCG_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIR} + ${OpenCTM_INCLUDE_DIR} + "${OpenCTM_INCLUDE_DIR}/liblzma/" + ) target_link_libraries("${PROJECT_NAME}.SliceTest" PRIVATE tbb OpenMP::OpenMP_CXX) # Install binary @@ -122,8 +184,24 @@ if(BUILD_PYSCAFFOLDER) update_deps_file("python_sources" "${PYTHON_SOURCES}") pybind11_add_module("Py${PROJECT_NAME}" ${PYTHON_SOURCES}) - target_include_directories("Py${PROJECT_NAME}" PRIVATE "${PROJECT_SOURCE_DIR}/include" ${TBB_INCLUDE_DIR} ${VCG_INCLUDE_DIR} ${EIGEN_INCLUDE_DIR} ${SOL2_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${PyBind11_INCLUDE_DIR} ${OpenCTM_INCLUDE_DIR} "${OpenCTM_INCLUDE_DIR}/liblzma/") - target_link_libraries("Py${PROJECT_NAME}" PRIVATE igl::core tbb Threads::Threads OpenMP::OpenMP_CXX ${LUA_LIBRARIES}) + target_include_directories("Py${PROJECT_NAME}" PRIVATE + "${PROJECT_SOURCE_DIR}/include" + ${TBB_INCLUDE_DIR} + ${VCG_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIR} + ${SOL2_INCLUDE_DIR} + ${LUA_INCLUDE_DIR} + ${PyBind11_INCLUDE_DIR} + ${OpenCTM_INCLUDE_DIR} + "${OpenCTM_INCLUDE_DIR}/liblzma/" + ) + target_link_libraries("Py${PROJECT_NAME}" PRIVATE + igl::core + tbb + Threads::Threads + OpenMP::OpenMP_CXX + ${LUA_LIBRARIES} + ) include(GNUInstallDirs) install(TARGETS "Py${PROJECT_NAME}" COMPONENT python diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100755 index 5f30279..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,13 +0,0 @@ -BSD 3-clause license -Copyright (c) 2015-2020, conda-forge contributors -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 6265a76..97f8653 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Scaffolder -![Build Status](https://github.com/nodtem66/Scaffolder/workflows/Build/badge.svg) [![Build Status](https://dev.azure.com/n66/Public%20CI/_apis/build/status/nodtem66.Scaffolder?branchName=conda-forge)](https://dev.azure.com/n66/Public%20CI/_build/latest?definitionId=1&branchName=conda-forge) +![Build Status](https://github.com/nodtem66/Scaffolder/workflows/Build/badge.svg) [![Build Status](https://dev.azure.com/n66/PublicCI/_apis/build/status/nodtem66.Scaffolder%20(Anaconda)?branchName=master)](https://dev.azure.com/n66/PublicCI/_build/latest?definitionId=6&branchName=master) [![Anaconda](https://anaconda.org/nodtem66/scaffolder/badges/version.svg)](https://anaconda.org/nodtem66/scaffolder) ![Last update](https://anaconda.org/nodtem66/scaffolder/badges/latest_release_date.svg) ![Platform](https://anaconda.org/nodtem66/scaffolder/badges/platforms.svg) ![Install](https://anaconda.org/nodtem66/scaffolder/badges/installer/conda.svg) @@ -116,16 +116,18 @@ pip install PyScaffolder - **Window**: The addon zip can be downloaded at [Release](https://github.com/nodtem66/Scaffolder/releases/tag/v1.5.1) - Otherwise, create a "Scaffolder" folder in blender scripts direction - Copy all files in blender folder of this project to that path -- Since blender did not ship with pip, the [PyScaffolder wheel](https://pypi.org/manage/project/PyScaffolder/release/1.5.1/) must be downloaded and unpacked at that path +- Since blender did not ship with pip, the [PyScaffolder wheel](https://pypi.org/manage/project/PyScaffolder) must be downloaded and unpacked at that path ## Screenshots +- **Blender plugin with PyScaffolder** + +![Blender plugin](https://github.com/nodtem66/Scaffolder/raw/master/images/blender-plugin.gif) + - **The figure of patterns implemented in this program** ![TPMS Patterns](https://github.com/nodtem66/Scaffolder/raw/master/images/patterns.jpg) -- Blender plugin with PyScaffolder -![Blender plugin](https://github.com/nodtem66/Scaffolder/raw/master/images/blender-plugin.gif) - **The examples of generated porous scaffold** diff --git a/cmake/FindLIBIGL.cmake b/cmake/FindLIBIGL.cmake index 83ee31e..cf2068b 100644 --- a/cmake/FindLIBIGL.cmake +++ b/cmake/FindLIBIGL.cmake @@ -27,8 +27,13 @@ mark_as_advanced(LIBIGL_INCLUDE_DIR) set(LIBIGL_WITH_OPENGL OFF CACHE INTERNAL "turn off OPENGL in LIBIGL") set(LIBIGL_WITH_OPENGL_GLFW OFF CACHE INTERNAL "turn off OPENGL GLFW in LIBIGL") set(LIBIGL_USE_STATIC_LIBRARY OFF CACHE INTERNAL "prefer STATIC build") +set(LIBIGL_SKIP_DOWNLOAD ON CACHE INTERNAL "Skip download libigl") +# set(HUNTER_ENABLED ON CACHE INTERNAL "Enable Hunter package manager support") -list(APPEND CMAKE_MODULE_PATH "${LIBIGL_INCLUDE_DIR}/../cmake") message(STATUS "USE DIR: ${LIBIGL_INCLUDE_DIR}") -set(EIGEN_INCLUDE_DIR "${LIBIGL_INCLUDE_DIR}/../external/eigen") -include(libigl) \ No newline at end of file +list(APPEND CMAKE_MODULE_PATH "${LIBIGL_INCLUDE_DIR}/../cmake") +if (NOT EIGEN3_INCLUDE_DIR) + set(EIGEN3_INCLUDE_DIR "${LIBIGL_INCLUDE_DIR}/../external/eigen") +endif() +include(libigl) +message(STATUS "Eigen DIR: ${EIGEN3_INCLUDE_DIR}") \ No newline at end of file diff --git a/cmake/FindVCG.cmake b/cmake/FindVCG.cmake index 1a4b07e..e8282b1 100644 --- a/cmake/FindVCG.cmake +++ b/cmake/FindVCG.cmake @@ -32,7 +32,7 @@ if (VCG_INCLUDE_DIR AND LIBIGL_INCLUDE_DIR) file(READ "${VCG_INCLUDE_DIR}/eigenlib/eigen_version.txt" eigen_version) endif() if (NOT eigen_version STREQUAL LIBIGL_EIGEN_VERSION) - file(COPY "${LIBIGL_EXTERNAL}/eigen/Eigen" "${LIBIGL_EXTERNAL}/eigen/unsupported" DESTINATION "${VCG_INCLUDE_DIR}/eigenlib/") + file(COPY "${EIGEN3_INCLUDE_DIR}/Eigen" "${EIGEN3_INCLUDE_DIR}/unsupported" DESTINATION "${VCG_INCLUDE_DIR}/eigenlib/") file(WRITE "${VCG_INCLUDE_DIR}/eigenlib/eigen_version.txt" "${LIBIGL_EIGEN_VERSION}") endif() endif() \ No newline at end of file diff --git a/recipe/bld.bat b/recipe/bld.bat index aba9d2f..63f61a8 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -5,6 +5,7 @@ cmake -G Ninja ^ -DCMAKE_INSTALL_PREFIX:PATH="%PREFIX%" ^ -DCMAKE_BUILD_TYPE:STRING=Release ^ -DCMAKE_CXX_STANDARD=11 ^ + -DBUILD_PYSCAFFOLDER:BOOL=OFF ^ -S . -B build if errorlevel 1 goto DEBUG diff --git a/recipe/build.sh b/recipe/build.sh index 3bf6ada..98be5a8 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -1,15 +1,30 @@ #!/bin/bash -set -eu +set +e +set -u ### Create Makefiles cmake -G Ninja \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_STANDARD=11 \ + -DBUILD_PYSCAFFOLDER:BOOL=OFF \ -S . -B build +EXITCODE=$? +if [[ $EXITCODE -ne 0 ]]; then + [[ -f ${SRC_DIR}/build/CMakeFiles/CMakeOutput.log ]] && cat ${SRC_DIR}/build/CMakeFiles/CMakeOutput.log + [[ -f ${SRC_DIR}/build/CMakeFiles/CMakeError.log ]] && cat ${SRC_DIR}/build/CMakeFiles/CMakeError.log + exit $EXITCODE +fi ### Build cmake --build build -- -j${CPU_COUNT} +EXITCODE=$? +if [[ $EXITCODE -ne 0 ]]; then + [[ -f ${SRC_DIR}/build/CMakeFiles/CMakeOutput.log ]] && cat ${SRC_DIR}/build/CMakeFiles/CMakeOutput.log + [[ -f ${SRC_DIR}/build/CMakeFiles/CMakeError.log ]] && cat ${SRC_DIR}/build/CMakeFiles/CMakeError.log + exit $EXITCODE +fi +set -e ### Install cmake --install build --component scaffolder diff --git a/recipe/meta.yaml b/recipe/meta.yaml index d064bc9..9a1a9bd 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -21,6 +21,7 @@ requirements: - {{ compiler('cxx') }} - cmake - ninja + - llvm-openmp # [osx] - pkg-config # [unix] host: - vc # [win] diff --git a/scripts/tar_external.sh b/scripts/tar_external.sh index bf3165b..8dcd5c8 100644 --- a/scripts/tar_external.sh +++ b/scripts/tar_external.sh @@ -15,7 +15,7 @@ if [ ! -e external.tar.gz ]; then --exclude=external/vcglib/apps \ --exclude=external/libigl/tutorial \ --exclude=external/libigl/tests \ - --exclude=external/libigl/external \ + --exclude=external/libigl/external/.cache \ --exclude=external/pybind11/docs \ --exclude=external/OpenCTM-1.0.3/tools \ --exclude=external/OpenCTM-1.0.3/plugins \ diff --git a/setup.py b/setup.py index 3ae52e1..3676c01 100644 --- a/setup.py +++ b/setup.py @@ -109,7 +109,7 @@ def build_extension(self, ext): # logic and declaration, and simpler if you include description/version in a file. setup( name="PyScaffolder", - version="1.5.1", + version="1.5.1.dev1", author="Jirawat Iamsamang", author_email="nodtem66@gmail.com", description="Python wrapper for scaffolder program",