| 7 | #PortGroup cmake 1.0 |
| 8 | # ffmpeg, optional dependency, currenly requires openjpeg15, but vxl uses/packs openjpeg (2.0) |
| 9 | # The cmake portgroup includes the prefix as cflags, what prevent internal openjpeg paths to be included before all others, even through include_directories(BEFORE ...) |
| 10 | # https://trac.macports.org/ticket/42872 |
| 11 | # currently append ${prefix}/var/macports/sources/rsync.macports.org/release/tarballs/ports/_resources/port1.0/group/cmake-1.0.tcl it here until the issue is resolved |
| 12 | # standard place to install extra CMake modules |
| 13 | set cmake_share_module_dir ${prefix}/share/cmake/modules |
| 14 | |
| 15 | depends_build-append port:cmake |
| 16 | |
| 17 | #FIXME: ccache works with cmake on linux |
| 18 | configure.ccache no |
| 19 | |
| 20 | configure.cmd ${prefix}/bin/cmake |
| 21 | |
| 22 | configure.pre_args -DCMAKE_INSTALL_PREFIX=${prefix} |
| 23 | |
| 24 | configure.args -DCMAKE_VERBOSE_MAKEFILE=ON \ |
| 25 | -DCMAKE_COLOR_MAKEFILE=ON \ |
| 26 | -DCMAKE_BUILD_TYPE=Release \ |
| 27 | -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ |
| 28 | -DCMAKE_INSTALL_RPATH=${prefix}/lib \ |
| 29 | -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib \ |
| 30 | -DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \ |
| 31 | -DCMAKE_MODULE_PATH=${cmake_share_module_dir} \ |
| 32 | -DCMAKE_FIND_FRAMEWORK=LAST \ |
| 33 | -Wno-dev |
| 34 | |
| 35 | # CMake honors set environment variables CFLAGS, CXXFLAGS, and LDFLAGS when it |
| 36 | # is first run in a build directory to initialize CMAKE_C_FLAGS, |
| 37 | # CMAKE_CXX_FLAGS, CMAKE_[EXE|SHARED|MODULE]_LINKER_FLAGS. However, be aware |
| 38 | # that a CMake script can always override these flags when it runs, as they |
| 39 | # are frequently set internally in functions of other CMake build variables! |
| 40 | # |
| 41 | # Attention: If you want to be sure that no compiler flags are passed via |
| 42 | # configure.args, you have to manually clear configure.optflags, as it is set |
| 43 | # to "-Os" by default and added to all language-specific flags. If you want to |
| 44 | # turn off optimization, explicitly set configure.optflags to "-O0". |
| 45 | |
| 46 | # TODO: Handle configure.objcflags (cf. to CMake upstream ticket #4756 |
| 47 | # "CMake needs an Objective-C equivalent of CMAKE_CXX_FLAGS" |
| 48 | # <http://public.kitware.com/Bug/view.php?id=4756>) |
| 49 | |
| 50 | # TODO: Handle the Fortran-specific configure.* variables: |
| 51 | # configure.fflags, configure.fcflags, configure.f90flags |
| 52 | |
| 53 | # TODO: Handle the Java-specific configure.classpath variable. |
| 54 | |
| 55 | pre-configure { |
| 56 | # The environment variable CPPFLAGS is not considered by CMake. |
| 57 | # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS" |
| 58 | # <http://www.cmake.org/Bug/view.php?id=12928>). |
| 59 | # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the |
| 60 | # pre-configure phase. |
| 61 | # if {${configure.cppflags} ne ""} { |
| 62 | # configure.cflags-append ${configure.cppflags} |
| 63 | # configure.cxxflags-append ${configure.cppflags} |
| 64 | # } |
| 65 | |
| 66 | # In addition, CMake provides build-type-specific flags for |
| 67 | # Release (-O3 -DNDEBUG), Debug (-g), MinSizeRel (-Os -DNDEBUG), and |
| 68 | # RelWithDebInfo (-O2 -g -DNDEBUG). If the configure.optflags have been |
| 69 | # set (-Os by default), we have to remove the optimization flags from the |
| 70 | # from the concerned Release build type so that configure.optflags |
| 71 | # gets honored (Debug used by the +debug variant does not set |
| 72 | # optimization flags by default). |
| 73 | if {${configure.optflags} ne ""} { |
| 74 | configure.args-append -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ |
| 75 | -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" |
| 76 | } |
| 77 | |
| 78 | platform darwin { |
| 79 | if {[variant_exists universal] && [variant_isset universal]} { |
| 80 | if {[info exists universal_archs_supported]} { |
| 81 | global merger_configure_args |
| 82 | foreach arch ${universal_archs_to_use} { |
| 83 | lappend merger_configure_args(${arch}) -DCMAKE_OSX_ARCHITECTURES=${arch} |
| 84 | } |
| 85 | } else { |
| 86 | configure.universal_args-append \ |
| 87 | -DCMAKE_OSX_ARCHITECTURES="[join ${configure.universal_archs} \;]" |
| 88 | } |
| 89 | } else { |
| 90 | configure.args-append \ |
| 91 | -DCMAKE_OSX_ARCHITECTURES="${configure.build_arch}" |
| 92 | } |
| 93 | if {${configure.sdkroot} != ""} { |
| 94 | configure.args-append -DCMAKE_OSX_SYSROOT="${configure.sdkroot}" |
| 95 | } else { |
| 96 | # Witout this, cmake will choose an SDK and deployment target on its own. |
| 97 | configure.args-append -DCMAKE_OSX_SYSROOT=/ -DCMAKE_OSX_DEPLOYMENT_TARGET="" |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | configure.universal_args-delete --disable-dependency-tracking |
| 103 | |
| 104 | variant debug description "Enable debug binaries" { |
| 105 | configure.args-delete -DCMAKE_BUILD_TYPE=Release |
| 106 | configure.args-append -DCMAKE_BUILD_TYPE=Debug |
| 107 | } |
| 108 | |
| 109 | # cmake doesn't like --enable-debug, so in case a portfile sets |
| 110 | # --enable-debug (regardless of variant) we remove it |
| 111 | if {[string first "--enable-debug" ${configure.args}] > -1} { |
| 112 | configure.args-delete --enable-debug |
| 113 | } |
| 114 | # end of copy |
| 115 | |
| 116 | github.setup vxl vxl 22e5ccd9fa |