diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 85309e718a752ec541f18893d7431bc8c455c280..bac8fe2a2f5f0ac7024296a86491d992159c2856 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,11 @@ +Changes in Release 4.4.0 +-------------------------------------------------------------------------------- + +* Updates build system: Removed custom boost setup code and silenced cmake + warnings. +* Several minor bug fixes, improvements + + Changes in Release 4.3.1 -------------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index e7d729192dec522e627cd4263c6d639ccecf7fd6..cd502e1bc634e5d54451cd46f1d88068b773e143 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------- # Author: Marco Biasini #------------------------------------------------------------------------------- -cmake_minimum_required(VERSION 3.12.1 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22 FATAL_ERROR) # Set CMake policies # Behaviour of target_link_libraries, always link by full path. CMP0060 can @@ -10,9 +10,29 @@ cmake_minimum_required(VERSION 3.12.1 FATAL_ERROR) # manually forced CMake to the new scheme. cmake_policy(SET CMP0060 NEW) +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.31.0") + # See CMP0177 for more information + # To summarize: all paths given to the install command are normalized starting + # from cmake version 3.31. Starting from 3.31 you'll start to see warnings if + # you use the OLD behaviour but some paths would need normalization. + # The problem with ost: some of the paths that we give install look like: + # xyz/./bla. So its actually a good thing to run them through normalization + # which would give xyz/bla + cmake_policy(SET CMP0177 NEW) +endif() + +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0") + # See CMP0167 for more information + # to summarize: Starting from boost 1.70, boost comes with a package + # configuration file BoostConfig.cmake. Starting from cmake 3.30, + # this is the way to go and users get warned if the old FindBoost module + # gets used. + cmake_policy(SET CMP0167 NEW) +endif() + set (QMEAN_VERSION_MAJOR 4) -set (QMEAN_VERSION_MINOR 3) -set (QMEAN_VERSION_PATCH 1) +set (QMEAN_VERSION_MINOR 4) +set (QMEAN_VERSION_PATCH 0) set (QMEAN_VERSION_STRING ${QMEAN_VERSION_MAJOR}.${QMEAN_VERSION_MINOR}.${QMEAN_VERSION_PATCH} ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake_support) @@ -72,9 +92,13 @@ list(GET _python_version_list 1 Python_VERSION_MINOR) # where Python modules live set(PYTHON_MODULE_PATH "python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/") -setup_boost() +find_package(Boost ${_BOOST_MIN_VERSION} + COMPONENTS filesystem + python + REQUIRED) + -find_package(OPENSTRUCTURE 2.4.0 REQUIRED +find_package(OPENSTRUCTURE 2.10.0 REQUIRED COMPONENTS mol seq seq_alg mol_alg conop db) include_directories(${Boost_INCLUDE_DIRS} diff --git a/cmake_support/QMEAN2.cmake b/cmake_support/QMEAN2.cmake index afa2c52cdb15c51e18210f764b8402390aadfc64..68af4a3ed356adf77d91c0e5101b8997b6a35a03 100644 --- a/cmake_support/QMEAN2.cmake +++ b/cmake_support/QMEAN2.cmake @@ -82,10 +82,9 @@ macro(compile_py_files module out_dir compiled_files_name) list(APPEND ${compiled_files_name} ${_out_file}) get_filename_component(_in_name ${input_file} NAME) file(MAKE_DIRECTORY ${out_dir}) - add_custom_command(TARGET ${module} + add_custom_command(TARGET ${module} POST_BUILD COMMAND ${Python_EXECUTABLE} -c "import py_compile;py_compile.compile(\"${_in_file}\",\"${_out_file}\",\"${_in_name}\",doraise=True)" - VERBATIM DEPENDS ${input_file} - ) + VERBATIM) endforeach() endmacro() @@ -147,9 +146,7 @@ macro(copy_if_different FROM_DIR TO_DIR FILES TARGETS TARGET) set(TO ${TO_DIR}/${TOFILE}) endif() file(MAKE_DIRECTORY ${TO_DIR}) - #message("copy following stuff: ${FROM} ${TO}") add_custom_command(TARGET "${TARGET}" PRE_BUILD - DEPENDS ${FROM} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO} COMMENT "" ) @@ -487,7 +484,7 @@ macro(pymod) endif() target_link_libraries("_${_LIB_NAME}" ${_PARENT_LIB_NAME} - ${Python_LIBRARIES} ${BOOST_PYTHON_LIBRARIES}) + ${Python_LIBRARIES} Boost::python) set_target_properties("_${_LIB_NAME}" PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR}) @@ -900,66 +897,13 @@ macro(find_path_recursive VARIABLE) endwhile(_fst_subs) endmacro(find_path_recursive) +macro(setup_compiler_flags) -function(get_compiler_version _OUTPUT_VERSION) - exec_program(${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _COMPILER_VERSION - ) - string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" - _COMPILER_VERSION ${_COMPILER_VERSION}) - - set(${_OUTPUT_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE) -endfunction(get_compiler_version) - + set(CMAKE_CXX_STANDARD 17) -macro(setup_compiler_flags) - if(CMAKE_COMPILER_IS_GNUCXX) - get_compiler_version(_GCC_VERSION) + if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" ) - if(_GCC_VERSION MATCHES "44") - # gcc 4.4. is very strict about aliasing rules. the shared_count - # implementation that is used boost's shared_ptr violates these rules. To - # silence the warnings and prevent miscompiles, enable - # -fno-strict-aliasing - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing" ) - endif() - #message(STATUS "GCC VERSION " ${_GCC_VERSION}) - if (_GCC_VERSION LESS "60") - # for older compilers we need to enable C++11 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() endif() -endmacro(setup_compiler_flags) +endmacro(setup_compiler_flags) -set(_BOOST_MIN_VERSION 1.53) - -macro(setup_boost) - # starting with CMake 3.11 we could use the following instead of the foreach - # find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS - # python${Python_VERSION_MAJOR}${Python_VERSION_MINOR} REQUIRED) - # set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES}) - # see https://cmake.org/cmake/help/v3.11/module/FindBoost.html - foreach(_python_lib_name python${Python_VERSION_MAJOR}${Python_VERSION_MINOR} - python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR} - python${Python_VERSION_MAJOR} - python) - find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS ${_python_lib_name} QUIET) - if(Boost_FOUND) - message(STATUS "Found Boost package: " ${_python_lib_name}) - set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES}) - break() - else() - message(STATUS "Boost package not found: " ${_python_lib_name} - ". Trying alternative names!") - endif() - endforeach(_python_lib_name) - if(NOT BOOST_PYTHON_LIBRARIES) - message(FATAL_ERROR "Failed to find any Boost Python library!") - endif() - set(Boost_LIBRARIES) - find_package(Boost ${_BOOST_MIN_VERSION} - COMPONENTS filesystem system REQUIRED) - set(BOOST_LIBRARIES ${Boost_LIBRARIES}) -endmacro(setup_boost) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7bc511e81aaf7d9dca61c4091a3fb6832d86d9c9..5ebe19be0a95646acbe6ca2bafdad4757c7452ef 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -70,9 +70,9 @@ copyright = u'2016-2020, Gabriel Studer' # built documents. # # The short X.Y version. -release = '4.3.1' +release = '4.4.0' # The full version, including alpha/beta/rc tags. -release = '4.3.1' +release = '4.4.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/example_scripts/test_doctests.py b/doc/source/example_scripts/test_doctests.py index 036bf0c32fe488359d2d3f702fd8ee69ec7d1cd4..7d80cb335bd70f5398fbc3dded4b9f02702a1920 100644 --- a/doc/source/example_scripts/test_doctests.py +++ b/doc/source/example_scripts/test_doctests.py @@ -29,6 +29,7 @@ import subprocess import shutil from ost import io, settings, table import qmean +import numpy as np class DocTests(unittest.TestCase): @@ -409,7 +410,8 @@ class DocTests(unittest.TestCase): self.assertAlmostEqual(a,b,4) def testAssessModelQualityExample(self): - return_code, sout, serr = self.runScript('assess_model_quality_example.py') + return_code, sout, serr = self.runScript('assess_model_quality_example.py') + self.assertEqual(return_code, 0) self.assertTrue(os.path.exists("local_profile.png")) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 32e36f3ae8b7288b0b1436994f05837e6ac7afe0..811aa6b43b85d6d8d29b212bfa7b5690bd93c622 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,5 +79,5 @@ configure_file(version.hh.in ${VERSION_HH_FILE}) module(NAME qmean SOURCES ${QMEAN_SOURCES} HEADERS ${QMEAN_HEADERS} PREFIX "" HEADER_OUTPUT_DIR qmean - LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES}) + LINK ${OST_LIBRARIES} Boost::filesystem) diff --git a/src/disco.cc b/src/disco.cc index 019421d8e86865f067ade610fdc795b2b885c177..169d267e3e6b7fc308fb93fed5efeb837801f370 100644 --- a/src/disco.cc +++ b/src/disco.cc @@ -55,7 +55,7 @@ void PairwiseSequenceSimilarities(const ost::seq::AlignmentHandle& aln, typedef std::vector<std::vector<char> > idx_mat_type; idx_mat_type idx_mat(aln_length, std::vector<char>(num_sequences)); for(int i = 0; i < num_sequences; ++i) { - const String& s = aln.GetSequence(i + 1).GetString(); + String s = aln.GetSequence(i + 1).GetString(); for(int j = 0; j < aln_length; ++j) { idx_mat[j][i] = static_cast<char>(ToIdx(s[j])); } @@ -116,7 +116,7 @@ void PairwiseSequenceSimilarities(const ost::seq::AlignmentHandle& aln, // lets fill in the sequence similarities to the SEQRES in a separate step // (code duplication I know) - const String& seqres = aln.GetSequence(0).GetString(); + String seqres = aln.GetSequence(0).GetString(); summed_weights.assign(num_sequences, 0); counts.assign(num_sequences, 0); seqsim_to_seqres.resize(num_sequences);