From 90158caae951d81ea783ed3b2bfc68a614ffdeea Mon Sep 17 00:00:00 2001 From: Joshua Koch Date: Tue, 24 Sep 2024 12:54:38 -0500 Subject: [PATCH] Update build for cmake 3.30 and c++14 --- .gitignore | 1 + CMakeLists.txt | 9 ++++----- src/autodata/dynamic/Record.cxx | 3 ++- src/cpplinq/linq_iterators.hpp | 2 +- src/swig/CMakeLists.txt | 4 ++-- src/swig/Poco/CMakeLists.txt | 4 ++-- src/swig/Poco/Data/CMakeLists.txt | 4 ++-- src/swig/Poco/Dynamic/CMakeLists.txt | 4 ++-- src/swig/autodata/db/CMakeLists.txt | 4 ++-- src/swig/autodata/util/CMakeLists.txt | 4 ++-- src/swig/std/CMakeLists.txt | 4 ++-- src/swig/std/module.i | 1 + 12 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 9477392..feb634f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +*.swp build-64-bit install-64-bit build-32-bit diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bdf5a5..6082c04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.0.0 ) +cmake_minimum_required( VERSION 3.30.0 ) foreach( policy ) if( POLICY ${policy} ) @@ -72,7 +72,7 @@ set( BOOST_USE_MULTITHREADED ON ) set( BOOST_USE_STATIC_RUNTIME OFF ) set( BOOST_ROOT "Please specify" CACHE PATH "Root directory where Boost is installed" ) -find_package( Boost 1.53.0 REQUIRED COMPONENTS +find_package( Boost 1.53.0 CONFIG REQUIRED COMPONENTS date_time filesystem program_options regex system thread ) #CSharp @@ -98,8 +98,7 @@ set( POCO_ODBC_API_DEFINE "undef" ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) #Python -find_package( PythonInterp 3 ) -find_package( PythonLibs 3 ) +find_package( Python3 COMPONENTS Interpreter Development ) #Ruby find_package( Ruby 2.2 ) @@ -107,7 +106,7 @@ find_package( Ruby 2.2 ) endif() #Swig -find_package( SWIG ) +find_package( SWIG 4.0 ) foreach( config IN LISTS CMAKE_CONFIGURATION_TYPES ITEMS ${CMAKE_BUILD_TYPE} ) string( TOUPPER ${config} config ) diff --git a/src/autodata/dynamic/Record.cxx b/src/autodata/dynamic/Record.cxx index 2924d18..86b7ba6 100644 --- a/src/autodata/dynamic/Record.cxx +++ b/src/autodata/dynamic/Record.cxx @@ -37,6 +37,7 @@ using namespace Poco::Data; using namespace Poco::Data::Keywords; using namespace Poco::Dynamic; using namespace Poco::JSON; +namespace PJ = Poco::JSON; namespace autodata { @@ -201,7 +202,7 @@ void Record::FromJson( { try { - Parser parser; + PJ::Parser parser; Var result = parser.parse( json ); poco_assert( result.type() == typeid( Object::Ptr ) ); Struct< std::string >::operator =( *result.extract< Object::Ptr >() ); diff --git a/src/cpplinq/linq_iterators.hpp b/src/cpplinq/linq_iterators.hpp index a04b217..c3a8782 100644 --- a/src/cpplinq/linq_iterators.hpp +++ b/src/cpplinq/linq_iterators.hpp @@ -160,7 +160,7 @@ namespace cpplinq { private: bool empty() const { - !cur || cur->empty(); + return !cur || cur->empty(); } util::maybe cur; diff --git a/src/swig/CMakeLists.txt b/src/swig/CMakeLists.txt index 2006e37..edc85e3 100644 --- a/src/swig/CMakeLists.txt +++ b/src/swig/CMakeLists.txt @@ -26,8 +26,8 @@ set( MODULE_FILE module.i ) include_directories( ${CMAKE_SOURCE_DIR}/src ) include_directories( ${SWIG_SRC_DIR} ) -if( PYTHONLIBS_FOUND ) - include_directories( ${PYTHON_INCLUDE_DIRS} ) +if( Python3_FOUND ) + include_directories( ${Python3_INCLUDE_DIRS} ) endif() if( RUBY_FOUND ) include_directories( ${RUBY_ARCHHDR_DIR} ) diff --git a/src/swig/Poco/CMakeLists.txt b/src/swig/Poco/CMakeLists.txt index d888b32..9712ad5 100644 --- a/src/swig/Poco/CMakeLists.txt +++ b/src/swig/Poco/CMakeLists.txt @@ -19,7 +19,7 @@ if( CSHARP_FOUND ) include( ModuleInstall ) endif() -if( PYTHONLIBS_FOUND ) +if( Python3_FOUND ) set( MODULE_NAME Poco ) set( TARGET_NAME ${MODULE_NAME}_python ) set( SWIG_LANGUAGE PYTHON ) @@ -33,7 +33,7 @@ if( PYTHONLIBS_FOUND ) swig_add_library( ${TARGET_NAME} LANGUAGE python SOURCES ${MODULE_FILE} ) swig_link_libraries( ${TARGET_NAME} ${POCO_LIBRARIES} - ${PYTHON_LIBRARIES} ) + ${Python3_LIBRARIES} ) include( ModuleInstall ) endif() diff --git a/src/swig/Poco/Data/CMakeLists.txt b/src/swig/Poco/Data/CMakeLists.txt index 137fe8c..e5db827 100644 --- a/src/swig/Poco/Data/CMakeLists.txt +++ b/src/swig/Poco/Data/CMakeLists.txt @@ -19,7 +19,7 @@ if( CSHARP_FOUND ) include( ModuleInstall ) endif() -if( PYTHONLIBS_FOUND ) +if( Python3_FOUND ) set( MODULE_NAME Poco_Data ) set( TARGET_NAME ${MODULE_NAME}_python ) set( SWIG_LANGUAGE PYTHON ) @@ -35,7 +35,7 @@ if( PYTHONLIBS_FOUND ) swig_add_library( ${TARGET_NAME} LANGUAGE python SOURCES ${MODULE_FILE} ) swig_link_libraries( ${TARGET_NAME} ${POCO_LIBRARIES} - ${PYTHON_LIBRARIES} ) + ${Python3_LIBRARIES} ) include( ModuleInstall ) endif() diff --git a/src/swig/Poco/Dynamic/CMakeLists.txt b/src/swig/Poco/Dynamic/CMakeLists.txt index 387c327..769b6d7 100644 --- a/src/swig/Poco/Dynamic/CMakeLists.txt +++ b/src/swig/Poco/Dynamic/CMakeLists.txt @@ -18,7 +18,7 @@ if( CSHARP_FOUND ) include( ModuleInstall ) endif() -if( PYTHONLIBS_FOUND ) +if( Python3_FOUND ) set( MODULE_NAME Poco_Dynamic ) set( TARGET_NAME ${MODULE_NAME}_python ) set( SWIG_LANGUAGE PYTHON ) @@ -33,7 +33,7 @@ if( PYTHONLIBS_FOUND ) swig_add_library( ${TARGET_NAME} LANGUAGE python SOURCES ${MODULE_FILE} ) swig_link_libraries( ${TARGET_NAME} ${POCO_LIBRARIES} - ${PYTHON_LIBRARIES} ) + ${Python3_LIBRARIES} ) include( ModuleInstall ) endif() diff --git a/src/swig/autodata/db/CMakeLists.txt b/src/swig/autodata/db/CMakeLists.txt index 3220ad1..9fb21e8 100644 --- a/src/swig/autodata/db/CMakeLists.txt +++ b/src/swig/autodata/db/CMakeLists.txt @@ -23,7 +23,7 @@ if( CSHARP_FOUND ) include( ModuleInstall ) endif() -if( PYTHONLIBS_FOUND ) +if( Python3_FOUND ) set( MODULE_NAME autodata_db ) set( TARGET_NAME ${MODULE_NAME}_python ) set( SWIG_LANGUAGE PYTHON ) @@ -43,7 +43,7 @@ if( PYTHONLIBS_FOUND ) autodata ${Boost_LIBRARIES} ${POCO_LIBRARIES} - ${PYTHON_LIBRARIES} ) + ${Python3_LIBRARIES} ) include( ModuleInstall ) endif() diff --git a/src/swig/autodata/util/CMakeLists.txt b/src/swig/autodata/util/CMakeLists.txt index e370df2..5b2d582 100644 --- a/src/swig/autodata/util/CMakeLists.txt +++ b/src/swig/autodata/util/CMakeLists.txt @@ -22,7 +22,7 @@ if( CSHARP_FOUND ) include( ModuleInstall ) endif() -if( PYTHONLIBS_FOUND ) +if( Python3_FOUND ) set( MODULE_NAME autodata_util ) set( TARGET_NAME ${MODULE_NAME}_python ) set( SWIG_LANGUAGE PYTHON ) @@ -41,7 +41,7 @@ if( PYTHONLIBS_FOUND ) autodata ${Boost_LIBRARIES} ${POCO_LIBRARIES} - ${PYTHON_LIBRARIES} ) + ${Python3_LIBRARIES} ) include( ModuleInstall ) endif() diff --git a/src/swig/std/CMakeLists.txt b/src/swig/std/CMakeLists.txt index fa49601..78ce3bb 100644 --- a/src/swig/std/CMakeLists.txt +++ b/src/swig/std/CMakeLists.txt @@ -16,7 +16,7 @@ if( CSHARP_FOUND ) include( ModuleInstall ) endif() -if( PYTHONLIBS_FOUND ) +if( Python3_FOUND ) set( MODULE_NAME std ) set( TARGET_NAME ${MODULE_NAME}_python ) set( SWIG_LANGUAGE PYTHON ) @@ -29,7 +29,7 @@ if( PYTHONLIBS_FOUND ) ${SWIG_SRC_DIR}/common.i ) swig_add_library( ${TARGET_NAME} LANGUAGE python SOURCES ${MODULE_FILE} ) swig_link_libraries( ${TARGET_NAME} - ${PYTHON_LIBRARIES} ) + ${Python3_LIBRARIES} ) include( ModuleInstall ) endif() diff --git a/src/swig/std/module.i b/src/swig/std/module.i index 80b31e0..ab8dd8e 100644 --- a/src/swig/std/module.i +++ b/src/swig/std/module.i @@ -44,6 +44,7 @@ public: T* operator ->(); T* get(); }; +namespace literals{} } #else %include