← Back to team overview

kicad-developers team mailing list archive

Re: boost::polygon workaround

 

On 10/20/2013 09:47 AM, Camille 019 wrote:
> kicad-testing_bzr4403.patch
> 
> 
> === modified file 'CMakeLists.txt'
> --- CMakeLists.txt	2013-10-17 19:03:36 +0000
> +++ CMakeLists.txt	2013-10-18 21:04:24 +0000
> @@ -1,8 +1,8 @@
> -project( kicad )
> -
>  cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
>  # because of http://public.kitware.com/Bug/view.php?id=10395
>  


No, following line will break CMake's ability to invoke the C compiler, for anything we
need it for:


> +project( kicad CXX )

I object to the CXX part.


> +
>  # Path to local CMake modules.
>  set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
>  
> @@ -79,51 +79,21 @@
>  
>  if( CMAKE_COMPILER_IS_GNUCXX )
>  

I don't much care for the KICAD_GCC_{RELEASE,DEBUG}_BUILD_FLAGS so a smaller patch I would
accept, which targets those two symbols for removal, and which takes into consideration
what Jean-Pierre said about targeting 4.7.0 - 2.


> -    set( KICAD_GCC_RELEASE_BUILD_FLAGS "-O2" )
> -    set( KICAD_GCC_RELEASE_DEBUG_FLAGS "" )


> -
> -    execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
> +
> +    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
> +
> +    set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
> +    set( CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" )
> +
> +    execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
>          OUTPUT_VARIABLE GCC_VERSION
>          OUTPUT_STRIP_TRAILING_WHITESPACE )
>  
> -    # Added -Wno-narrowing on 10/7/12 to prevent a huge number of warnings when
> -    # compiling with GCC 4.7.  This appears to be caused by and int to unsigned
> -    # conversion in the Boost polygon library.  At some point in the future when
> -    # Boost is updated to the next version, -Wno-narrowing should be removed to
> -    # see if the problem has been resolved.  Wayne.
> -    #
> -    # Also note the optimization level is -O1 instead of the usual -O2 level
> -    # because boost::polygon has a function ( inflate polygon) broken by
> -    # the -O2 level with GCC 4.7 (works fine with  with GCC 4.6).
> -    # This lower optimization level does not have a significant change on the speed.
> -    #
> -    # As newer versions of GCC and/or Boost are released, this code needs reviewed to
> -    # determine if the problems above have been fixed either in Boost or GCC.
> -    if( GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7 )
> -        set( KICAD_GCC_RELEASE_BUILD_FLAGS "-Wno-narrowing -O1" )
> -        set( KICAD_GCC_DEBUG_BUILD_FLAGS "-Wno-narrowing" )
> -    endif()
> -
> -    if( CMAKE_BUILD_TYPE STREQUAL Debug )
> -        message( STATUS
> -            "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"" )
> -    else()
> -        message( STATUS
> -            "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"" )
> -    endif()
> -
> -    set( CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall" )
> -    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
> -
>      if( MINGW )
>          # Set default flags for Release build.
> -        set( CMAKE_C_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG" )
> -        set( CMAKE_CXX_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG" )
>          set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++" )
>  
>          # Set default flags for Debug build.
> -        set( CMAKE_C_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG" )
> -        set( CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG" )
>          set( CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows
>  
>      else()
> @@ -133,7 +103,6 @@
>          # empty for Windows.
>          set( PIC_FLAG -fPIC )
>  

No, this should be kept, there are sub-projects that pass this variable to C only builds,
and with SWIG and what not (future) lurking around, it is simply not worth doing this "C
specific" removal:


> -        set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
>          set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
>  
>          # Thou shalt not link vaporware and tell us it's a valid DSO:
> @@ -141,13 +110,8 @@
>          set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) # needed by SWIG macros on linux
>  
>          # Set default flags for Release build.
> -        set( CMAKE_C_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG" )
> -        set( CMAKE_CXX_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG" )
>          set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
>  
> -        # Set default flags for Debug build.
> -        set( CMAKE_C_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG" )
> -        set( CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG" )
>      endif()
>  
>      # quiet GCC 4.8.1 while in boost
> @@ -519,3 +483,21 @@
>      include( CPack )
>  
>  endif()
> +
> +



Below seems like noise.
It's all mostly in the cache file anyways or can be obtained with

$make VERBOSE=1

Maybe it would get accepted if you wrap it all into an

if( false )

endif()



> +# ========================== Status ==========================
> +message(STATUS "")
> +message(STATUS "========== Build configuration ==========")
> +message(STATUS "")
> +
> +if(NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
> +    message(STATUS "  Build type: "  ${CMAKE_BUILD_TYPE})
> +endif()
> +
> +message(STATUS "  C++ options:")
> +message(STATUS "    Compiler: "  "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (version ${CMAKE_CXX_COMPILER_VERSION})")
> +
> +message(STATUS "    flags (Debug):          "  "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
> +message(STATUS "    flags (Release):        "  "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
> +message(STATUS "    flags (RelWithDebInfo): "  "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
> +message(STATUS "")
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References