Modifications to compile with Python3, lest version of cmake and last
version of swig (2026-04-23) Modifications qui seront validées : modifié : CMakeLists.txt modifié : cmake/modules/OpenCVDetectPython.cmake modifié : src/java/CMakeLists.txt modifié : src/javascript/CMakeLists.txt modifié : src/python/python3/CMakeLists.txt
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
cmake_minimum_required (VERSION 3.22)
|
||||
#cmake_minimum_required (VERSION 3.22)
|
||||
cmake_minimum_required (VERSION 3.5)
|
||||
project (mraa C)
|
||||
|
||||
cmake_policy(SET CMP0177 NEW)
|
||||
#cmake_policy(SET CMP0148 NEW)
|
||||
|
||||
FIND_PACKAGE (Threads REQUIRED)
|
||||
|
||||
set (CMAKE_C_STANDARD 99)
|
||||
@@ -74,27 +78,28 @@ if (BUILDCPP)
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# This function adds the c++11 flag to a c++ target (if supported)
|
||||
function(use_cxx_11 targetname)
|
||||
# This function adds the c++20 flag to a c++ target (if supported)
|
||||
function(use_cxx_20 targetname)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
if (COMPILER_SUPPORTS_CXX11)
|
||||
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++20" COMPILER_SUPPORTS_CXX20)
|
||||
if (COMPILER_SUPPORTS_CXX20)
|
||||
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++20")
|
||||
message(STATUS "INFO Use std=c++20")
|
||||
else()
|
||||
message(FATAL_ERROR "Target '${targetname}' requires c++11 which is not supported by this compiler")
|
||||
message(FATAL_ERROR "Target '${targetname}' requires c++20 which is not supported by this compiler")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# This function adds the c++17 flag to a c++ target (if supported)
|
||||
function(use_cxx_17 targetname)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
if (COMPILER_SUPPORTS_CXX17)
|
||||
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++17")
|
||||
else()
|
||||
message(FATAL_ERROR "Target '${targetname}' requires c++17 which is not supported by this compiler")
|
||||
endif()
|
||||
endfunction()
|
||||
# # This function adds the c++17 flag to a c++ target (if supported)
|
||||
# function(use_cxx_17 targetname)
|
||||
# include(CheckCXXCompilerFlag)
|
||||
# CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
# if (COMPILER_SUPPORTS_CXX17)
|
||||
# set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++17")
|
||||
# else()
|
||||
# message(FATAL_ERROR "Target '${targetname}' requires c++17 which is not supported by this compiler")
|
||||
# endif()
|
||||
# endfunction()
|
||||
endif()
|
||||
|
||||
# Set CMAKE_INSTALL_LIBDIR if not defined
|
||||
@@ -158,17 +163,17 @@ option (BUILDDOC "Build all doc." OFF)
|
||||
option (BUILDSWIG "Build swig modules." ON)
|
||||
option (BUILDSWIGPYTHON "Build swig python modules." ON)
|
||||
option (BUILDSWIGNODE "Build swig node modules." OFF)
|
||||
option (BUILDSWIGJAVA "Build Java API." OFF)
|
||||
option (BUILDSWIGJAVA "Build Java API." ON)
|
||||
option (USBPLAT "Detection USB platform." OFF)
|
||||
option (FIRMATA "Add Firmata support to mraa." OFF)
|
||||
option (ONEWIRE "Add Onewire support to mraa." ON)
|
||||
option (JSONPLAT "Add Platform loading via a json file." ON)
|
||||
option (IMRAA "Add Imraa support to mraa." OFF)
|
||||
option (FTDI4222 "Build with FTDI FT4222 subplatform support." OFF)
|
||||
option (ENABLEEXAMPLES "Enable building of examples" ON)
|
||||
option (ENABLEEXAMPLES "Enable building of examples" OFF)
|
||||
option (INSTALLTOOLS "Install all tools" ON)
|
||||
option (BUILDTESTS "Override the addition of tests" ON)
|
||||
option (USEPYTHON3TESTS "Force tests to run with python3" OFF)
|
||||
option (USEPYTHON3TESTS "Force tests to run with python3" ON)
|
||||
|
||||
set (BUILDARCH "" CACHE STRING "Override architecture to build for")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user