From f17d0eaf5a9ddc1c8802fdf891df1ab3d2f4d7d7 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Mon, 21 Mar 2011 09:56:24 -0400
Subject: [PATCH] changed cmake scripts to allow building as subproject / moved
 common configuration from startup scripts to separate script

---
 CMakeLists.txt                            |  4 +-
 cmake_support/Deployment.cmake            |  8 +-
 cmake_support/FindPython.cmake            |  2 +-
 cmake_support/OST.cmake                   | 91 +++++++++++++++--------
 modules/base/pymod/__init__.py            |  2 +-
 modules/base/pymod/wrap_base.cc           |  2 +-
 modules/base/src/CMakeLists.txt           |  2 +-
 modules/conop/pymod/__init__.py           |  2 +-
 modules/conop/pymod/wrap_conop.cc         |  2 +-
 modules/conop/src/CMakeLists.txt          |  4 +-
 modules/db/src/CMakeLists.txt             |  2 +-
 modules/geom/pymod/__init__.py            |  2 +-
 modules/geom/pymod/wrap_geom.cc           |  2 +-
 modules/gfx/pymod/__init__.py             |  4 +-
 modules/gfx/pymod/export_glwin_base.cc    |  2 -
 modules/gfx/pymod/wrap_gfx.cc             |  2 +-
 modules/gfx/src/CMakeLists.txt            |  4 +-
 modules/gui/pymod/CMakeLists.txt          |  6 +-
 modules/gui/pymod/__init__.py             |  2 +-
 modules/gui/pymod/wrap_gui.cc             |  2 +-
 modules/gui/src/CMakeLists.txt            |  4 +-
 modules/img/alg/pymod/__init__.py         |  2 +-
 modules/img/alg/pymod/wrap_alg.cc         |  2 +-
 modules/img/alg/pymod/wrap_tf.cc          |  2 +-
 modules/img/alg/src/CMakeLists.txt        |  2 +-
 modules/img/base/pymod/__init__.py        |  2 +-
 modules/img/base/pymod/wrap_img.cc        |  2 +-
 modules/img/base/src/CMakeLists.txt       |  2 +-
 modules/info/pymod/__init__.py            |  2 +-
 modules/info/pymod/wrap_info.cc           |  2 +-
 modules/info/src/CMakeLists.txt           |  2 +-
 modules/io/pymod/__init__.py              |  2 +-
 modules/io/pymod/wrap_io.cc               |  2 +-
 modules/io/src/CMakeLists.txt             |  4 +-
 modules/mol/alg/pymod/__init__.py         |  2 +-
 modules/mol/alg/pymod/wrap_mol_alg.cc     |  2 +-
 modules/mol/alg/src/CMakeLists.txt        |  6 +-
 modules/mol/alg/src/construct_cbeta.hh    |  2 +-
 modules/mol/base/pymod/__init__.py        |  2 +-
 modules/mol/base/pymod/wrap_mol.cc        |  2 +-
 modules/mol/base/src/CMakeLists.txt       |  2 +-
 modules/mol/base/src/impl/query_ast_fw.hh |  2 +-
 modules/seq/alg/pymod/__init__.py         |  2 +-
 modules/seq/alg/pymod/wrap_seq_alg.cc     |  2 +-
 modules/seq/alg/src/CMakeLists.txt        |  2 +-
 modules/seq/base/pymod/__init__.py        |  2 +-
 modules/seq/base/pymod/wrap_seq.cc        |  2 +-
 modules/seq/base/src/CMakeLists.txt       |  2 +-
 scripts/CMakeLists.txt                    |  4 +-
 scripts/dng.in                            | 21 +-----
 scripts/ost.in                            | 48 +-----------
 scripts/ost_config.in                     | 73 ++++++++++++++++++
 52 files changed, 199 insertions(+), 158 deletions(-)
 create mode 100644 scripts/ost_config.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 592751d5f..6252a54f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,10 +3,10 @@
 #-------------------------------------------------------------------------------
 
 cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake_support)
+project(OpenStructure CXX C)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake_support)
 include(OST)
 
-project(OpenStructure CXX C)
 
 option(USE_SHADER "whether to compile with shader support"
        OFF)
diff --git a/cmake_support/Deployment.cmake b/cmake_support/Deployment.cmake
index c8acd43f0..e4f6d949b 100644
--- a/cmake_support/Deployment.cmake
+++ b/cmake_support/Deployment.cmake
@@ -3,8 +3,8 @@ INCLUDE(InstallRequiredSystemLibraries)
 
 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenStructure Framework")
 set(CPACK_PACKAGE_VENDOR "2008-2010 -- The OpenStructure Team")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/ReadMe.txt")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/ReadMe.txt")
+set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
 set(CPACK_PACKAGE_VERSION_MAJOR "1")
 set(CPACK_PACKAGE_VERSION_MINOR "0")
 if (OST_REV)
@@ -18,7 +18,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "openstructure ${OST_VERSION}" )
 IF(WIN32 AND NOT UNIX)
 # There is a bug in NSI that does not handle full unix paths properly. Make
 # sure there is at least one set of four (4) backlashes.
-  set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/graphics/\\\\icon_32.png")
+  set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/graphics/\\\\icon_32.png")
   #set(CPACK_NSIS_INSTALLED_ICON_NAME "bin/\\\\gosty.exe")
   set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
   set(CPACK_NSIS_HELP_LINK "http:www.openstructure.org")
@@ -26,7 +26,7 @@ IF(WIN32 AND NOT UNIX)
   set(CPACK_NSIS_CONTACT "users@maillist.unibas.ch")
   set(CPACK_NSIS_MODIFY_PATH ON)
   set(CPACK_SOURCE_STRIP_FILES TRUE)
-  set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/graphics/\\\\icon_32.png")
+  set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/graphics/\\\\icon_32.png")
   set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "")
   set(CPACK_PACKAGE_EXECUTABLES "dng" "DNG")
   set(CPACK_PACKAGE_EXECUTABLES "gipltng" "gipltng")
diff --git a/cmake_support/FindPython.cmake b/cmake_support/FindPython.cmake
index 99faf54d8..66c62f51c 100644
--- a/cmake_support/FindPython.cmake
+++ b/cmake_support/FindPython.cmake
@@ -93,7 +93,7 @@ endmacro()
 #-------------------------------------------------------------------------------
 macro(check_for_python_lib)
   if(PYTHON_VERSION)
-    _find_python_lib("${PYTHON_ROOT}" "${PYTHON_VERSION}")
+    _find_python("${PYTHON_ROOT}" "${PYTHON_VERSION}")
   else()
     foreach(_VERSION ${PYTHON_VERSIONS})
      if(${PYTHON_MIN_VERSION} VERSION_LESS ${_VERSION})
diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake
index 10ec36703..0439fbb67 100644
--- a/cmake_support/OST.cmake
+++ b/cmake_support/OST.cmake
@@ -206,7 +206,7 @@ macro(module)
                             ARCHIVE_OUTPUT_DIRECTORY ${LIB_STAGE_PATH}
                             RUNTIME_OUTPUT_DIRECTORY ${LIB_STAGE_PATH})
       foreach(_DEPENDENCY ${_ARG_DEPENDS_ON})
-        target_link_libraries(${_LIB_NAME}_static ost_${_DEPENDENCY}_static)
+        target_link_libraries(${_LIB_NAME}_static ${_DEPENDENCY}_static)
       endforeach()
       target_link_libraries(${_LIB_NAME} ${ZLIB_LIBRARIES})
     endif()
@@ -225,7 +225,7 @@ macro(module)
       target_link_libraries(${_LIB_NAME} ${_ARG_LINK})
     endif()
     foreach(_DEPENDENCY ${_ARG_DEPENDS_ON})
-      target_link_libraries(${_LIB_NAME} ost_${_DEPENDENCY})
+      target_link_libraries(${_LIB_NAME} ${_DEPENDENCY})
     endforeach()
   else()
     add_custom_target("${_LIB_NAME}" ALL)
@@ -304,7 +304,7 @@ macro(executable)
     target_link_libraries(${_ARG_NAME} ${STATIC_LIBRARIES})
   endif()
   foreach(_DEP ${_ARG_DEPENDS_ON})
-    target_link_libraries(${_ARG_NAME} ost_${_DEP}${TARGET_SUFFIX})
+    target_link_libraries(${_ARG_NAME} ${_DEP}${TARGET_SUFFIX})
   endforeach()
   install(TARGETS ${_ARG_NAME} DESTINATION bin)
 endmacro()
@@ -362,10 +362,39 @@ macro(script)
   add_dependencies(${_ARG_TARGET} subst_${_ARG_NAME})
 endmacro()
 
+#-------------------------------------------------------------------------------
+# Synopsis:
+#   ui_to_python(module out_files [input_file1 ...])
+# Description:
+#   Calls pyuic on every input file. The resulting python files are stored in
+#   the variable with name out_files.
+#-------------------------------------------------------------------------------
+macro(ui_to_python module out_files)
+  set(_input_files ${ARGN})
+  find_program(_PYUIC_EXECUTABLE
+    NAMES pyuic4-${PYTHON_VERSION} pyuic4 pyuic
+    PATHS  ENV PATH 
+  )  
+  if(NOT _PYUIC_EXECUTABLE)
+    message(FATAL_ERROR "Could not find pyuic command in " ${QT_BINARY_DIR} " for python version " ${PYTHON_VERSION})
+  endif(NOT _PYUIC_EXECUTABLE)
+
+  foreach(input_file ${_input_files})
+    get_filename_component(_out_file ${input_file} NAME_WE)
+    get_filename_component(_in_file ${input_file} ABSOLUTE)
+    set(_out_file ${CMAKE_CURRENT_SOURCE_DIR}/${_out_file}_ui.py)
+    add_custom_command(TARGET ${module}
+                       COMMAND ${_PYUIC_EXECUTABLE} -o ${_out_file} ${_in_file}
+                       VERBATIM DEPENDS ${input_file}
+                       )
+    list(APPEND ${out_files} ${_out_file})
+  endforeach()
+endmacro()
+
 #-------------------------------------------------------------------------------
 # Synopsis:
 #   pymod(NAME name CPP source1 source2 PY source source2 [IN_DIR dir] 
-#         source3 source4 [IN_DIR dir] [LINK link] [OUTPUT_DIR dir])
+#         source3 source4 [IN_DIR dir] [LINK link] [OUTPUT_DIR dir] [UI user_interface_files])
 #
 # Description:
 #  Define a python module consisting of C++ type wrappers and/or code written in 
@@ -378,27 +407,24 @@ macro(pymod)
   #-----------------------------------------------------------------------------
   set(_ARG_PREFIX ost)
   parse_argument_list(_ARG 
-                      "NAME;CPP;PY;LINK;OUTPUT_DIR;PREFIX" "" ${ARGN})
+                      "NAME;CPP;PY;LINK;OUTPUT_DIR;UI;PREFIX" "" ${ARGN})
   if (NOT _ARG_NAME)
     message(FATAL_ERROR "invalid use of pymod(): a name must be provided")
   endif()
   if (_ARG_OUTPUT_DIR)
     set(PYMOD_DIR "openstructure/${_ARG_OUTPUT_DIR}")
   else()
-    if (_ARG_PREFIX)
-        set(PYMOD_DIR "openstructure/${_ARG_PREFIX}/${_ARG_NAME}")
-    else()
-      set(PYMOD_DIR "openstructure/${_ARG_NAME}")
-    endif()
+    set(PYMOD_DIR "openstructure/${_ARG_PREFIX}/${_ARG_NAME}")
   endif()
+  set(_LIB_NAME ${_ARG_PREFIX}_${_ARG_NAME})
   set(PYMOD_STAGE_DIR "${LIB_STAGE_PATH}/${PYMOD_DIR}")
   file(MAKE_DIRECTORY ${PYMOD_STAGE_DIR})
   #-----------------------------------------------------------------------------
   # compile and link C++ wrappers
   #-----------------------------------------------------------------------------
   if (_ARG_CPP)
