From 229613ef262e60b8badfaea8fdb0adafc58af086 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 3 Apr 2014 13:55:02 +0200 Subject: [PATCH] Cmakefiles: do not create map file on Windows, because creating map file generates hundred of useless wranings. In PATCH_COMMAND, use patch instead of bzr patch if patch or patch.exe is found (mandatory to use msys2 because bzr patch does not work when using msys2) --- CMakeModules/download_boost.cmake | 24 +++++++++++++++++------- CMakeModules/download_openssl.cmake | 12 ++++++++++-- cvpcb/CMakeLists.txt | 9 +++++++-- eeschema/CMakeLists.txt | 8 +++++++- gerbview/CMakeLists.txt | 8 +++++++- pagelayout_editor/CMakeLists.txt | 8 +++++++- pcbnew/CMakeLists.txt | 10 +++++++++- 7 files changed, 64 insertions(+), 15 deletions(-) diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index e929a2aae5..601738413c 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -101,6 +101,16 @@ else() endif() +find_program(patch_bin NAMES patch patch.exe) + +if( "${patch_bin}" STREQUAL "patch_bin-NOTFOUND" ) + set( PATCH_STR_CMD ${PATCH_STR_CMD} ) +else() + set( PATCH_STR_CMD ${patch_bin} -p0 -i ) +endif() + + + if( MINGW AND NOT CMAKE_HOST_UNIX ) # building for MINGW on windows not UNIX if( MSYS ) # The Boost system does not build properly on MSYS using bootstrap.sh. Running @@ -197,25 +207,25 @@ ExternalProject_Add( boost # bzr revert is insufficient to remove "added" files: COMMAND bzr clean-tree -q --force - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch" - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch" + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch" + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch" - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86.patch" #https://svn.boost.org/trac/boost/ticket/8266 + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86.patch" #https://svn.boost.org/trac/boost/ticket/8266 # tell bzr about "added" files by last patch: COMMAND bzr add libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S COMMAND bzr add libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86_build.patch" #https://svn.boost.org/trac/boost/ticket/8266 - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273 + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86_build.patch" #https://svn.boost.org/trac/boost/ticket/8266 + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273 - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262 + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262 # tell bzr about "added" files by last patch: COMMAND bzr add libs/context/src/asm/make_i386_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/jump_i386_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/make_x86_64_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/jump_x86_64_ms_pe_gas.S - COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/patch_macosx_context_ppc_v2.patch" #https://svn.boost.org/trac/boost/ticket/8266 + COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/patch_macosx_context_ppc_v2.patch" #https://svn.boost.org/trac/boost/ticket/8266 COMMAND bzr add libs/context/build/Jamfile.v2 COMMAND bzr add libs/context/build/architecture.jam COMMAND bzr add libs/context/src/asm/jump_combined_sysv_macho_gas.S diff --git a/CMakeModules/download_openssl.cmake b/CMakeModules/download_openssl.cmake index b810cfb63e..6ab8fc70d7 100644 --- a/CMakeModules/download_openssl.cmake +++ b/CMakeModules/download_openssl.cmake @@ -42,6 +42,14 @@ if( CMAKE_TOOLCHAIN_FILE ) set( TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" ) endif() +FIND_PROGRAM (patch_bin NAMES patch.exe patch) + +if( "${patch_bin}" STREQUAL "patch_bin-NOTFOUND" ) + set( PATCH_STR_CMD bzr patch -p0 ) +else() + set( PATCH_STR_CMD ${patch_bin} -p0 -i ) +endif() + ExternalProject_Add( openssl DOWNLOAD_DIR ${DOWNLOAD_DIR} @@ -58,13 +66,13 @@ ExternalProject_Add( # PATCH_COMMAND patch -p0 < ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch # This one requires the bzr commit below, since bzr patch only knows a working tree. - + # Revert the branch to pristine before applying patch sets as bzr patch # fails when applying a patch to the branch twice and doesn't have a switch # to ignore previously applied patches PATCH_COMMAND bzr revert # PATCH_COMMAND continuation (any *_COMMAND here can be continued with COMMAND): - COMMAND bzr patch -p0 ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch + COMMAND ${PATCH_STR_CMD} ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch CONFIGURE_COMMAND ${CMAKE_COMMAND} diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 47a5c3c111..2e89204780 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -1,5 +1,10 @@ - -set( MAKE_LINK_MAPS true ) +# the map generation creates on Windows/gcc a lot of useless warnings +# so disable it on windows +if( WIN32 AND NOT CMAKE_CROSSCOMPILING ) + set( MAKE_LINK_MAPS false ) +else() + set( MAKE_LINK_MAPS true ) +endif() add_definitions( -DCVPCB ) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index bd04eebb7d..87b71aa5f5 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -1,4 +1,10 @@ -set( MAKE_LINK_MAPS true ) +# the map generation creates on Windows/gcc a lot of useless warnings +# so disable it on windows +if( WIN32 AND NOT CMAKE_CROSSCOMPILING ) + set( MAKE_LINK_MAPS false ) +else() + set( MAKE_LINK_MAPS true ) +endif() add_definitions( -DEESCHEMA ) diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 685c826a1d..df67987d6f 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -1,4 +1,10 @@ -set( MAKE_LINK_MAPS true ) +# the map generation creates on Windows/gcc a lot of useless warnings +# so disable it on windows +if( WIN32 AND NOT CMAKE_CROSSCOMPILING ) + set( MAKE_LINK_MAPS false ) +else() + set( MAKE_LINK_MAPS true ) +endif() add_definitions(-DGERBVIEW) diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt index 95ce1af27f..308bd94949 100644 --- a/pagelayout_editor/CMakeLists.txt +++ b/pagelayout_editor/CMakeLists.txt @@ -1,4 +1,10 @@ -set( MAKE_LINK_MAPS true ) +# the map generation creates on Windows/gcc a lot of useless warnings +# so disable it on windows +if( WIN32 AND NOT CMAKE_CROSSCOMPILING ) + set( MAKE_LINK_MAPS false ) +else() + set( MAKE_LINK_MAPS true ) +endif() add_definitions(-DPL_EDITOR) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index afbdb0e323..d16eb9f04f 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -1,4 +1,10 @@ -set( MAKE_LINK_MAPS true ) +# the map generation creates on Windows/gcc a lot of useless warnings +# so disable it on windows +if( WIN32 AND NOT CMAKE_CROSSCOMPILING ) + set( MAKE_LINK_MAPS false ) +else() + set( MAKE_LINK_MAPS true ) +endif() add_definitions( -DPCBNEW ) add_subdirectory(router) @@ -530,6 +536,7 @@ if( USE_KIWAY_DLLS ) ${PCBNEW_SCRIPTING_SRCS} # ${PCBNEW_RESOURCES} ) + set_target_properties( pcbnew_kiface PROPERTIES # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like # _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface @@ -542,6 +549,7 @@ if( USE_KIWAY_DLLS ) COMPILE_FLAGS ${OpenMP_CXX_FLAGS} ) endif() + target_link_libraries( pcbnew_kiface 3d-viewer pcbcommon