From 7cd1ed35b314df0a715b6270f29a7c437424a00b Mon Sep 17 00:00:00 2001 From: Valerio Mariani <valerio.mariani@unibas.ch> Date: Tue, 14 Feb 2012 15:47:21 +0100 Subject: [PATCH] Modfications to allow static compilation on Linux --- CMakeLists.txt | 40 +++++++-- build_configs/buildconfig_arch | 3 + build_configs/buildconfig_arch_static | 6 ++ build_configs/buildconfig_bc2_locallibs | 11 +++ build_configs/buildconfig_bc2_static | 11 +++ .../buildconfig_bc2_static_locallibs | 13 +++ cmake_support/OST.cmake | 87 +++++++++---------- modules/base/pymod/CMakeLists.txt | 9 +- modules/conop/pymod/CMakeLists.txt | 4 +- modules/db/src/CMakeLists.txt | 3 +- modules/geom/pymod/CMakeLists.txt | 4 +- modules/img/alg/pymod/CMakeLists.txt | 6 +- modules/img/base/pymod/CMakeLists.txt | 6 +- modules/io/pymod/CMakeLists.txt | 11 +-- .../tests/testfiles/pdb/simple_defective.pdb | 67 ++++++++++++++ modules/mol/alg/pymod/CMakeLists.txt | 8 +- modules/mol/base/pymod/CMakeLists.txt | 4 +- modules/seq/alg/pymod/CMakeLists.txt | 9 +- modules/seq/base/pymod/CMakeLists.txt | 4 +- scripts/CMakeLists.txt | 46 +++++----- scripts/README.txt | 10 +++ 21 files changed, 261 insertions(+), 101 deletions(-) create mode 100644 build_configs/buildconfig_arch create mode 100644 build_configs/buildconfig_arch_static create mode 100644 build_configs/buildconfig_bc2_locallibs create mode 100644 build_configs/buildconfig_bc2_static create mode 100644 build_configs/buildconfig_bc2_static_locallibs create mode 100644 modules/io/tests/testfiles/pdb/simple_defective.pdb create mode 100644 scripts/README.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a62ab3b12..9981e10c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,15 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake_support) include(OST) +if (CMAKE_COMPILER_IS_GNUCXX) + exec_program(gcc ARGS --version OUTPUT_VARIABLE CMAKE_C_COMPILER_VERSION) + if(CMAKE_C_COMPILER_VERSION MATCHES ".*4\\.[5-9].*") + set(OST_GCC_45 true) + else() + set(OST_GCC_45 false) + endif() +endif() + option(USE_SHADER "whether to compile with shader support" OFF) option(USE_RPATH "embed rpath upon make install" @@ -53,6 +62,7 @@ if (FORTRAN_COMPILER) endif() + if (PREFIX) set(CMAKE_INSTALL_PREFIX ${PREFIX}) endif() @@ -166,6 +176,10 @@ setup_compiler_flags() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY) +if (ENABLE_STATIC) + set (CMAKE_FIND_LIBRARY_SUFFIXES .a) +endif() + setup_boost() if (ENABLE_INFO) @@ -176,7 +190,12 @@ if (ENABLE_GFX) find_package(OpenGL REQUIRED) endif() -find_package(PNG REQUIRED) +if (ENABLE_IMG OR ENABLE_GFX) + find_package(PNG REQUIRED) +else() + set (PNG_LIBRARY "") +endif() + find_package(Eigen 2.0.0 REQUIRED) find_package(Python 2.4 REQUIRED) @@ -191,16 +210,19 @@ endif() if (ENABLE_STATIC) - if (UNIX AND NOT APPLE) - find_package(DL REQUIRED) - endif() set(Boost_LIBRARIES) set(Boost_USE_STATIC_LIBS ON) find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS filesystem system iostreams regex REQUIRED) find_package(ZLIB REQUIRED) - set(STATIC_LIBRARIES ${Boost_LIBRARIES} ${FFTW_LIBRARIES} ${TIFF_LIBRARIES} - ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) + + if (UNIX AND NOT APPLE) + set(STATIC_LIBRARIES ${Boost_LIBRARIES} ${FFTW_LIBRARIES} ${TIFF_LIBRARIES} + ${PNG_LIBRARY} ${ZLIB_LIBRARY}) + else () + set(STATIC_LIBRARIES ${Boost_LIBRARIES} ${FFTW_LIBRARIES} ${TIFF_LIBRARIES} + ${PNG_LIBRARY} ${ZLIB_LIBRARY}) + endif() endif() if (ENABLE_GUI) @@ -238,6 +260,10 @@ if (UNIX) endif() endif() +if (ENABLE_STATIC) + SET(CMAKE_SKIP_BUILD_RPATH TRUE) + SET(LINK_SEARCH_END_STATIC TRUE) +endif() add_subdirectory(modules) add_subdirectory(scripts) @@ -265,4 +291,4 @@ message(STATUS " TMAlign and TMScore (-DCOMPILE_TMTOOLS) : ${_TM_TOOLS}\n" " Static Libraries (-DENABLE_STATIC) : ${ENABLE_STATIC}\n" " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}" ) - " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}") + diff --git a/build_configs/buildconfig_arch b/build_configs/buildconfig_arch new file mode 100644 index 000000000..3962f59ed --- /dev/null +++ b/build_configs/buildconfig_arch @@ -0,0 +1,3 @@ +set(PYTHON_BINARY "/usr/bin/python2" CACHE PATH "") +set(TIFF_LIBRARY "${OST_LOCAL_LIBS}/lib/libtiff.so" CACHE PATH "") +set(TIFF_INCLUDE_DIR "${OST_LOCAL_LIBS}/include/" CACHE PATH "") diff --git a/build_configs/buildconfig_arch_static b/build_configs/buildconfig_arch_static new file mode 100644 index 000000000..e3b033c27 --- /dev/null +++ b/build_configs/buildconfig_arch_static @@ -0,0 +1,6 @@ +set(PYTHON_BINARY "/usr/bin/python2" CACHE PATH "") +set(ZLIB_LIBRARY "/usr/lib/libz.a" CACHE PATH "") +set(PNG_LIBRARY "/usr/lib/libpng12.a" CACHE PATH "") +set(FFTW_LIBRARIES "/usr/lib/libfftw3f.a" CACHE PATH "") +set(TIFF_LIBRARY "${OST_LOCAL_LIBS}/lib/libtiff.a" CACHE PATH "") +set(TIFF_INCLUDE_DIR "${OST_LOCAL_LIBS}/include/" CACHE PATH "") diff --git a/build_configs/buildconfig_bc2_locallibs b/build_configs/buildconfig_bc2_locallibs new file mode 100644 index 000000000..fbc7a6147 --- /dev/null +++ b/build_configs/buildconfig_bc2_locallibs @@ -0,0 +1,11 @@ +set(FFTW_INCLUDE_PATH "/import/bc2/soft/app/FFTW/current/Linux/include/" CACHE PATH "") +set(FFTW_LIBRARIES "/import/bc2/soft/app/FFTW/current/Linux/lib/libfftw3f.so" CACHE PATH "") +set(Boost_COMPILER "-gcc41" CACHE PATH "") +set(PYTHON_ROOT "/import/bc2/soft/app/Python/current/Linux/" CACHE PATH "") +set(EIGEN2_INCLUDE_DIR "/import/bc2/soft/app/eigen/current/Linux/include/eigen2" CACHE PATH "") +set(BOOST_ROOT "/import/bc2/soft/app/boost/current/Linux" CACHE PATH "") +set(QT_QMAKE_EXECUTABLE "/import/bc2/soft/app/Qt/current/Linux/bin/qmake" CACHE PATH "") +set(COMPOUND_LIB "/import/bc2/home/schwede/GROUP/OpenStructure/ChemLib/compounds.chemlib" CACHE PATH "") +set(TIFF_LIBRARY "${OST_LOCAL_LIBS}/lib/libtiff.so" CACHE PATH "") +set(TIFF_INCLUDE_DIR "${OST_LOCAL_LIBS}/include/" CACHE PATH "") +set (CMAKE_BUILD_TYPE "Release" CACHE PATH "") diff --git a/build_configs/buildconfig_bc2_static b/build_configs/buildconfig_bc2_static new file mode 100644 index 000000000..c26933d8c --- /dev/null +++ b/build_configs/buildconfig_bc2_static @@ -0,0 +1,11 @@ +set(FFTW_INCLUDE_PATH "/import/bc2/soft/app/FFTW/current/Linux/include/" CACHE PATH "") +set(FFTW_LIBRARIES "/import/bc2/soft/app/FFTW/current/Linux/lib/libfftw3f.a" CACHE PATH "") +set(DL_LIBRARIES "/usr/lib64/libdl.a" CACHE PATH "") +set(PTHREAD_LIBRARIES "/usr/lib64/libpthread.a" CACHE PATH "") +set(ZLIB_LIBRARY "/usr/lib64/libz.a" CACHE PATH "") +set(Boost_COMPILER "-gcc41" CACHE PATH "") +set(PYTHON_ROOT "/import/bc2/soft/app/Python/current/Linux/" CACHE PATH "") +set(EIGEN2_INCLUDE_DIR "/import/bc2/soft/app/eigen/current/Linux/include/eigen2" CACHE PATH "") +set(QT_QMAKE_EXECUTABLE "/import/bc2/soft/app/Qt/current/Linux/bin/qmake" CACHE PATH "") +set(COMPOUND_LIB "/import/bc2/home/schwede/GROUP/OpenStructure/ChemLib/compounds.chemlib" CACHE PATH "") +set (CMAKE_BUILD_TYPE "Release" CACHE PATH "") diff --git a/build_configs/buildconfig_bc2_static_locallibs b/build_configs/buildconfig_bc2_static_locallibs new file mode 100644 index 000000000..c4ac3df6f --- /dev/null +++ b/build_configs/buildconfig_bc2_static_locallibs @@ -0,0 +1,13 @@ +set(FFTW_INCLUDE_PATH "/import/bc2/soft/app/FFTW/current/Linux/include/" CACHE PATH "") +set(FFTW_LIBRARIES "/import/bc2/soft/app/FFTW/current/Linux/lib/libfftw3f.a" CACHE PATH "") +set(DL_LIBRARIES "/usr/lib64/libdl.a" CACHE PATH "") +set(PTHREAD_LIBRARIES "/usr/lib64/libpthread.a" CACHE PATH "") +set(ZLIB_LIBRARY "/usr/lib64/libz.a" CACHE PATH "") +set(Boost_COMPILER "-gcc41" CACHE PATH "") +set(PYTHON_ROOT "/import/bc2/soft/app/Python/current/Linux/" CACHE PATH "") +set(EIGEN2_INCLUDE_DIR "/import/bc2/soft/app/eigen/current/Linux/include/eigen2" CACHE PATH "") +set(QT_QMAKE_EXECUTABLE "/import/bc2/soft/app/Qt/current/Linux/bin/qmake" CACHE PATH "") +set(COMPOUND_LIB "/import/bc2/home/schwede/GROUP/OpenStructure/ChemLib/compounds.chemlib" CACHE PATH "") +set(TIFF_LIBRARY "${OST_LOCAL_LIBS}/lib/libtiff.a" CACHE PATH "") +set(TIFF_INCLUDE_DIR "${OST_LOCAL_LIBS}/include/" CACHE PATH "") +set (CMAKE_BUILD_TYPE "Release" CACHE PATH "") diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 7cfd98992..a1645e095 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -177,8 +177,11 @@ macro(module) list(APPEND _ABS_SOURCE_NAMES "${CMAKE_CURRENT_SOURCE_DIR}/${_SOURCE}") endif() endforeach() - add_library(${_LIB_NAME} SHARED ${_ABS_SOURCE_NAMES}) - + if (ENABLE_STATIC AND NOT _ARG_NO_STATIC) + add_library(${_LIB_NAME} STATIC ${_ABS_SOURCE_NAMES}) + else() + add_library(${_LIB_NAME} SHARED ${_ABS_SOURCE_NAMES}) + endif() set_target_properties(${_LIB_NAME} PROPERTIES OUTPUT_NAME ${_LIB_NAME} PROJECT_LABEL ${_ARG_NAME} @@ -194,25 +197,6 @@ macro(module) LIBRARY_OUTPUT_DIRECTORY ${LIB_STAGE_PATH} ARCHIVE_OUTPUT_DIRECTORY ${LIB_STAGE_PATH} RUNTIME_OUTPUT_DIRECTORY ${LIB_STAGE_PATH}) - if (ENABLE_STATIC AND NOT _ARG_NO_STATIC) - add_library(${_LIB_NAME}_static STATIC ${_ABS_SOURCE_NAMES}) - set_target_properties(${_LIB_NAME}_static - PROPERTIES OUTPUT_NAME ${_LIB_NAME} - PROJECT_LABEL ${_ARG_NAME} - EchoString ${_ARG_NAME} - MODULE_DEPS "${_ARG_DEPENDS_ON}") - get_target_property(_DEFS ${_LIB_NAME}_static COMPILE_DEFINITIONS) - set_target_properties(${_LIB_NAME}_static PROPERTIES - COMPILE_DEFINITIONS OST_MODULE_${_UPPER_LIB_NAME}) - set_target_properties(${_LIB_NAME}_static PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${LIB_STAGE_PATH} - ARCHIVE_OUTPUT_DIRECTORY ${LIB_STAGE_PATH} - RUNTIME_OUTPUT_DIRECTORY ${LIB_STAGE_PATH}) - foreach(_DEPENDENCY ${_ARG_DEPENDS_ON}) - target_link_libraries(${_LIB_NAME}_static ${_DEPENDENCY}_static) - endforeach() - target_link_libraries(${_LIB_NAME}_static ${ZLIB_LIBRARIES} ${_ARG_LINK} ${DL_LIBRARIES}) - endif() if (APPLE) set_target_properties(${_LIB_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,@@loader_path" @@ -222,7 +206,11 @@ macro(module) #set_target_properties(${_LIB_NAME} PROPERTIES PREFIX "../") install(TARGETS ${_LIB_NAME} ARCHIVE DESTINATION "${LIB_DIR}") else() - install(TARGETS ${_LIB_NAME} LIBRARY DESTINATION "${LIB_DIR}") + if (ENABLE_STATIC) + install(TARGETS ${_LIB_NAME} ARCHIVE DESTINATION "${LIB_DIR}") + else() + install(TARGETS ${_LIB_NAME} LIBRARY DESTINATION "${LIB_DIR}") + endif() endif() if (_ARG_LINK) target_link_libraries(${_LIB_NAME} ${_ARG_LINK}) @@ -230,6 +218,10 @@ macro(module) foreach(_DEPENDENCY ${_ARG_DEPENDS_ON}) target_link_libraries(${_LIB_NAME} ${_DEPENDENCY}) endforeach() + if (ENABLE_STATIC) + target_link_libraries(${_LIB_NAME} ${STATIC_LIBRARIES}) + endif() + else() add_custom_target("${_LIB_NAME}" ALL) set_target_properties("${_LIB_NAME}" PROPERTIES HEADER_ONLY 1 @@ -258,10 +250,6 @@ macro(module) set(_HDR_STAGE_DIR "${_HEADER_OUTPUT_DIR}/${_DIR}") stage_headers("${_ABS_HEADER_NAMES}" "${_HDR_STAGE_DIR}" "${_LIB_NAME}" "${_DIR}") - if (ENABLE_STATIC) - stage_headers("${_ABS_HEADER_NAMES}" "${_HDR_STAGE_DIR}" - "${_LIB_NAME}_static" "${_DIR}") - endif() set(_HEADERS) else() list(APPEND _HEADERS "${_HEADER}") @@ -280,10 +268,6 @@ macro(module) set(_HDR_STAGE_DIR "${_HEADER_OUTPUT_DIR}") stage_headers("${_ABS_HEADER_NAMES}" "${_HDR_STAGE_DIR}" "${_LIB_NAME}" "") - if (ENABLE_STATIC) - stage_headers("${_ABS_HEADER_NAMES}" "${_HDR_STAGE_DIR}" - "${_LIB_NAME}_static" "") - endif() endif() endif() endmacro() @@ -310,14 +294,20 @@ macro(executable) if (_ARG_LINK) target_link_libraries(${_ARG_NAME} ${_ARG_LINK}) endif() - if (ENABLE_STATIC AND _ARG_STATIC) - set(TARGET_SUFFIX _static) - endif() foreach(_DEP ${_ARG_DEPENDS_ON}) - target_link_libraries(${_ARG_NAME} ${_DEP}${TARGET_SUFFIX}) + target_link_libraries(${_ARG_NAME} ${_DEP}) endforeach() if (ENABLE_STATIC AND _ARG_STATIC) target_link_libraries(${_ARG_NAME} ${STATIC_LIBRARIES}) + if (OST_GCC_45) + set_target_properties(${_ARG_NAME} + PROPERTIES LINK_SEARCH_END_STATIC TRUE + LINK_FLAGS "-static-libgcc -static-libstdc++ -static -pthread") + else() + set_target_properties(${_ARG_NAME} + PROPERTIES LINK_SEARCH_END_STATIC TRUE + LINK_FLAGS "-static-libgcc -static -pthread") + endif() endif() install(TARGETS ${_ARG_NAME} DESTINATION bin) endmacro() @@ -348,11 +338,13 @@ macro(executable_libexec) target_link_libraries(${_ARG_NAME} ${_ARG_LINK}) endif() if (ENABLE_STATIC AND _ARG_STATIC) - set(TARGET_SUFFIX _static) target_link_libraries(${_ARG_NAME} ${STATIC_LIBRARIES}) + set_target_properties(${_ARG_NAME} + PROPERTIES LINK_SEARCH_END_STATIC TRUE) + endif() foreach(_DEP ${_ARG_DEPENDS_ON}) - target_link_libraries(${_ARG_NAME} ${_DEP}${TARGET_SUFFIX}) + target_link_libraries(${_ARG_NAME} ${_DEP}) endforeach() install(TARGETS ${_ARG_NAME} DESTINATION ${LIBEXEC_PATH}) endmacro() @@ -509,14 +501,18 @@ macro(pymod) endif() target_link_libraries("_${_LIB_NAME}" ${_PARENT_LIB_NAME} ${PYTHON_LIBRARIES} ${BOOST_PYTHON_LIBRARIES}) - if (_USE_RPATH) - set_target_properties("_${_LIB_NAME}" - PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR} - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") - else() - set_target_properties("_${_LIB_NAME}" - PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR} - INSTALL_RPATH "") + + set_target_properties("_${_LIB_NAME}" + PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR}) + + if (NOT ENABLE_STATIC) + if (_USE_RPATH) + set_target_properties("_${_LIB_NAME}" + PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") + else() + set_target_properties("_${_LIB_NAME}" + PROPERTIES INSTALL_RPATH "") + endif() endif() if (APPLE) file(RELATIVE_PATH _REL_PATH "${PYMOD_STAGE_DIR}" "${LIB_STAGE_PATH}") @@ -592,7 +588,6 @@ macro(pymod) add_dependencies("_${_LIB_NAME}" "_${dep}") endforeach() endif() - endmacro() add_custom_target(check) @@ -855,7 +850,7 @@ macro(setup_compiler_flags) endif() endif() endmacro() -set(_BOOST_MIN_VERSION 1.37) +set(_BOOST_MIN_VERSION 1.31) macro(setup_boost) find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS python REQUIRED) diff --git a/modules/base/pymod/CMakeLists.txt b/modules/base/pymod/CMakeLists.txt index 0e9213ba1..6a011018f 100644 --- a/modules/base/pymod/CMakeLists.txt +++ b/modules/base/pymod/CMakeLists.txt @@ -4,7 +4,8 @@ set(OST_BASE_PYMOD_SOURCES export_range.cc export_units.cc ) - -pymod(NAME base OUTPUT_DIR ost - CPP ${OST_BASE_PYMOD_SOURCES} - PY __init__.py settings.py stutil.py table.py xmlrunner.py testutils.py) +if (NOT ENABLE_STATIC) + pymod(NAME base OUTPUT_DIR ost + CPP ${OST_BASE_PYMOD_SOURCES} + PY __init__.py settings.py stutil.py table.py xmlrunner.py testutils.py) +endif() diff --git a/modules/conop/pymod/CMakeLists.txt b/modules/conop/pymod/CMakeLists.txt index 650939bfd..c1bf89d0e 100644 --- a/modules/conop/pymod/CMakeLists.txt +++ b/modules/conop/pymod/CMakeLists.txt @@ -8,4 +8,6 @@ set(OST_CONOP_PYMOD_SOURCES export_ring_finder.cc ) -pymod(NAME conop CPP ${OST_CONOP_PYMOD_SOURCES} PY __init__.py cleanup.py) +if (NOT ENABLE_STATIC) + pymod(NAME conop CPP ${OST_CONOP_PYMOD_SOURCES} PY __init__.py cleanup.py) +endif() diff --git a/modules/db/src/CMakeLists.txt b/modules/db/src/CMakeLists.txt index 7ccafdebd..8da34460b 100644 --- a/modules/db/src/CMakeLists.txt +++ b/modules/db/src/CMakeLists.txt @@ -12,7 +12,8 @@ sqlite3.c module(NAME db SOURCES ${OST_DB_SOURCES} HEADERS ${OST_DB_HEADERS} DEPENDS_ON ost_base) +add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION) if(WIN32) set_target_properties(ost_db PROPERTIES LINK_FLAGS "/DEF:sqlite3.def") add_definitions(/DSQLITE_ENABLE_COLUMN_METADATA) -endif(WIN32) \ No newline at end of file +endif(WIN32) diff --git a/modules/geom/pymod/CMakeLists.txt b/modules/geom/pymod/CMakeLists.txt index 240dd87a2..f79aeac4c 100644 --- a/modules/geom/pymod/CMakeLists.txt +++ b/modules/geom/pymod/CMakeLists.txt @@ -16,4 +16,6 @@ set(OST_GEOM_PYMOD_SOURCES export_quat.cc ) -pymod(NAME geom CPP ${OST_GEOM_PYMOD_SOURCES} PY __init__.py) \ No newline at end of file +if (NOT ENABLE_STATIC) + pymod(NAME geom CPP ${OST_GEOM_PYMOD_SOURCES} PY __init__.py) +endif() diff --git a/modules/img/alg/pymod/CMakeLists.txt b/modules/img/alg/pymod/CMakeLists.txt index c257040e5..be68daec5 100644 --- a/modules/img/alg/pymod/CMakeLists.txt +++ b/modules/img/alg/pymod/CMakeLists.txt @@ -6,5 +6,7 @@ export_transcendentals.cc export_polar.cc ) -pymod(NAME img_alg OUTPUT_DIR ost/img/alg CPP ${OST_IMG_ALG_PYMOD_SOURCES} - PY __init__.py) +if (NOT ENABLE_STATIC) + pymod(NAME img_alg OUTPUT_DIR ost/img/alg CPP ${OST_IMG_ALG_PYMOD_SOURCES} + PY __init__.py) +endif() diff --git a/modules/img/base/pymod/CMakeLists.txt b/modules/img/base/pymod/CMakeLists.txt index aecb5eeb9..de787d140 100644 --- a/modules/img/base/pymod/CMakeLists.txt +++ b/modules/img/base/pymod/CMakeLists.txt @@ -16,5 +16,7 @@ export_map.cc wrap_img.cc ) -pymod(NAME img OUTPUT_DIR ost/img - CPP ${OST_IMG_PYMOD_SOURCES} PY __init__.py) +if (NOT ENABLE_STATIC) + pymod(NAME img OUTPUT_DIR ost/img + CPP ${OST_IMG_PYMOD_SOURCES} PY __init__.py) +endif() diff --git a/modules/io/pymod/CMakeLists.txt b/modules/io/pymod/CMakeLists.txt index 38f43cdfa..007569fff 100644 --- a/modules/io/pymod/CMakeLists.txt +++ b/modules/io/pymod/CMakeLists.txt @@ -14,10 +14,11 @@ set(OST_IO_PYMOD_MODULES repository.py ) - -pymod(NAME io CPP ${OST_IO_PYMOD_SOURCES} PY ${OST_IO_PYMOD_MODULES}) -if (STATIC_LIBRARIES) - message("adding zlib libraries") - target_link_libraries(_ost_io ${ZLIB_LIBRARIES}) +if (NOT ENABLE_STATIC) + pymod(NAME io CPP ${OST_IO_PYMOD_SOURCES} PY ${OST_IO_PYMOD_MODULES}) + if (STATIC_LIBRARIES) + message("adding zlib libraries") + target_link_libraries(_ost_io ${ZLIB_LIBRARIES}) + endif() endif() diff --git a/modules/io/tests/testfiles/pdb/simple_defective.pdb b/modules/io/tests/testfiles/pdb/simple_defective.pdb new file mode 100644 index 000000000..725b68dba --- /dev/null +++ b/modules/io/tests/testfiles/pdb/simple_defective.pdb @@ -0,0 +1,67 @@ +HELIX 1 1 ARG A 15 GLU A 28 1 14 +HELIX 2 2 ASN A 38 GLY A 50 1 13 +SHEET 1 A 7 ALA A 53 ALA A 57 0 +SHEET 2 A 7 ALA A 30 ASP A 36 1 N ILE A 34 O CYS A 54 +CRYST1 67.465 67.465 191.044 90.00 90.00 120.00 P 31 2 1 12 +ATOM 1 N MET A 1 21.609 35.384 56.705 1.00 41.48 N +ATOM 2 CA MET A 1 20.601 35.494 57.793 1.00 41.58 C +ATOM 3 C MET A 1 19.654 34.300 57.789 1.00 39.51 C +ATOM 4 O MET A 1 18.447 34.456 57.595 1.00 38.98 O +ATOM 5 CB MET A 1 19.789 36.783 57.639 1.00 45.90 C +ATOM 6 CG MET A 1 20.629 38.055 57.606 1.00 51.18 C +ATOM 7 SD MET A 1 21.638 38.325 59.084 1.00 55.83 S +ATOM 8 CE MET A 1 23.233 37.697 58.529 1.00 54.59 C +ATOM 9 N ARG A 2 20.202 33.112 58.011 1.00 36.39 N +ATOM 10 CA ARG A 2 19.396 31.903 58.033 1.00 34.35 C +ATOM 11 C ARG A 2 18.608 31.739 59.328 1.00 34.20 C +ATOM 12 O ARG A 2 17.651 30.965 59.381 1.00 32.64 O +ATOM 13 CB ARG A 2 20.284 30.681 57.801 1.00 33.48 C +ATOM 14 CG ARG A 2 20.665 30.488 56.342 1.00 31.69 C +ATOM 15 CD ARG A 2 21.557 29.281 56.154 1.00 29.91 C +ATOM 16 NE ARG A 2 22.931 29.557 56.551 1.00 28.95 N +ATOM 17 CZ ARG A 2 23.901 28.653 56.528 1.00 30.21 C +ATOM 18 NH1 ARG A 2 23.640 27.417 56.130 1.00 32.54 N +ATOM 19 NH2 ARG A 2 25.132 28.980 56.893 1.00 29.14 N +ATOM 20 N LEU A 3 19.003 32.473 60.366 1.00 35.07 N +ATOM 21 CA LEU A 3 18.330 32.402 61.664 1.00 34.70 C +ATOM 22 C LEU A 3 17.884 33.787 62.117 1.00 35.41 C +ATOM 23 O LEU A 3 17.853 34.091 63.308 1.00 35.91 O +ATOM 24 CB LEU A 3 19.269 31.793 102.710 1.00 31.47 C +ATOM 25 CG LEU A 3 19.695 30.340 62.501 1.00 29.10 C +ATOM 26 CD1 LEU A 3 20.585 29.897 63.648 1.00 26.97 C +ATOM 27 CD2 LEU A 3 18.461 29.459 62.420 1.00 27.95 C +ATOM 1881 N MET A 255 29.709 5.069 60.642 1.00 26.34 N +ATOM 1882 CA MET A 255 28.701 5.164 59.592 1.00 27.93 C +ATOM 1883 C MET A 255 27.302 4.748 60.005 1.00 27.64 C +ATOM 1884 O MET A 255 27.057 3.586 60.326 1.00 29.54 O +ATOM 1885 CB MET A 255 29.146 4.331 58.399 1.00 28.54 C +ATOM 1886 CG MET A 255 30.558 4.642 57.948 1.00 30.99 C +ATOM 1887 SD MET A 255 31.116 3.394 56.790 1.00 34.74 S +ATOM 1888 CE MET A 255 31.526 2.062 57.912 1.00 35.45 C +ATOM 1889 N SER A 256 26.376 5.699 59.965 1.00 26.90 N +ATOM 1890 CA SER A 256 24.998 5.430 60.347 1.00 28.27 C +ATOM 1891 C SER A 256 24.040 5.839 59.231 1.00 28.44 C +ATOM 1892 O SER A 256 24.543 6.294 58.186 1.00 28.92 O +ATOM 1893 CB SER A 256 24.664 6.188 61.642 1.00 28.64 C +ATOM 1894 OG SER A 256 25.569 5.836 62.681 1.00 28.28 O +ATOM 1895 OXT SER A 256 22.811 5.701 59.408 1.00 27.92 O +TER 1896 SER A 256 +ATOM 1897 N MET B 1 22.333 -31.975 81.215 1.00 44.89 N +ATOM 1898 CA MET B 1 23.104 -30.998 82.028 1.00 43.40 C +ATOM 1899 C MET B 1 24.121 -30.191 81.211 1.00 40.48 C +ATOM 1900 O MET B 1 25.266 -30.614 81.040 1.00 38.97 O +ATOM 1901 CB MET B 1 23.828 -31.727 83.164 1.00 48.82 C +ATOM 1902 CG MET B 1 23.086 -31.723 84.500 1.00 55.57 C +ATOM 1903 SD MET B 1 21.607 -32.746 84.539 1.00 63.93 S +ATOM 1904 CE MET B 1 21.996 -33.836 85.950 1.00 64.69 C +ATOM 3785 N SER B 256 17.566 -6.734 64.432 1.00 23.90 N +ATOM 3786 CA SER B 256 18.942 -6.278 64.584 1.00 23.46 C +ATOM 3787 C SER B 256 19.884 -7.335 64.032 1.00 23.50 C +ATOM 3788 O SER B 256 19.390 -8.439 63.723 1.00 25.09 O +ATOM 3789 CB SER B 256 19.253 -6.025 66.064 1.00 22.10 C +ATOM 3790 OG SER B 256 18.279 -5.173 66.635 1.00 18.70 O +ATOM 3791 OXT SER B 256 21.095 -7.051 63.923 1.00 22.97 O +TER 3792 SER B 256 +HETATM 3793 O HOH 1 14.659 7.548 75.525 1.00 6.25 O +HETATM 3794 O HOH 2 29.166 1.788 77.529 1.00 15.43 O +END diff --git a/modules/mol/alg/pymod/CMakeLists.txt b/modules/mol/alg/pymod/CMakeLists.txt index 0ffb3f651..b4f97c5cb 100644 --- a/modules/mol/alg/pymod/CMakeLists.txt +++ b/modules/mol/alg/pymod/CMakeLists.txt @@ -19,7 +19,7 @@ if (ENABLE_IMG) ) endif() - -pymod(NAME mol_alg OUTPUT_DIR ost/mol/alg CPP ${OST_MOL_ALG_PYMOD_SOURCES} - PY ${OST_MOL_ALG_PYMOD_MODULES}) - +if (NOT ENABLE_STATIC) + pymod(NAME mol_alg OUTPUT_DIR ost/mol/alg CPP ${OST_MOL_ALG_PYMOD_SOURCES} + PY ${OST_MOL_ALG_PYMOD_MODULES}) +endif() diff --git a/modules/mol/base/pymod/CMakeLists.txt b/modules/mol/base/pymod/CMakeLists.txt index 87369f260..3f514b2b8 100644 --- a/modules/mol/base/pymod/CMakeLists.txt +++ b/modules/mol/base/pymod/CMakeLists.txt @@ -22,4 +22,6 @@ wrap_mol.cc export_entity_property_mapper.cc ) -pymod(NAME mol CPP ${OST_BASE_PYMOD_SOURCES} PY __init__.py) +if (NOT ENABLE_STATIC) + pymod(NAME mol CPP ${OST_BASE_PYMOD_SOURCES} PY __init__.py) +endif() diff --git a/modules/seq/alg/pymod/CMakeLists.txt b/modules/seq/alg/pymod/CMakeLists.txt index dfe07488e..0821b510a 100644 --- a/modules/seq/alg/pymod/CMakeLists.txt +++ b/modules/seq/alg/pymod/CMakeLists.txt @@ -1,7 +1,8 @@ set(OST_SEQ_ALG_PYMOD_SOURCES wrap_seq_alg.cc ) - -pymod(NAME seq_alg OUTPUT_DIR ost/seq/alg - CPP ${OST_SEQ_ALG_PYMOD_SOURCES} - PY __init__.py mat.py renumber.py) +if (NOT ENABLE_STATIC) + pymod(NAME seq_alg OUTPUT_DIR ost/seq/alg + CPP ${OST_SEQ_ALG_PYMOD_SOURCES} + PY __init__.py mat.py renumber.py) +endif() diff --git a/modules/seq/base/pymod/CMakeLists.txt b/modules/seq/base/pymod/CMakeLists.txt index af105daed..f2aac4ea5 100644 --- a/modules/seq/base/pymod/CMakeLists.txt +++ b/modules/seq/base/pymod/CMakeLists.txt @@ -3,4 +3,6 @@ set(OST_SEQ_PYMOD_SOURCES wrap_seq.cc ) -pymod(NAME seq CPP ${OST_SEQ_PYMOD_SOURCES} PY __init__.py) +if (NOT ENABLE_STATIC) + pymod(NAME seq CPP ${OST_SEQ_PYMOD_SOURCES} PY __init__.py) +endif() diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index f71f15327..306599ee7 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -11,32 +11,34 @@ else() add_dependencies(ost_scripts _ost_io) endif() -if(WIN32) - script(NAME dng.bat INPUT dng.bat.in SUBSTITUTE ${SUBST_DICT} - TARGET ost_scripts) - script(NAME ost.bat INPUT ost.bat.in SUBSTITUTE ${SUBST_DICT} - TARGET ost_scripts) - script(NAME gipltng.bat INPUT gipltng.bat.in SUBSTITUTE ${SUBST_DICT}) -else() - script(NAME ost_config INPUT ost_config.in SUBSTITUTE ${SUBST_DICT} - TARGET ost_scripts OUTPUT_DIR ${LIBEXEC_PATH}) - script(NAME ost INPUT ost.in SUBSTITUTE ${SUBST_DICT} - TARGET ost_scripts) - if (ENABLE_GUI) - script(NAME dng INPUT dng.in SUBSTITUTE ${SUBST_DICT} +if (NOT ENABLE_STATIC) + if(WIN32) + script(NAME dng.bat INPUT dng.bat.in SUBSTITUTE ${SUBST_DICT} + TARGET ost_scripts) + script(NAME ost.bat INPUT ost.bat.in SUBSTITUTE ${SUBST_DICT} TARGET ost_scripts) + script(NAME gipltng.bat INPUT gipltng.bat.in SUBSTITUTE ${SUBST_DICT}) + else() + script(NAME ost_config INPUT ost_config.in SUBSTITUTE ${SUBST_DICT} + TARGET ost_scripts OUTPUT_DIR ${LIBEXEC_PATH}) + script(NAME ost INPUT ost.in SUBSTITUTE ${SUBST_DICT} + TARGET ost_scripts) + if (ENABLE_GUI) + script(NAME dng INPUT dng.in SUBSTITUTE ${SUBST_DICT} + TARGET ost_scripts) + endif() endif() -endif() -set(INIT_SCRIPTS - init_cl.py -) + set(INIT_SCRIPTS + init_cl.py + ) -if (ENABLE_GUI) - list(APPEND INIT_SCRIPTS init.py) -endif() -copy_if_different("./" "${STAGE_DIR}/${LIB_DIR}/openstructure" + if (ENABLE_GUI) + list(APPEND INIT_SCRIPTS init.py) + endif() + copy_if_different("./" "${STAGE_DIR}/${LIB_DIR}/openstructure" "${INIT_SCRIPTS}" "python init scripts" ost_scripts) -install(FILES ${INIT_SCRIPTS} DESTINATION "${LIB_DIR}/openstructure") + install(FILES ${INIT_SCRIPTS} DESTINATION "${LIB_DIR}/openstructure") +endif() diff --git a/scripts/README.txt b/scripts/README.txt new file mode 100644 index 000000000..5258171c4 --- /dev/null +++ b/scripts/README.txt @@ -0,0 +1,10 @@ +1. Setup the rpm build environment (See guides on the web) +2. Checkout openstructure source in a fodler called 'openstructure-1.1d' +3. Copy the compounds.chemlib into the folder +4. Remove '.git' and '.gitignore' from the folder +5. COmpress the source with 'tar -cJvf openstructuere.tar.xz openstructure-1.1d' +6. Put the zipped source in '~/rpmbuild/SOURCES' +7. Put the desktop file in '~/rpmbuild/SOURCES' +8. Put the spec file in '~/rpmbuild/SPECS' +9. Go the the 'SPECS' directory and build with 'rpmbuild -ba openstructure.spec' + -- GitLab