-    add_library("_${_ARG_NAME}" MODULE ${_ARG_CPP})
-    set_target_properties("_${_ARG_NAME}"
+    add_library("_${_LIB_NAME}" MODULE ${_ARG_CPP})
+    set_target_properties("_${_LIB_NAME}"
                           PROPERTIES ECHO_STRING
                           "Building Python Module ${_ARG_NAME}")
     if (_ARG_PREFIX)
@@ -410,41 +436,45 @@ macro(pymod)
     if (NOT _CUSTOM_CHECK)
       set(_PARENT_LIB_NAME "${_PARENT_NAME}")
     endif()
-    target_link_libraries("_${_ARG_NAME}" ${_PARENT_LIB_NAME} 
+    target_link_libraries("_${_LIB_NAME}" ${_PARENT_LIB_NAME} 
                           ${PYTHON_LIBRARIES} ${BOOST_PYTHON_LIBRARIES})
     if (_USE_RPATH)
-      set_target_properties("_${_ARG_NAME}"
+      set_target_properties("_${_LIB_NAME}"
                             PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR}
                             INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
     else()
-      set_target_properties("_${_ARG_NAME}"
+      set_target_properties("_${_LIB_NAME}"
                             PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR}
                             INSTALL_RPATH "")
     endif()
     if (APPLE)
       file(RELATIVE_PATH _REL_PATH "${PYMOD_STAGE_DIR}" "${LIB_STAGE_PATH}")
-      set_target_properties(_${_ARG_NAME} PROPERTIES
+      set_target_properties("_${_LIB_NAME}" PROPERTIES
                             LINK_FLAGS "-Wl,-rpath,@${_REL_PATH}"
                             INSTALL_NAME_DIR "@rpath")
     endif()                          
     if (NOT WIN32)
-      set_target_properties("_${_ARG_NAME}"
+      set_target_properties("_${_LIB_NAME}"
                           PROPERTIES PREFIX "")
     else ()
-      set_target_properties("_${_ARG_NAME}"
+      set_target_properties("_${_LIB_NAME}"
                           PROPERTIES PREFIX "../")
 
-      set_target_properties("_${_ARG_NAME}"
+      set_target_properties("_${_LIB_NAME}"
                           PROPERTIES SUFFIX ".pyd")
 
     endif()
-    install(TARGETS "_${_ARG_NAME}" LIBRARY DESTINATION
+    install(TARGETS "_${_LIB_NAME}" LIBRARY DESTINATION
             "${LIB_DIR}/${PYMOD_DIR}")
   else()
-    add_custom_target("_${_ARG_NAME}" ALL)
+    add_custom_target("_${_LIB_NAME}" ALL)
   endif()
-  if (_ARG_PY)
-    set(_PY_FILES)
+  set(_PY_FILES)  
+  if (_ARG_UI)
+    add_custom_target("${_LIB_NAME}_ui")    
+    ui_to_python("${_LIB_NAME}_ui" _PY_FILES ${_ARG_UI})
+  endif()  
+  if (_ARG_PY OR _PY_FILES)
     set(_EXPECT_IN_DIR FALSE)
     foreach(_PY_FILE ${_ARG_PY})
       if (_PY_FILE STREQUAL "IN_DIR")
@@ -472,10 +502,13 @@ macro(pymod)
       endif()
     endforeach()
     if (_PY_FILES)
-      add_custom_target("${_ARG_NAME}_pymod" ALL)
+      add_custom_target("${_LIB_NAME}_pymod" ALL)
+      if (_ARG_UI)
+        add_dependencies("${_LIB_NAME}_pymod" "${_LIB_NAME}_ui"})
+      endif()
       copy_if_different("./" "${PYMOD_STAGE_DIR}" "${_PY_FILES}" "TARGETS"
-                        "${_ARG_NAME}_pymod")
-      add_dependencies("_${_ARG_NAME}" "${_ARG_NAME}_pymod")
+                        "${_LIB_NAME}_pymod")
+      add_dependencies("_${_LIB_NAME}" "${_LIB_NAME}_pymod")
       include_directories(${PYTHON_INCLUDE_PATH})
       install(FILES ${_PY_FILES} DESTINATION "${LIB_DIR}/${PYMOD_DIR}")
       endif()
@@ -483,7 +516,7 @@ macro(pymod)
   get_target_property(_MOD_DEPS "${_PARENT_NAME}" MODULE_DEPS)
   if(_MOD_DEPS)
     foreach(dep ${_MOD_DEPS})
-       add_dependencies("_${_ARG_NAME}" "_${dep}")
+       add_dependencies("_${_LIB_NAME}" "_${dep}")
     endforeach()
   endif()
 
@@ -520,7 +553,7 @@ macro(ost_unittest MODULE SOURCE_FILES)
         add_executable(${_test_name} EXCLUDE_FROM_ALL ${_SOURCES})
       endif()
       if (WIN32)
-        target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES} "ost_${MODULE}")  
+        target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES} "${MODULE}")  
         add_custom_target("${_test_name}_run"
                         COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test_name}.exe || echo
                         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/..
@@ -529,7 +562,7 @@ macro(ost_unittest MODULE SOURCE_FILES)
         add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test_name}.exe)
       else()
         target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES}
