From 4449b76213f6475d6aa0b1a69d3df5a543f8523f Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 8 Mar 2010 16:33:57 +0000 Subject: [PATCH] * ./hurricane/src/hurricane: - Bug: In DebugSession, bad stacking/unstacking of debug levels (unapaired), and wrong value stacked sometimes. * All Hurricane/Coriolis tools: - Change: Simplify the CMakeLists, --- hurricane/CMakeLists.txt | 13 +++-- hurricane/cmake_modules/FindHURRICANE.cmake | 47 +++++++------------ hurricane/src/hurricane/CMakeLists.txt | 8 +--- hurricane/src/hurricane/Commons.cpp | 6 +++ hurricane/src/hurricane/hurricane/Commons.h | 1 + .../src/hurricane/hurricane/DebugSession.h | 5 +- hurricane/src/hviewer/CMakeLists.txt | 11 +---- hurricane/src/isobar/CMakeLists.txt | 17 +------ hurricane/tests/CMakeLists.txt | 6 --- 9 files changed, 36 insertions(+), 78 deletions(-) diff --git a/hurricane/CMakeLists.txt b/hurricane/CMakeLists.txt index 022a3503..a722286c 100644 --- a/hurricane/CMakeLists.txt +++ b/hurricane/CMakeLists.txt @@ -7,20 +7,19 @@ ENDIF(COMMAND CMAKE_POLICY) SET(CMAKE_MODULE_PATH "${HURRICANE_SOURCE_DIR}/cmake_modules/") -OPTION(BUILD_STATIC "Build static version of libraries & binaries" OFF) OPTION(BUILD_DOC "Build the documentation (doxygen)" OFF) -IF(BUILD_STATIC) - MESSAGE(STATUS "Building static libraries.") -# check for qmake +#SET_LIB_LINK_MODE() +IF(NOT BUILD_SHARED_LIBS) + # check for qmake FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake-qt4 qmake PATHS /opt/qt4-static-4.3.2/bin NO_DEFAULT_PATH ) - MESSAGE(STATUS "qmake: ${QT_QMAKE_EXECUTABLE}") -ELSE(BUILD_STATIC) + MESSAGE(STATUS "Building static libraries.") +ELSE(NOT BUILD_SHARED_LIBS) MESSAGE(STATUS "Building dynamic libraries.") -ENDIF(BUILD_STATIC) +ENDIF(NOT BUILD_SHARED_LIBS) SET(QT_USE_QTXML "true") #SET(QT_USE_QTOPENGL "true") diff --git a/hurricane/cmake_modules/FindHURRICANE.cmake b/hurricane/cmake_modules/FindHURRICANE.cmake index a3bcfeac..d14cf0f5 100644 --- a/hurricane/cmake_modules/FindHURRICANE.cmake +++ b/hurricane/cmake_modules/FindHURRICANE.cmake @@ -8,7 +8,6 @@ MACRO(SET_LIBRARIES_PATH configname library) SET(${configname}_FOUND "NOTFOUND") - SET(${configname}_STATIC_FOUND "NOTFOUND") IF(${library}_LIBRARY_PATH) SET(${configname}_FOUND "YES") @@ -17,16 +16,8 @@ MACRO(SET_LIBRARIES_PATH configname library) MARK_AS_ADVANCED(${configname}_INCLUDE_DIR ${configname}_LIBRARIES) ENDIF(${library}_LIBRARY_PATH) - IF(${library}_STATIC_LIBRARY_PATH) - SET(${configname}_STATIC_FOUND "YES") - SET(${configname}_INCLUDE_DIR ${${library}_INCLUDE_PATH}) - SET(${configname}_STATIC_LIBRARIES ${${library}_STATIC_LIBRARY_PATH} ${${configname}_STATIC_LIBRARIES}) - MARK_AS_ADVANCED(${configname}_INCLUDE_DIR ${configname}_STATIC_LIBRARIES) - ENDIF(${library}_STATIC_LIBRARY_PATH) - IF(NOT ${library}_INCLUDE_PATH) SET(${configname}_FOUND "NOTFOUND") - SET(${configname}_STATIC_FOUND "NOTFOUND") ENDIF(NOT ${library}_INCLUDE_PATH) ENDMACRO ( SET_LIBRARIES_PATH ) @@ -36,22 +27,32 @@ MACRO(HURRICANE_CHECK_LIBRARIES) ELSE(ARGC LESS 2) SET(REQUIRED ${argv1}) ENDIF(ARGC LESS 2) - IF(${argv0}_FOUND OR ${argv0}_STATIC_FOUND) + IF(${argv0}_FOUND) IF(NOT ${argv0}_FIND_QUIETLY) IF(${argv0}_FOUND) MESSAGE(STATUS "Found ${argv0} : ${${argv0}_LIBRARIES}") ENDIF(${argv0}_FOUND) - IF(${argv0}_STATIC_FOUND) - MESSAGE(STATUS "Found ${argv0} (static): ${${argv0}_STATIC_LIBRARIES}") - ENDIF(${argv0}_STATIC_FOUND) ENDIF(NOT ${argv0}_FIND_QUIETLY) - ELSE(${argv0}_FOUND OR ${argv0}_STATIC_FOUND) + ELSE(${argv0}_FOUND) IF(REQUIRED) MESSAGE(FATAL_ERROR "${argv0} was not found. ${${argv0}_DIR_MESSAGE}") ENDIF(REQUIRED) - ENDIF(${argv0}_FOUND OR ${argv0}_STATIC_FOUND) + ENDIF(${argv0}_FOUND) ENDMACRO(HURRICANE_CHECK_LIBRARIES) +MACRO(SET_LIB_LINK_MODE) + IF(NOT BUILD_SHARED_LIBS) + # check for qmake + FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake-qt4 qmake PATHS + /opt/qt4-static-4.3.2/bin + NO_DEFAULT_PATH + ) + MESSAGE(STATUS "Building static libraries.") + ELSE(NOT BUILD_SHARED_LIBS) + MESSAGE(STATUS "Building dynamic libraries.") + ENDIF(NOT BUILD_SHARED_LIBS) +ENDMACRO(SET_LIB_LINK_MODE) + SET(HURRICANE_INCLUDE_PATH_DESCRIPTION "The directory containing the Hurricane include files. E.g /usr/local/include or /asim/coriolis/include") SET(HURRICANE_LIBRARY_PATH_DESCRIPTION "The directory containing the Hurricane library files. E.g /usr/local/lib or /asim/coriolis/lib") @@ -84,14 +85,6 @@ IF(UNIX) DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" ) - FIND_LIBRARY(HURRICANE_STATIC_LIBRARY_PATH - NAMES hurricane-static - PATHS ${HURRICANE_DIR_SEARCH} - PATH_SUFFIXES lib - # Help the user find it if we cannot. - DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" - ) - FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH NAMES hurricane/viewer/CellWidget.h PATHS ${HURRICANE_DIR_SEARCH} @@ -108,14 +101,6 @@ IF(UNIX) DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" ) - FIND_LIBRARY(HURRICANE_VIEWER_STATIC_LIBRARY_PATH - NAMES hviewer-static - PATHS ${HURRICANE_DIR_SEARCH} - PATH_SUFFIXES lib - # Help the user find it if we cannot. - DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" - ) - FIND_PATH(HURRICANE_PYTHON_INCLUDE_PATH NAMES hurricane/isobar/PyCell.h PATHS ${HURRICANE_DIR_SEARCH} diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index afe1a7cb..a480114d 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -151,13 +151,7 @@ Timer.cpp ) - - if ( BUILD_STATIC ) - add_library ( hurricane-static STATIC ${cpps} ) - install ( TARGETS hurricane-static DESTINATION /lib) - else ( BUILD_STATIC ) - add_library ( hurricane SHARED ${cpps} ) + add_library ( hurricane ${cpps} ) install ( TARGETS hurricane DESTINATION /lib) - endif ( BUILD_STATIC ) install(FILES ${includes} DESTINATION /include/hurricane) diff --git a/hurricane/src/hurricane/Commons.cpp b/hurricane/src/hurricane/Commons.cpp index b73a2da0..7dae43d9 100644 --- a/hurricane/src/hurricane/Commons.cpp +++ b/hurricane/src/hurricane/Commons.cpp @@ -72,6 +72,12 @@ bool inltrace ( unsigned int level ) return TRACE_SHOW_LEVEL <= level; } +unsigned int ltracelevel () +//************************** +{ + return TRACE_SHOW_LEVEL; +} + unsigned int ltracelevel ( unsigned int level ) //********************************************** { diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 78780507..24ed6cf1 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -87,6 +87,7 @@ namespace Hurricane { void trace_in (); void trace_out (); bool inltrace ( unsigned int level ); + unsigned int ltracelevel (); unsigned int ltracelevel ( unsigned int level ); void ltracein ( unsigned int level, unsigned int count=1 ); void ltraceout ( unsigned int level, unsigned int count=1 ); diff --git a/hurricane/src/hurricane/hurricane/DebugSession.h b/hurricane/src/hurricane/hurricane/DebugSession.h index 5ece25c0..b193063b 100644 --- a/hurricane/src/hurricane/hurricane/DebugSession.h +++ b/hurricane/src/hurricane/hurricane/DebugSession.h @@ -109,12 +109,15 @@ namespace Hurricane { { if ( _singleton->_isTraced(symbol) ) _singleton->_levels.push ( ltracelevel(traceLevel) ); + else { + _singleton->_levels.push ( ltracelevel() ); + } } void DebugSession::close () { - if ( !_singleton->_levels.empty() ) { + if ( not _singleton->_levels.empty() ) { ltracelevel ( _singleton->_levels.top() ); _singleton->_levels.pop (); } diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index a71f3f66..8ca4f075 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -108,18 +108,9 @@ install ( FILES ${exports} DESTINATION /include/hurricane/viewer ) - if ( BUILD_STATIC ) - add_library ( hviewer-static STATIC ${cpps} ${MOC_SRCS} ${RCC_SRCS} ) - target_link_libraries ( hviewer-static hurricane-static - ${QT_LIBRARIES} -# ${Boost_LIBRARIES} - ) - install ( TARGETS hviewer-static DESTINATION /lib ) - else ( BUILD_STATIC ) - add_library ( hviewer SHARED ${cpps} ${MOC_SRCS} ${RCC_SRCS} ) + add_library ( hviewer ${cpps} ${MOC_SRCS} ${RCC_SRCS} ) target_link_libraries ( hviewer hurricane ${QT_LIBRARIES} # ${Boost_LIBRARIES} ) install ( TARGETS hviewer DESTINATION /lib ) - endif ( BUILD_STATIC ) diff --git a/hurricane/src/isobar/CMakeLists.txt b/hurricane/src/isobar/CMakeLists.txt index f1124fe9..ec613638 100644 --- a/hurricane/src/isobar/CMakeLists.txt +++ b/hurricane/src/isobar/CMakeLists.txt @@ -82,21 +82,7 @@ install ( FILES ${includes} DESTINATION /include/hurricane/isobar ) - if ( BUILD_STATIC ) - add_library ( isobar-static STATIC ${sources} ) - target_link_libraries ( isobar-static hurricane-static ${PYTHON_LIBRARIES} ) - - add_library ( Hurricane-static MODULE ${sources} ) - set_target_properties ( Hurricane-static PROPERTIES - COMPILE_FLAGS "${COMPILE_FLAGS} -D__PYTHON_MODULE__=1" - PREFIX "" - ) - target_link_libraries ( Hurricane-static isobar-static hurricane-static ${PYTHON_LIBRARIES} ) - - install ( TARGETS isobar-static DESTINATION /lib ) - install ( TARGETS Hurricane-static DESTINATION /lib/python ) - else ( BUILD_STATIC ) - add_library ( isobar SHARED ${sources} ) + add_library ( isobar ${sources} ) target_link_libraries ( isobar hurricane ${PYTHON_LIBRARIES} -lutil ) add_library ( Hurricane MODULE ${sources} ) @@ -108,4 +94,3 @@ install ( TARGETS isobar DESTINATION /lib ) install ( TARGETS Hurricane DESTINATION /lib/python ) - endif ( BUILD_STATIC ) diff --git a/hurricane/tests/CMakeLists.txt b/hurricane/tests/CMakeLists.txt index ed55307c..d05f63d9 100644 --- a/hurricane/tests/CMakeLists.txt +++ b/hurricane/tests/CMakeLists.txt @@ -1,10 +1,4 @@ -if ( BUILD_STATIC ) - include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ) - add_executable ( htest-static HTest.cpp ) - target_link_libraries ( htest-static hurricane-static ) -else ( BUILD_STATIC ) include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ) add_executable ( htest HTest.cpp ) target_link_libraries ( htest hurricane ) -endif ( BUILD_STATIC )