Skip to content

Commit

Permalink
updated cmake with recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Feb 22, 2022
1 parent 330249f commit bce625e
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 312 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ __pycache__
*.vtu
*.egg-info
*.so
temp-plot.html
temp-plot.html
data*
64 changes: 26 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
################################################################################
# Check required CMake version
set(REQUIRED_CMAKE_VERSION "3.14.0")
cmake_minimum_required(VERSION ${REQUIRED_CMAKE_VERSION})
if(POLYFEM_TOPLEVEL_PROJECT)
cmake_minimum_required(VERSION ${REQUIRED_CMAKE_VERSION})
else()
# Don't use cmake_minimum_required here to avoid implicitly overriding parent policies
if(${CMAKE_VERSION} VERSION_LESS ${REQUIRED_CMAKE_VERSION})
message(FATAL_ERROR "CMake required version to build PolyFEM is ${REQUIRED_CMAKE_VERSION}")
endif()
endif()

if(INPUT_POLYFEMPY_DATA_ROOT)
set(POLYFEMPY_DATA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_POLYFEMPY_DATA_ROOT}/")
else()
set(POLYFEMPY_DATA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/data/")
endif()
if(NOT EXISTS ${POLYFEMPY_DATA_ROOT})
file(MAKE_DIRECTORY ${POLYFEMPY_DATA_ROOT})
endif()

project(polyfempy)
################################################################################

if(INPUT_THIRD_PARTY_DIR)
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_THIRD_PARTY_DIR}/)
else()
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/recipes/")

# Color output
include(UseColors)

# Prepend function
include(PrependCurrentPath)


# Extra warnings
include(Warnings)

Expand All @@ -32,47 +43,24 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Generate position independent code by default
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

################################################################################


# Setup dependencies
include(PolyfemPythonDependencies)

################################################################################
# Polyfem library
################################################################################

set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(DOWNLOAD_GTEST OFF CACHE BOOL "" FORCE)



# polyfem
polyfem_python_download_polyfem()
add_subdirectory(${THIRD_PARTY_DIR}/polyfem)
add_library(nlohmann_json ALIAS json)

# pybind11
polyfem_python_download_pybind11()
add_subdirectory(${THIRD_PARTY_DIR}/pybind11)

# pybind11_json
polyfem_python_download_pybind11_json()
add_subdirectory(${THIRD_PARTY_DIR}/pybind11_json)



# dependencies
include(polyfem)
include(pybind11)
include(pybind11_json)

#for testing purpose
polyfem_python_download_data()

include(polyfem_data)

################################################################################
# Subdirectories
################################################################################
add_library(polyfempy MODULE src/binding.cpp src/raster.cpp)
target_link_libraries(polyfempy PRIVATE polyfem pybind11_json)
target_link_libraries(polyfempy PRIVATE pybind11::module)
target_link_libraries(polyfempy PRIVATE polyfem::polyfem pybind11::module pybind11::json)

set_target_properties(polyfempy PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX "${PYTHON_MODULE_EXTENSION}")


Expand Down
17 changes: 0 additions & 17 deletions cmake/DownloadProject.CMakeLists.cmake.in

This file was deleted.

182 changes: 0 additions & 182 deletions cmake/DownloadProject.cmake

This file was deleted.

19 changes: 0 additions & 19 deletions cmake/PolyfemPythonDependencies.cmake

This file was deleted.

55 changes: 0 additions & 55 deletions cmake/PolyfemPythonDownloadExternal.cmake

This file was deleted.

Loading

0 comments on commit bce625e

Please sign in to comment.