-                            "ost_${MODULE}")
+                            "${MODULE}")
         add_custom_target("${_test_name}_run"
                         COMMAND OST_ROOT=${STAGE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} || echo 
                         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/modules/base/pymod/__init__.py b/modules/base/pymod/__init__.py
index 5457c46ca..8ecfacd79 100644
--- a/modules/base/pymod/__init__.py
+++ b/modules/base/pymod/__init__.py
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _base import *
+from _ost_base import *
 from stutil import *
 
 from ost import geom
diff --git a/modules/base/pymod/wrap_base.cc b/modules/base/pymod/wrap_base.cc
index 59c5a2333..1ba0b1571 100644
--- a/modules/base/pymod/wrap_base.cc
+++ b/modules/base/pymod/wrap_base.cc
@@ -38,7 +38,7 @@ void translator(const ost::Error& x) {
 }
 
 
-BOOST_PYTHON_MODULE(_base)
+BOOST_PYTHON_MODULE(_ost_base)
 {
   register_exception_translator<ost::Error>(&translator);
 
diff --git a/modules/base/src/CMakeLists.txt b/modules/base/src/CMakeLists.txt
index 682f926e5..6bc47461f 100644
--- a/modules/base/src/CMakeLists.txt
+++ b/modules/base/src/CMakeLists.txt
@@ -39,6 +39,6 @@ pair_to_tuple_conv.hh
 module(NAME base SOURCES ${OST_BASE_SOURCES} 
        HEADERS ${OST_EXPORT_HELPERS} IN_DIR export_helper 
        compare_files.hh IN_DIR test_utils ${OST_BASE_HEADERS}
-       DEPENDS_ON geom
+       DEPENDS_ON ost_geom
        HEADER_OUTPUT_DIR ost)
 
diff --git a/modules/conop/pymod/__init__.py b/modules/conop/pymod/__init__.py
index 6bccc9ee8..44aaed354 100644
--- a/modules/conop/pymod/__init__.py
+++ b/modules/conop/pymod/__init__.py
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _conop import *
+from _ost_conop import *
 
 def ConnectAll(ent):
   '''
diff --git a/modules/conop/pymod/wrap_conop.cc b/modules/conop/pymod/wrap_conop.cc
index 95cc7c3be..2aba86654 100644
--- a/modules/conop/pymod/wrap_conop.cc
+++ b/modules/conop/pymod/wrap_conop.cc
@@ -25,7 +25,7 @@ void export_Sanitizer();
 void export_Conop();
 void export_RingFinder();
 void export_AminoAcids();
-BOOST_PYTHON_MODULE(_conop)
+BOOST_PYTHON_MODULE(_ost_conop)
 {
   export_Builder();
   export_Conop();
diff --git a/modules/conop/src/CMakeLists.txt b/modules/conop/src/CMakeLists.txt
index 65201bea1..6ba838e74 100644
--- a/modules/conop/src/CMakeLists.txt
+++ b/modules/conop/src/CMakeLists.txt
@@ -23,9 +23,9 @@ ring_finder.cc
 )
 
 module(NAME conop SOURCES ${OST_CONOP_SOURCES}
-       HEADERS ${OST_CONOP_HEADERS} DEPENDS_ON mol geom db)
+       HEADERS ${OST_CONOP_HEADERS} DEPENDS_ON ost_mol ost_geom ost_db)
 
-executable(NAME chemdict_tool SOURCES chemdict_tool.cc DEPENDS_ON io STATIC)
+executable(NAME chemdict_tool SOURCES chemdict_tool.cc DEPENDS_ON ost_io STATIC)
 
 if (COMPOUND_LIB)
   if (EXISTS "${COMPOUND_LIB}")
diff --git a/modules/db/src/CMakeLists.txt b/modules/db/src/CMakeLists.txt
index 64e4375a9..7ccafdebd 100644
--- a/modules/db/src/CMakeLists.txt
+++ b/modules/db/src/CMakeLists.txt
@@ -11,7 +11,7 @@ sqlite3.c
 )
 
 module(NAME db SOURCES ${OST_DB_SOURCES} HEADERS ${OST_DB_HEADERS} 
-       DEPENDS_ON base)
+       DEPENDS_ON ost_base)
 if(WIN32)
   set_target_properties(ost_db PROPERTIES LINK_FLAGS "/DEF:sqlite3.def")
   add_definitions(/DSQLITE_ENABLE_COLUMN_METADATA)
diff --git a/modules/geom/pymod/__init__.py b/modules/geom/pymod/__init__.py
index 5ea879126..bd4691781 100644
--- a/modules/geom/pymod/__init__.py
+++ b/modules/geom/pymod/__init__.py
@@ -16,4 +16,4 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _geom import *
+from _ost_geom import *
diff --git a/modules/geom/pymod/wrap_geom.cc b/modules/geom/pymod/wrap_geom.cc
index e5b753e52..3c61a57c8 100644
--- a/modules/geom/pymod/wrap_geom.cc
+++ b/modules/geom/pymod/wrap_geom.cc
@@ -48,7 +48,7 @@ struct Axis_ {};
 #endif
 }
 
-BOOST_PYTHON_MODULE(_geom)
+BOOST_PYTHON_MODULE(_ost_geom)
 {
   export_Vec2();
   export_VecMat2_op();
diff --git a/modules/gfx/pymod/__init__.py b/modules/gfx/pymod/__init__.py
index 10afd277e..34bbee08c 100644
--- a/modules/gfx/pymod/__init__.py
+++ b/modules/gfx/pymod/__init__.py
@@ -1,7 +1,7 @@
 #------------------------------------------------------------------------------
 # This file is part of the OpenStructure project <www.openstructure.org>
 #
-# Copyright (C) 2008-2010 by the OpenStructure authors
+# Copyright (C) 2008-2011 by the OpenStructure authors
 #
 # This library is free software; you can redistribute it and/or modify it under
 # the terms of the GNU Lesser General Public License as published by the Free
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _gfx import *
+from _ost_gfx import *
 
 WHITE=Color(1.0,1.0,1.0)
 BLACK=Color(0.0,0.0,0.0)
diff --git a/modules/gfx/pymod/export_glwin_base.cc b/modules/gfx/pymod/export_glwin_base.cc
index 52ef3045f..a2cb803ba 100644
--- a/modules/gfx/pymod/export_glwin_base.cc
+++ b/modules/gfx/pymod/export_glwin_base.cc
@@ -35,5 +35,3 @@ void export_GLWinBase()
   ;
 }
 
-
-
diff --git a/modules/gfx/pymod/wrap_gfx.cc b/modules/gfx/pymod/wrap_gfx.cc
index 94e317421..c6b37a25b 100644
--- a/modules/gfx/pymod/wrap_gfx.cc
+++ b/modules/gfx/pymod/wrap_gfx.cc
@@ -68,7 +68,7 @@ float color_get_alpha(Color* c) {
 }
 
 
-BOOST_PYTHON_MODULE(_gfx)
+BOOST_PYTHON_MODULE(_ost_gfx)
 {
   export_Scene();
   export_GfxNode();
diff --git a/modules/gfx/src/CMakeLists.txt b/modules/gfx/src/CMakeLists.txt
index b34e424a1..b1f56c9cf 100644
--- a/modules/gfx/src/CMakeLists.txt
+++ b/modules/gfx/src/CMakeLists.txt
@@ -205,9 +205,9 @@ if (USE_SHADER)
   endif()  
 endif()
 
-set(OST_GFX_DEPENDENCIES "conop;seq")
+set(OST_GFX_DEPENDENCIES "ost_conop;ost_seq")
 if (ENABLE_IMG)
-  set(OST_GFX_DEPENDENCIES "${OST_GFX_DEPENDENCIES};img;img_alg")
+  set(OST_GFX_DEPENDENCIES "${OST_GFX_DEPENDENCIES};ost_img;ost_img_alg")
 endif()
 
 module(NAME gfx SOURCES ${OST_GFX_SOURCES} ${OST_GFX_MAP_SOURCES} 
diff --git a/modules/gui/pymod/CMakeLists.txt b/modules/gui/pymod/CMakeLists.txt
index a09c9c1e7..dc6329131 100644
--- a/modules/gui/pymod/CMakeLists.txt
+++ b/modules/gui/pymod/CMakeLists.txt
@@ -104,7 +104,7 @@ set(PRESET_FILES
   scene/loaders.xml
 )
 copy_if_different("./" "${STAGE_DIR}/share/openstructure/scene" 
-                  "${PRESET_FILES}" "IMMUTABLE_FILES" _gui)
+                  "${PRESET_FILES}" "IMMUTABLE_FILES" _ost_gui)
 install(FILES ${PRESET_FILES} DESTINATION "share/openstructure/scene")
 
 set(INSPECTOR_ICONS
@@ -114,11 +114,11 @@ set(INSPECTOR_ICONS
   scene/icons/tool_icon.png
 )
 copy_if_different("./" "${STAGE_DIR}/share/openstructure/scene/icons" 
-                  "${INSPECTOR_ICONS}" "ICONS_FOR_INSPECTOR" _gui)
+                  "${INSPECTOR_ICONS}" "ICONS_FOR_INSPECTOR" _ost_gui)
 install(FILES ${INSPECTOR_ICONS} DESTINATION "share/openstructure/scene/icons")
 
 set(QT_USE_QTOPENGL 1)
 set(QT_USE_QTNETWORK 1)
 include(${QT_USE_FILE})
 
-target_link_libraries(_gui ${QT_LIBRARIES})
+target_link_libraries(_ost_gui ${QT_LIBRARIES})
diff --git a/modules/gui/pymod/__init__.py b/modules/gui/pymod/__init__.py
index 86346306b..c54365524 100644
--- a/modules/gui/pymod/__init__.py
+++ b/modules/gui/pymod/__init__.py
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _gui import *
+from _ost_gui import *
 import sip
 
 
diff --git a/modules/gui/pymod/wrap_gui.cc b/modules/gui/pymod/wrap_gui.cc
index 19dc01702..81b6ff788 100644
--- a/modules/gui/pymod/wrap_gui.cc
+++ b/modules/gui/pymod/wrap_gui.cc
@@ -99,7 +99,7 @@ namespace {
 }
 using namespace ost::gui;
 
-BOOST_PYTHON_MODULE(_gui)
+BOOST_PYTHON_MODULE(_ost_gui)
 {
 
   boost::python::to_python_converter<QString, qstring_to_python_string>();
diff --git a/modules/gui/src/CMakeLists.txt b/modules/gui/src/CMakeLists.txt
index bbf5c38ad..7c8f6d640 100644
--- a/modules/gui/src/CMakeLists.txt
+++ b/modules/gui/src/CMakeLists.txt
@@ -452,7 +452,7 @@ module(NAME gui SOURCES ${OST_GUI_MOCS} ${OST_GUI_SOURCES}
                ${OST_GUI_INPUT_HEADERS}
                ${OST_GUI_DATA_VIEWER_HEADERS}
                ${OST_GUI_HEADERS}
-       DEPENDS_ON gfx io mol_alg seq_alg
+       DEPENDS_ON ost_gfx ost_io ost_mol_alg ost_seq_alg
        LINK ${QT_LIBRARIES} ${PYTHON_LIBRARIES} ${BOOST_PYTHON_LIBRARIES}
             ${SPNAV_LIBRARIES}
         NO_STATIC)
@@ -472,4 +472,4 @@ if (NOT WIN32)
 endif()
 
 executable(NAME gosty SOURCES gosty.cc ${OST_GOSTY_MOC} ${OST_QT_RESOURCE} 
-           DEPENDS_ON gui ${LINK})
+           DEPENDS_ON ost_gui ${LINK})
diff --git a/modules/img/alg/pymod/__init__.py b/modules/img/alg/pymod/__init__.py
index e8def65a4..d67a86754 100644
--- a/modules/img/alg/pymod/__init__.py
+++ b/modules/img/alg/pymod/__init__.py
@@ -16,4 +16,4 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _img_alg import *
+from _ost_img_alg import *
diff --git a/modules/img/alg/pymod/wrap_alg.cc b/modules/img/alg/pymod/wrap_alg.cc
index a4f18f028..f0faf8c13 100644
--- a/modules/img/alg/pymod/wrap_alg.cc
+++ b/modules/img/alg/pymod/wrap_alg.cc
@@ -122,7 +122,7 @@ Real real_spatial_cross_correlation_2(const ConstImageHandle& image1,
 
 } //anon ns
 
-BOOST_PYTHON_MODULE(_img_alg)
+BOOST_PYTHON_MODULE(_ost_img_alg)
 {
   class_<AutoCorrelate, bases<ConstModOPAlgorithm> >("AutoCorrelate",init<>());
 
diff --git a/modules/img/alg/pymod/wrap_tf.cc b/modules/img/alg/pymod/wrap_tf.cc
index f720d1dd5..cee27ebf1 100644
--- a/modules/img/alg/pymod/wrap_tf.cc
+++ b/modules/img/alg/pymod/wrap_tf.cc
@@ -56,7 +56,7 @@ void    (tf::FractionalShift::*setshift1)(Real,Real,Real)    = &tf::FractionalSh
 void    (tf::FractionalShift::*setshift2)(const Vec3&)                    = &tf::FractionalShift::SetShift;
 
 
-BOOST_PYTHON_MODULE(_tf)
+BOOST_PYTHON_MODULE(_ost_tf)
 {
   class_<tf::Transformation>("Transformation", init<>())
     .def(init<const Mat4&>())
diff --git a/modules/img/alg/src/CMakeLists.txt b/modules/img/alg/src/CMakeLists.txt
index 804cd683e..11fba15d4 100644
--- a/modules/img/alg/src/CMakeLists.txt
+++ b/modules/img/alg/src/CMakeLists.txt
@@ -97,5 +97,5 @@ include(${QT_USE_FILE})
 module(NAME img_alg SOURCES "${OST_IMG_ALG_SOURCES}" 
        HEADERS "${OST_IMG_ALG_HEADERS}" 
        HEADER_OUTPUT_DIR ost/img/alg
-       DEPENDS_ON img
+       DEPENDS_ON ost_img
        LINK ${FFTW_LIBRARIES} ${QT_QTCORE_LIBRARY})
diff --git a/modules/img/base/pymod/__init__.py b/modules/img/base/pymod/__init__.py
index 61f293be7..82a290219 100644
--- a/modules/img/base/pymod/__init__.py
+++ b/modules/img/base/pymod/__init__.py
@@ -16,6 +16,6 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _img import *
+from _ost_img import *
 MapHandle=ImageHandle
 from ost.img import alg
diff --git a/modules/img/base/pymod/wrap_img.cc b/modules/img/base/pymod/wrap_img.cc
index a959fd14a..a23f89745 100644
--- a/modules/img/base/pymod/wrap_img.cc
+++ b/modules/img/base/pymod/wrap_img.cc
@@ -55,7 +55,7 @@ void export_Progress();
 void export_Map();
 
 // actual module definitions
-BOOST_PYTHON_MODULE(_img)
+BOOST_PYTHON_MODULE(_ost_img)
 {
   export_Data();
   export_DataAlgorithm();
diff --git a/modules/img/base/src/CMakeLists.txt b/modules/img/base/src/CMakeLists.txt
index eba4707b0..d218ac2ad 100644
--- a/modules/img/base/src/CMakeLists.txt
+++ b/modules/img/base/src/CMakeLists.txt
@@ -106,4 +106,4 @@ module(NAME img SOURCES "${OST_IMG_SOURCES}"
        HEADERS ${OST_IMG_RASTER_IMAGE_HEADERS} IN_DIR raster_image
                 ${OST_IMG_IMAGE_STATE_HEADERS} IN_DIR image_state
                 ${OST_IMG_HEADERS}
-       DEPENDS_ON geom base info)
+       DEPENDS_ON ost_geom ost_base ost_info)
diff --git a/modules/info/pymod/__init__.py b/modules/info/pymod/__init__.py
index ee112a29a..4243e15ac 100644
--- a/modules/info/pymod/__init__.py
+++ b/modules/info/pymod/__init__.py
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _info import *
+from _ost_info import *
 
 def LoadOrCreateInfo(name):
     import os.path
diff --git a/modules/info/pymod/wrap_info.cc b/modules/info/pymod/wrap_info.cc
index 676e56f13..03106fd17 100644
--- a/modules/info/pymod/wrap_info.cc
+++ b/modules/info/pymod/wrap_info.cc
@@ -155,7 +155,7 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(hasitem_overloads, HasItem, 1, 2)
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(retrieveitem_overloads, RetrieveItem, 1, 2)
 
 
-BOOST_PYTHON_MODULE(_info)
+BOOST_PYTHON_MODULE(_ost_info)
 {
 
   enum_<Type>("ItemType")
diff --git a/modules/info/src/CMakeLists.txt b/modules/info/src/CMakeLists.txt
index 5755aa0e1..31d6db3b4 100644
--- a/modules/info/src/CMakeLists.txt
+++ b/modules/info/src/CMakeLists.txt
@@ -32,5 +32,5 @@ set(QT_USE_QTXML 1)
 include(${QT_USE_FILE})
 module(NAME info SOURCES ${OST_INFO_SOURCES}
        HEADERS ${OST_INFO_HEADERS}
-       DEPENDS_ON base LINK ${BOOST_REGEX_LIBRARIES} ${QT_LIBRARIES})
+       DEPENDS_ON ost_base LINK ${BOOST_REGEX_LIBRARIES} ${QT_LIBRARIES})
 
diff --git a/modules/io/pymod/__init__.py b/modules/io/pymod/__init__.py
index 3ff89c1ae..74047dec0 100644
--- a/modules/io/pymod/__init__.py
+++ b/modules/io/pymod/__init__.py
@@ -18,7 +18,7 @@
 #------------------------------------------------------------------------------
 import os, tempfile, ftplib, httplib
 
-from _io import *
+from _ost_io import *
 from ost import mol, conop
 
 profiles=None
diff --git a/modules/io/pymod/wrap_io.cc b/modules/io/pymod/wrap_io.cc
index a7fb82f7d..af5087cd2 100644
--- a/modules/io/pymod/wrap_io.cc
+++ b/modules/io/pymod/wrap_io.cc
@@ -75,7 +75,7 @@ void export_pdb_io();
 #if OST_IMG_ENABLED
 void export_map_io();
 #endif
-BOOST_PYTHON_MODULE(_io)
+BOOST_PYTHON_MODULE(_ost_io)
 {
   class_<IOManager, boost::noncopyable>("IOManager", no_init)
   ;
diff --git a/modules/io/src/CMakeLists.txt b/modules/io/src/CMakeLists.txt
index f61c471d3..08b65a7a2 100644
--- a/modules/io/src/CMakeLists.txt
+++ b/modules/io/src/CMakeLists.txt
@@ -50,9 +50,9 @@ foreach(fname ${OST_IO_SEQ_HEADERS})
 endforeach(fname ${OST_IO_SEQ_HEADERS})
 
 
-set(OST_IO_DEPENDENCIES base;conop;seq)
+set(OST_IO_DEPENDENCIES ost_base;ost_conop;ost_seq)
 if (ENABLE_IMG)
-  set(OST_IO_DEPENDENCIES ${OST_IO_DEPENDENCIES};img;img_alg)
+  set(OST_IO_DEPENDENCIES ${OST_IO_DEPENDENCIES};ost_img;ost_img_alg)
 endif()
 module(NAME io SOURCES "${OST_IO_SOURCES}" 
        HEADERS ${OST_IO_MOL_HEADERS} IN_DIR mol
diff --git a/modules/mol/alg/pymod/__init__.py b/modules/mol/alg/pymod/__init__.py
index 2e6198f81..f4e1fbc81 100644
--- a/modules/mol/alg/pymod/__init__.py
+++ b/modules/mol/alg/pymod/__init__.py
@@ -1 +1 @@
-from _mol_alg import *
+from _ost_mol_alg import *
diff --git a/modules/mol/alg/pymod/wrap_mol_alg.cc b/modules/mol/alg/pymod/wrap_mol_alg.cc
index 2d4098996..8d598b25d 100644
--- a/modules/mol/alg/pymod/wrap_mol_alg.cc
+++ b/modules/mol/alg/pymod/wrap_mol_alg.cc
@@ -40,7 +40,7 @@ mol::EntityView (*fc_a)(const mol::EntityView&, Real,bool)=&mol::alg::FilterClas
 mol::EntityView (*fc_b)(const mol::EntityHandle&, Real, bool)=&mol::alg::FilterClashes;
 }
 
-BOOST_PYTHON_MODULE(_mol_alg)
+BOOST_PYTHON_MODULE(_ost_mol_alg)
 {
   export_svdSuperPose();
   #if OST_IMG_ENABLED
diff --git a/modules/mol/alg/src/CMakeLists.txt b/modules/mol/alg/src/CMakeLists.txt
index f2a23bdd6..ae27e33e6 100644
--- a/modules/mol/alg/src/CMakeLists.txt
+++ b/modules/mol/alg/src/CMakeLists.txt
@@ -19,7 +19,7 @@ set(OST_MOL_ALG_SOURCES
   construct_cbeta.cc
 )
 
-set(MOL_ALG_DEPS mol seq)
+set(MOL_ALG_DEPS ost_mol ost_seq)
 
 if (ENABLE_IMG)
   set(OST_MOL_ALG_HEADERS
@@ -32,11 +32,11 @@ if (ENABLE_IMG)
     entity_to_density.cc
   )
 
-  set(MOL_ALG_DEPS ${MOL_ALG_DEPS} img img_alg)
+  set(MOL_ALG_DEPS ${MOL_ALG_DEPS} ost_img ost_img_alg)
 endif()
 
 executable(NAME ldt SOURCES ldt.cc 
-           DEPENDS_ON io mol_alg STATIC)
+           DEPENDS_ON ost_io ost_mol_alg STATIC)
 
 module(NAME mol_alg SOURCES ${OST_MOL_ALG_SOURCES}
        HEADERS ${OST_MOL_ALG_HEADERS}
diff --git a/modules/mol/alg/src/construct_cbeta.hh b/modules/mol/alg/src/construct_cbeta.hh
index 994dfd7a0..f67d3556d 100644
--- a/modules/mol/alg/src/construct_cbeta.hh
+++ b/modules/mol/alg/src/construct_cbeta.hh
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // This file is part of the OpenStructure project <www.openstructure.org>
 //
-// Copyright (C) 2008-2010 by the OpenStructure authors
+// Copyright (C) 2008-2011 by the OpenStructure authors
 //
 // This library is free software; you can redistribute it and/or modify it under
 // the terms of the GNU Lesser General Public License as published by the Free
diff --git a/modules/mol/base/pymod/__init__.py b/modules/mol/base/pymod/__init__.py
index 22c485bc0..75c503acf 100644
--- a/modules/mol/base/pymod/__init__.py
+++ b/modules/mol/base/pymod/__init__.py
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _mol import *
+from _ost_mol import *
 import ost.geom as _geom
 from ost.mol import alg
 
diff --git a/modules/mol/base/pymod/wrap_mol.cc b/modules/mol/base/pymod/wrap_mol.cc
index ee56770f1..0ab6b4568 100644
--- a/modules/mol/base/pymod/wrap_mol.cc
+++ b/modules/mol/base/pymod/wrap_mol.cc
@@ -43,7 +43,7 @@ void export_PropertyID();
 void export_BoundingBox();
 void export_QueryViewWrapper();
 void export_EntityPropertyMapper();
-BOOST_PYTHON_MODULE(_mol)
+BOOST_PYTHON_MODULE(_ost_mol)
 {
   enum_<EditMode>("EditMode")
     .value("BUFFERED_EDIT", BUFFERED_EDIT)
diff --git a/modules/mol/base/src/CMakeLists.txt b/modules/mol/base/src/CMakeLists.txt
index 0a4314041..b11b6e54c 100644
--- a/modules/mol/base/src/CMakeLists.txt
+++ b/modules/mol/base/src/CMakeLists.txt
@@ -100,4 +100,4 @@ endforeach()
 module(NAME mol SOURCES ${OST_MOL_SOURCES}
        HEADERS ${OST_MOL_IMPL_HEADERS} IN_DIR impl
        ${OST_MOL_HEADERS} HEADER_OUTPUT_DIR ost/mol
-       DEPENDS_ON geom base info)
+       DEPENDS_ON ost_geom ost_base ost_info)
diff --git a/modules/mol/base/src/impl/query_ast_fw.hh b/modules/mol/base/src/impl/query_ast_fw.hh
index 4d69a9bf6..3d0f106b5 100644
--- a/modules/mol/base/src/impl/query_ast_fw.hh
+++ b/modules/mol/base/src/impl/query_ast_fw.hh
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // This file is part of the OpenStructure project <www.openstructure.org>
 //
-// Copyright (C) 2008-2010 by the OpenStructure authors
+// Copyright (C) 2008-2011 by the OpenStructure authors
 //
 // This library is free software; you can redistribute it and/or modify it under
 // the terms of the GNU Lesser General Public License as published by the Free
diff --git a/modules/seq/alg/pymod/__init__.py b/modules/seq/alg/pymod/__init__.py
index ce80e939e..24e79daac 100644
--- a/modules/seq/alg/pymod/__init__.py
+++ b/modules/seq/alg/pymod/__init__.py
@@ -1,4 +1,4 @@
-from _seq_alg import *
+from _ost_seq_alg import *
 from ost.seq.alg.mat import *
 
 def AlignToSEQRES(chain, seqres):
diff --git a/modules/seq/alg/pymod/wrap_seq_alg.cc b/modules/seq/alg/pymod/wrap_seq_alg.cc
index c39a75a80..2694d132d 100644
--- a/modules/seq/alg/pymod/wrap_seq_alg.cc
+++ b/modules/seq/alg/pymod/wrap_seq_alg.cc
@@ -28,7 +28,7 @@ using namespace boost::python;
 using namespace ost::seq;
 using namespace ost::seq::alg;
 
-BOOST_PYTHON_MODULE(_seq_alg)
+BOOST_PYTHON_MODULE(_ost_seq_alg)
 {
   enum_<RefMode::Type>("RefMode")
     .value("ALIGNMENT", RefMode::ALIGNMENT)
diff --git a/modules/seq/alg/src/CMakeLists.txt b/modules/seq/alg/src/CMakeLists.txt
index 7b4f86f53..ee8392b12 100644
--- a/modules/seq/alg/src/CMakeLists.txt
+++ b/modules/seq/alg/src/CMakeLists.txt
@@ -17,6 +17,6 @@ conservation.cc
 )
 
 module(NAME seq_alg HEADER_OUTPUT_DIR ost/seq/alg SOURCES ${OST_SEQ_ALG_SOURCES}
-       HEADERS ${OST_SEQ_ALG_HEADERS} DEPENDS_ON seq)
+       HEADERS ${OST_SEQ_ALG_HEADERS} DEPENDS_ON ost_seq)
 
 
diff --git a/modules/seq/base/pymod/__init__.py b/modules/seq/base/pymod/__init__.py
index 3bada618a..1594a2553 100644
--- a/modules/seq/base/pymod/__init__.py
+++ b/modules/seq/base/pymod/__init__.py
@@ -16,7 +16,7 @@
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #------------------------------------------------------------------------------
-from _seq import *
+from _ost_seq import *
 from ost.seq import alg
 
 _CreateAlignment=CreateAlignment
diff --git a/modules/seq/base/pymod/wrap_seq.cc b/modules/seq/base/pymod/wrap_seq.cc
index 5170a035f..c881dae0a 100644
--- a/modules/seq/base/pymod/wrap_seq.cc
+++ b/modules/seq/base/pymod/wrap_seq.cc
@@ -21,7 +21,7 @@ using namespace boost::python;
 
 void export_sequence();
 
-BOOST_PYTHON_MODULE(_seq)
+BOOST_PYTHON_MODULE(_ost_seq)
 {
   export_sequence();
 
diff --git a/modules/seq/base/src/CMakeLists.txt b/modules/seq/base/src/CMakeLists.txt
index 9a7015bda..6a22a5ad2 100644
--- a/modules/seq/base/src/CMakeLists.txt
+++ b/modules/seq/base/src/CMakeLists.txt
@@ -32,5 +32,5 @@ views_from_sequences.cc
 module(NAME seq SOURCES ${OST_SEQ_SOURCES} 
        HEADERS ${OST_SEQ_IMPL_HEADERS} IN_DIR impl
                ${OST_SEQ_HEADERS}
-       DEPENDS_ON info mol)
+       DEPENDS_ON ost_info ost_mol)
 
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index ab3a32878..597d38ea1 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -18,12 +18,12 @@ if(WIN32)
          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)
   script(NAME ost INPUT ost.in SUBSTITUTE ${SUBST_DICT} 
          TARGET ost_scripts)
   script(NAME dng INPUT dng.in SUBSTITUTE ${SUBST_DICT}
          TARGET ost_scripts)
-  script(NAME gipltng INPUT gipltng.in SUBSTITUTE ${SUBST_DICT}
-         TARGET ost_scripts)
 endif()
 
 set(INIT_SCRIPTS 
diff --git a/scripts/dng.in b/scripts/dng.in
index 2d41fc631..529eaa71d 100755
--- a/scripts/dng.in
+++ b/scripts/dng.in
@@ -20,29 +20,12 @@
 # Startup script for a protein-centric user interface
 # Author: Marco Biasini
 
-# Self detect important directories
 if [ -h "$0" ] ; then
   SCRIPT_NAME=`readlink "$0"`
 else
   SCRIPT_NAME="$0"
 fi
 BIN_DIR=`dirname "$SCRIPT_NAME"`
-export DNG_ROOT=`cd "$BIN_DIR/..";pwd`
-export PATH="$DNG_ROOT/bin:$PATH"
-export LD_LIBRARY_PATH="$DNG_ROOT/@LIBDIR@:$LD_LIBRARY_PATH"
-# set QT_PLUGIN_PATH and pythonpath for bundle (commented except in linux bundles)
-#export PYTHONPATH="$DNG_ROOT/@LIBDIR@/python2.6"
-#export QT_PLUGIN_PATH="$BIN_DIR/plugins"
+source $BIN_DIR/ost_config
 
-opts=""
-for argument in "$@";do
-  if [ -n "$opts" ]; then
-    opts=$opts"#""$argument"
-  else
-    opts="$argument"
-  fi
-done
-
-IFS="#"
-gosty $DNG_ROOT/@LIBDIR@/openstructure/init.py ost $opts
-IFS=$' \t\n'
+$DNG_BINDIR/gosty $DNG_INITDIR/init.py ost $opts
diff --git a/scripts/ost.in b/scripts/ost.in
index 28bba9e1d..6f715fda0 100755
--- a/scripts/ost.in
+++ b/scripts/ost.in
@@ -28,57 +28,11 @@ else
   SCRIPT_NAME="$0"
 fi
 BIN_DIR=`dirname "$SCRIPT_NAME"`
-export DNG_ROOT=`cd "$BIN_DIR/..";pwd`
-export PATH="$DNG_ROOT/bin:$PATH"
-export DYLD_FRAMEWORK_PATH="$BIN_DIR/../@LIBDIR@:${DYLD_FRAMEWORK_PATH}"
-export DYLD_LIBRARY_PATH="$BIN_DIR/../@LIBDIR@:${DYLD_LIBRARY_PATH}"
 
-export LD_LIBRARY_PATH="$DNG_ROOT/@LIBDIR@:$LD_LIBRARY_PATH"
-# set QT_PLUGIN_PATH and pythonpath for bundle (commented except in linux bundles)
-#export QT_PLUGIN_PATH="$BIN_DIR/plugins"
-#export PYTHONPATH="$DNG_ROOT/@LIBDIR@/python2.6"
+source $BIN_DIR/ost_config
 
-# retrieve absolute path to python executable
-pyexec=""
-if [ -z "$DNG_ATTACH_VALGRIND" ]; then
-  pyexec="@PYTHON_BINARY@"
-else
-  pyexec="valgrind --leak-check=full @PYTHON_BINARY@"
-fi
-
-if [ ! -f "$pyexec" ]; then 
-  echo "Error: Python executable '$pyexec' not found!"
-  exit
-fi
-
-set -o noglob
-
-# decide whether to start interactively or not
-# interactive mode can be forced by setting -i as a ost_cl option
-interactive=""
-if [ $# == 0 ];then
-  interactive="-i"
-else
-  opts=""
-  for argument in "$@";do 
-    if [ -n "$opts" ]; then
-      opts=$opts"#""$argument"
-    else  
-      opts="$argument"
-    fi  
-  done
-  if [ $1 == "-i" ] ;then
-    interactive="-i"
-  fi
-  if [ $1 == "-v" ] ;then
-    interactive="-i"
-  fi
-fi
-# finally pass control to python instance
-IFS="#"
 $pyexec $interactive "$DNG_ROOT/@LIBDIR@/openstructure/init_cl.py" $opts
 RC=$?
-IFS=$' \t\n'
 exit $RC
 
 
diff --git a/scripts/ost_config.in b/scripts/ost_config.in
new file mode 100644
index 000000000..08ca7b502
--- /dev/null
+++ b/scripts/ost_config.in
@@ -0,0 +1,73 @@
+#!/bin/bash
+#------------------------------------------------------------------------------
+# This file is part of the OpenStructure project <www.openstructure.org>
+#
+# Copyright (C) 2008-2011 by the OpenStructure authors
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 3.0 of the License, or (at your option)
+# any later version.
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+#------------------------------------------------------------------------------
+# common config script
+# Authors: Marco Biasini, Andreas Schenk
+
+# Self detect important directories
+export DNG_ROOT=`cd "$BIN_DIR/..";pwd`
+export DNG_BINDIR="$DNG_ROOT/bin"
+export DNG_LIBDIR="$DNG_ROOT/@LIBDIR@"
+export DNG_INITDIR="$DNG_LIBDIR/openstructure"
+
+#export PATH="$DNG_BINDIR:$PATH"
+#export DYLD_FRAMEWORK_PATH="$BIN_LIBDIR:${DYLD_FRAMEWORK_PATH}"
+#export DYLD_LIBRARY_PATH="$BIN_LIBDIR:${DYLD_LIBRARY_PATH}"
+#export LD_LIBRARY_PATH="$DNG_LIBDIR:$LD_LIBRARY_PATH"
+# set QT_PLUGIN_PATH and pythonpath for bundle (commented except in linux bundles)
+#export PYTHONPATH="$DNG_ROOT/@LIBDIR@/python2.6"
+#export QT_PLUGIN_PATH="$BIN_DIR/plugins"
+
+# retrieve absolute path to python executable
+pyexec=""
+if [ -z "$DNG_ATTACH_VALGRIND" ]; then
+  pyexec="@PYTHON_BINARY@"
+else
+  pyexec="valgrind --leak-check=full @PYTHON_BINARY@"
+fi
+
+if [ ! -f "$pyexec" ]; then 
+  echo "Error: Python executable '$pyexec' not found!"
+  exit
+fi
+
+set -o noglob
+
+opts=""
+for argument in "$@";do
+  if [ -n "$opts" ]; then
+    opts=$opts"#""$argument"
+  else
+    opts="$argument"
+  fi
+done
+
+# decide whether to start interactively or not
+# interactive mode can be forced by setting -i as a iplt option
+interactive=""
+if [ $# == 0 ];then
+  interactive="-i"
+else
+  if [ $1 == "-i" ] ;then
+    interactive="-i"
+  fi
+fi
+
+
+IFS="#"
-- 
GitLab