Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and jcarpent committed Dec 12, 2023
1 parent d13f4fa commit 6566e87
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 253 deletions.
42 changes: 8 additions & 34 deletions examples/custom_numeric_type/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
cmake_minimum_required(VERSION 3.1)

set(PROJECT_NAME eigenpy_example_custom_numeric_type)
set(PROJECT_DESCRIPTION "An example of using eigenpy with a custom numeric type: Boost.Multiprecision complex numbers")
set(PROJECT_URL "http://github.com/stack-of-tasks/eigenpy/examples/custom_numeric_type")
set(PROJECT_DESCRIPTION
"An example of using eigenpy with a custom numeric type: Boost.Multiprecision complex numbers"
)
set(PROJECT_URL
"http://github.com/stack-of-tasks/eigenpy/examples/custom_numeric_type")
set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
set(PROJECT_COMPATIBILITY_VERSION AnyNewerVersion)



# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
Expand All @@ -31,7 +32,6 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
endif()
endif()


# Disable -Werror on Unix for now.
set(CXX_DISABLE_WERROR True)
set(CMAKE_VERBOSE_MAKEFILE True)
Expand All @@ -41,29 +41,24 @@ option(SUFFIX_SO_VERSION "Suffix library name with its version" OFF)

if(DEFINED BUILD_UNIT_TESTS)
message(
AUTHOR_WARNING
"BUILD_UNIT_TESTS is deprecated. Use BUILD_TESTING instead.")
AUTHOR_WARNING "BUILD_UNIT_TESTS is deprecated. Use BUILD_TESTING instead.")
set(BUILD_TESTING ${BUILD_UNIT_TESTS})
endif(DEFINED BUILD_UNIT_TESTS)


include("${JRL_CMAKE_MODULES}/base.cmake")
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})


include("${JRL_CMAKE_MODULES}/boost.cmake")
include("${JRL_CMAKE_MODULES}/python.cmake")
include("${JRL_CMAKE_MODULES}/ide.cmake")
include("${JRL_CMAKE_MODULES}/apple.cmake")


option(GENERATE_PYTHON_STUBS
"Generate the Python stubs associated to the Python library" OFF)

string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})


# If needed, fix CMake policy for APPLE systems
apply_default_apple_configuration()
check_minimal_cxx_standard(11 ENFORCE)
Expand All @@ -82,12 +77,10 @@ endif()
set(PYTHON_EXPORT_DEPENDENCY ON)
findpython(REQUIRED)


if(${NUMPY_VERSION} VERSION_LESS "1.16.0")
set(NUMPY_WITH_BROKEN_UFUNC_SUPPORT TRUE)
endif()


if(WIN32)
link_directories(${PYTHON_LIBRARY_DIRS})
# # Set default Windows build paths SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
Expand All @@ -97,8 +90,6 @@ if(WIN32)
# ${PROJECT_BINARY_DIR}/Bin CACHE PATH "Sing$le directory for all archives")
endif(WIN32)



# ----------------------------------------------------
# --- DEPENDENCIES -----------------------------------
# ----------------------------------------------------
Expand All @@ -110,28 +101,21 @@ export_boost_default_options()
find_package(Boost REQUIRED)
search_for_boost_python(REQUIRED)


# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
set(${PROJECT_NAME}_HEADERS
include/header.hpp)

set(${PROJECT_NAME}_HEADERS include/header.hpp)

set(${PROJECT_NAME}_SOURCES src/src.cpp)



add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})


target_include_directories(
${PROJECT_NAME} SYSTEM
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)


modernize_target_link_libraries(
${PROJECT_NAME}
SCOPE
Expand All @@ -141,7 +125,6 @@ modernize_target_link_libraries(
INCLUDE_DIRS
${EIGEN3_INCLUDE_DIR})


modernize_target_link_libraries(
${PROJECT_NAME}
SCOPE
Expand All @@ -152,15 +135,10 @@ modernize_target_link_libraries(
${NUMPY_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIR})



if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
endif(SUFFIX_SO_VERSION)




if(NOT WIN32)
target_compile_options(
${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>
Expand Down Expand Up @@ -214,13 +192,9 @@ install(
# ----------------------------------------------------
# --- PYTHON LIBRARY ---------------------------------
# ----------------------------------------------------
#add_subdirectory(python)
# add_subdirectory(python)

pkg_config_append_libs(${PROJECT_NAME})
pkg_config_append_cflags("-I${PYTHON_INCLUDE_DIRS}")
pkg_config_append_cflags("-I${NUMPY_INCLUDE_DIRS}")
pkg_config_append_boost_libs(${BOOST_COMPONENTS})




2 changes: 1 addition & 1 deletion examples/custom_numeric_type/examplescript.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import eigenpy_example_custom_numeric_type as example

example.MpfrComplex(2) # the number 2, in variable precision as a complex number
example.MpfrComplex(2) # the number 2, in variable precision as a complex number
Loading

0 comments on commit 6566e87

Please sign in to comment.