ecbuild-3.14.1/0000775000175000017500000000000015200367620013374 5ustar alastairalastairecbuild-3.14.1/VERSION0000777000175000017500000000000015200367620016567 2cmake/VERSIONustar alastairalastairecbuild-3.14.1/NOTICE0000664000175000017500000000135015200367620014277 0ustar alastairalastairNotice ------ 1. The files FindLex and FindYacc are based on the FindBison and FindFlex macros from the original CMake code base. As requested, the License text has been preserved. The modifications are governed by the Apache License as described in COPYING. 2. FindEigen3 is based on a macro from Montel Laurent and others and distributed under the BSD 2-Clause License. 3. FindNetCDF4 is based on the macro FindNetCDF from project UCLALES from Max-Planck-Institut für Meteorologie and distributed under the Academic Free License v3.0. 4. GetGitRevisionDescription macros are based on the macro with smae name from Ryan Pavlik and Iowa State University, and distributed under Boost license. ecbuild-3.14.1/regressions/0000775000175000017500000000000015200367620015737 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_511/0000775000175000017500000000000015200367620017374 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/0000775000175000017500000000000015200367620021050 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectA/0000775000175000017500000000000015200367620022617 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectA/libraryA.c0000664000175000017500000000006715200367620024533 0ustar alastairalastair#include "libraryA.h" int libraryA() { return 4; } ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectA/libraryA.h0000664000175000017500000000012415200367620024532 0ustar alastairalastair#ifndef _LIBRARYA_H_ #define _LIBRARYA_H_ int libraryA(); #endif /* _LIBRARYA_H_ */ ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectA/CMakeLists.txt0000664000175000017500000000052515200367620025361 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(projectA VERSION 0.1.0 LANGUAGES C) ecbuild_add_library( TARGET projectA SOURCES libraryA.h libraryA.c PUBLIC_INCLUDES $ INSTALL_HEADERS LISTED) ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectB/0000775000175000017500000000000015200367620022620 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectB/libraryB.c0000664000175000017500000000013215200367620024526 0ustar alastairalastair#include "libraryB.h" #include "libraryA.h" int libraryB() { return libraryA() + 1; } ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectB/projectb-import.cmake.in0000664000175000017500000000007415200367620027350 0ustar alastairalastairinclude(CMakeFindDependencyMacro) find_dependency(projectA) ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectB/libraryB.h0000664000175000017500000000015215200367620024535 0ustar alastairalastair#ifndef _LIBRARYB_H_ #define _LIBRARYB_H_ #include "libraryA.h" int libraryB(); #endif /* _LIBRARYB_H_ */ ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/projectB/CMakeLists.txt0000664000175000017500000000061515200367620025362 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(projectB VERSION 0.1.0 LANGUAGES C) find_package(projectA REQUIRED) ecbuild_add_library( TARGET projectB SOURCES libraryB.h libraryB.c PUBLIC_LIBS projectA PUBLIC_INCLUDES $ INSTALL_HEADERS LISTED) ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/regressions/ECBUILD_511/bundleAB/CMakeLists.txt0000664000175000017500000000036515200367620023614 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(bundleAB VERSION 0.1.0 LANGUAGES C) ecbuild_bundle(PROJECT projectA) ecbuild_bundle(PROJECT projectB) ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/regressions/ECBUILD_511/clean.sh0000775000175000017500000000017215200367620021015 0ustar alastairalastair#!/usr/bin/env bash set -e rm -rf bundleAB/build rm -rf bundleAB/install rm -rf projectC/build rm -rf projectC/install ecbuild-3.14.1/regressions/ECBUILD_511/projectC/0000775000175000017500000000000015200367620021145 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_511/projectC/main.c0000664000175000017500000000031315200367620022232 0ustar alastairalastair#include #include "libraryA.h" #include "libraryB.h" int main(int argc, char* argv[]) { printf("libraryA = %d\n", libraryA()); printf("libraryB = %d\n", libraryB()); return 0; } ecbuild-3.14.1/regressions/ECBUILD_511/projectC/CMakeLists.txt0000664000175000017500000000043415200367620023706 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(projectC VERSION 0.1.0 LANGUAGES C) find_package(projectB REQUIRED) ecbuild_add_executable( TARGET main SOURCES main.c LIBS projectB) ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/regressions/ECBUILD_511/run-test.sh.in0000775000175000017500000000205115200367620022117 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@ # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH # --------------------- cleanup ------------------------ $HERE/clean.sh # ----------------- build projectAB --------------------- mkdir -p $HERE/bundleAB cd $HERE/bundleAB mkdir build cd build ecbuild --prefix=../install -- -DINSTALL_LIB_DIR=lib $SRC_DIR/bundleAB make install cd .. rm -rfv build # ----------------- build projectC --------------------- mkdir -p $HERE/projectC cd $HERE/projectC mkdir build cd build ecbuild --prefix=../install -- -DINSTALL_LIB_DIR=lib \ -DprojectA_DIR=$HERE/bundleAB/install/lib/cmake/projectA \ -DprojectB_DIR=$HERE/bundleAB/install/lib/cmake/projectB \ $SRC_DIR/projectC make install cd .. rm -rfv build # ----------------- run --------------------- cd $HERE projectC/install/bin/main | tee projectC_main.log grep -qF "libraryA = 4" projectC_main.log grep -qF "libraryB = 5" projectC_main.log ecbuild-3.14.1/regressions/ECBUILD_511/CMakeLists.txt0000664000175000017500000000030515200367620022132 0ustar alastairalastair set( ec511_res clean.sh ) configure_file( run-test.sh.in run-test.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-511 TYPE SCRIPT COMMAND run-test.sh RESOURCES ${ec511_res} ) ecbuild-3.14.1/regressions/ECBUILD_359/0000775000175000017500000000000015200367620017406 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_359/test-CMakeLists.txt0000664000175000017500000000103715200367620023124 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. cmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild REQUIRED) project(kata VERSION 0.0 LANGUAGES CXX) ecbuild_find_package(NAME bar REQUIRED) ecbuild-3.14.1/regressions/ECBUILD_359/run-test.sh.in0000775000175000017500000000172315200367620022136 0ustar alastairalastair#!/usr/bin/env bash # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin EXAMPLES_DIR=@CMAKE_SOURCE_DIR@/examples SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@ # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH # Cleanup previous builds rm -rf $HERE/build $HERE/bundle # Build and install bundle mkdir -p $HERE/bundle/build cd $HERE/bundle/build ecbuild --prefix=$HERE/bundle/install $EXAMPLES_DIR/cpp-bundle make install # Build project that uses subproject bar of bundle mkdir -p $HERE/build cd $HERE/build ecbuild -DBAR_PATH=$HERE/bundle/install ../ ecbuild-3.14.1/regressions/ECBUILD_359/CMakeLists.txt0000664000175000017500000000031215200367620022142 0ustar alastairalastair configure_file(run-test.sh.in run-test.sh @ONLY) configure_file(test-CMakeLists.txt CMakeLists.txt COPYONLY) ecbuild_add_test( TARGET ECBUILD-359 TYPE SCRIPT COMMAND run-test.sh ) ecbuild-3.14.1/regressions/ECBUILD_415/0000775000175000017500000000000015200367620017377 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_415/test_path_append.cmake0000664000175000017500000000100715200367620023721 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) include( ecbuild_append_to_rpath ) unset( SOME_PATH ) ecbuild_path_append( SOME_PATH "/usr/local/foo" ) message( "${SOME_PATH}" ) ecbuild_path_append( SOME_PATH "/usr/bar" ) message( "${SOME_PATH}" ) ecbuild_path_append( SOME_PATH "/system/baz" ) message( "${SOME_PATH}" ) if( NOT "${SOME_PATH}" STREQUAL "/usr/local/foo;/usr/bar;/system/baz" ) message( FATAL_ERROR "ecbuild_path_append() not working as expected" ) endif() ecbuild-3.14.1/regressions/ECBUILD_415/CMakeLists.txt0000664000175000017500000000033215200367620022135 0ustar alastairalastair ecbuild_add_test( TARGET ECBUILD-415 TYPE SCRIPT COMMAND ${CMAKE_COMMAND} ARGS -DCMAKE_MODULE_PATH=${ECBUILD_MACROS_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_path_append.cmake ) ecbuild-3.14.1/regressions/ECBUILD_407/0000775000175000017500000000000015200367620017400 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_407/run-test.sh.in0000775000175000017500000000060015200367620022121 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@ # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH # --------------------- cleanup ------------------------ rm -rf build # ----------------- build --------------------- mkdir build cd build ecbuild -- $SRC_DIR/mybundle ecbuild-3.14.1/regressions/ECBUILD_407/mybundle/0000775000175000017500000000000015200367620021217 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_407/mybundle/mylib/0000775000175000017500000000000015200367620022333 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_407/mybundle/mylib/mylib-import.cmake.in0000664000175000017500000000002315200367620026361 0ustar alastairalastairset( mylib_FOO 1 ) ecbuild-3.14.1/regressions/ECBUILD_407/mybundle/mylib/CMakeLists.txt0000664000175000017500000000043515200367620025075 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) project( mylib VERSION 0.1.0 LANGUAGES NONE ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9.5 ) ecbuild_declare_project() ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_407/mybundle/myexe/0000775000175000017500000000000015200367620022346 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_407/mybundle/myexe/CMakeLists.txt0000664000175000017500000000060615200367620025110 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) project( myexe VERSION 0.1.0 LANGUAGES NONE ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9.5 ) ecbuild_declare_project() ecbuild_find_package( NAME mylib REQUIRED ) if( NOT DEFINED mylib_FOO ) message( FATAL_ERROR "mylib_FOO is not defined" ) endif() ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_407/mybundle/CMakeLists.txt0000664000175000017500000000052615200367620023762 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) include( ecbuild_bundle ) project( mybundle VERSION 0.1.0.0 LANGUAGES NONE ) ecbuild_bundle_initialize() ecbuild_requires_macro_version( 2.9.5 ) ecbuild_bundle( PROJECT mylib ) ecbuild_bundle( PROJECT myexe ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_407/CMakeLists.txt0000664000175000017500000000022015200367620022132 0ustar alastairalastair configure_file( run-test.sh.in run-test.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-407 TYPE SCRIPT COMMAND run-test.sh ) ecbuild-3.14.1/regressions/ECBUILD_401/0000775000175000017500000000000015200367620017372 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_401/projectA/0000775000175000017500000000000015200367620021141 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_401/projectA/libraryA.cc0000664000175000017500000000006615200367620023217 0ustar alastairalastair#include "libraryA.h" int libraryA() { return 4; } ecbuild-3.14.1/regressions/ECBUILD_401/projectA/libraryA.h0000664000175000017500000000002015200367620023047 0ustar alastairalastairint libraryA(); ecbuild-3.14.1/regressions/ECBUILD_401/projectA/CMakeLists.txt0000664000175000017500000000057515200367620023710 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) project( projectA VERSION 0.1.0 LANGUAGES CXX ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9.5 ) ecbuild_declare_project() ecbuild_add_library( TARGET projectA SOURCES libraryA.h libraryA.cc INSTALL_HEADERS LISTED ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_401/clean.sh0000775000175000017500000000017215200367620021013 0ustar alastairalastair#!/usr/bin/env bash set -e rm -rf projectA/build rm -rf projectA/install rm -rf projectB/build rm -rf projectB/install ecbuild-3.14.1/regressions/ECBUILD_401/run-test.sh.in0000775000175000017500000000160415200367620022120 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@ # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH # --------------------- cleanup ------------------------ $HERE/clean.sh # ----------------- build projectA --------------------- mkdir -p $HERE/projectA cd $HERE/projectA mkdir build cd build ecbuild --prefix=../install -- -DINSTALL_LIB_DIR=lib $SRC_DIR/projectA make install # ----------------- build projectB --------------------- mkdir -p $HERE/projectB cd $HERE/projectB mkdir build cd build ecbuild --prefix=../install -- -DINSTALL_LIB_DIR=lib -DprojectA_DIR=$HERE/projectA/install/lib/cmake/projectA $SRC_DIR/projectB make install # ----------------- run --------------------- cd $HERE projectB/install/bin/main >projectB_main.log grep -qF "libraryA = 4" projectB_main.log ecbuild-3.14.1/regressions/ECBUILD_401/projectB/0000775000175000017500000000000015200367620021142 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_401/projectB/main.cc0000664000175000017500000000023115200367620022371 0ustar alastairalastair#include #include int main(int argc, char* argv[]) { std::cout << "libraryA = " << libraryA() << std::endl; return 0; } ecbuild-3.14.1/regressions/ECBUILD_401/projectB/CMakeLists.txt0000664000175000017500000000064015200367620023702 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) project( projectB VERSION 0.1.0 LANGUAGES CXX ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9.5 ) ecbuild_declare_project() find_package( projectA REQUIRED ) ecbuild_add_executable( TARGET main SOURCES main.cc ) target_link_libraries( main projectA ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_401/CMakeLists.txt0000664000175000017500000000030515200367620022130 0ustar alastairalastair set( ec401_res clean.sh ) configure_file( run-test.sh.in run-test.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-401 TYPE SCRIPT COMMAND run-test.sh RESOURCES ${ec401_res} ) ecbuild-3.14.1/regressions/ECBUILD_509/0000775000175000017500000000000015200367620017403 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_509/proj/0000775000175000017500000000000015200367620020355 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_509/proj/mylib.c0000664000175000017500000000010215200367620021626 0ustar alastairalastair#include void hello(void) { printf("Hello!\n"); } ecbuild-3.14.1/regressions/ECBUILD_509/proj/myexe.c0000664000175000017500000000013215200367620021644 0ustar alastairalastairextern void hello(void); int main(int argc, char **argv) { hello(); return 0; } ecbuild-3.14.1/regressions/ECBUILD_509/proj/CMakeLists.txt0000664000175000017500000000051015200367620023111 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.6 QUIET) project(myproj VERSION 0.1.0 LANGUAGES C) ecbuild_add_library(TARGET mylib SOURCES mylib.c) ecbuild_add_test( TARGET myexe SOURCES myexe.c PROPERTIES TIMEOUT 60 LIBS mylib ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_509/run.sh.in0000775000175000017500000000062415200367620021155 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@/proj # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH cd $HERE # ---------------------- cleanup ----------------------- rm -rf build # ----------------------- build ------------------------ mkdir build cd build ecbuild -- $SRC_DIR make ecbuild-3.14.1/regressions/ECBUILD_509/CMakeLists.txt0000664000175000017500000000020115200367620022134 0ustar alastairalastair configure_file( run.sh.in run.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-509 TYPE SCRIPT COMMAND run.sh ) ecbuild-3.14.1/regressions/ECBUILD_495/0000775000175000017500000000000015200367620017407 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_495/proj/0000775000175000017500000000000015200367620020361 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_495/proj/cmake/0000775000175000017500000000000015200367620021441 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_495/proj/cmake/FindBar.cmake0000664000175000017500000000011415200367620023744 0ustar alastairalastairmessage(STATUS "Found Bar: ${CMAKE_CURRENT_LIST_FILE}") set(Bar_FOUND TRUE) ecbuild-3.14.1/regressions/ECBUILD_495/proj/CMakeLists.txt0000664000175000017500000000034315200367620023121 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(foo VERSION 0.1 LANGUAGES NONE) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR/cmake}) ecbuild_find_package(Bar REQUIRED) ecbuild-3.14.1/regressions/ECBUILD_495/run.sh.in0000775000175000017500000000075415200367620021165 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@PROJECT_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@/proj # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH cd $HERE # ---------------------- cleanup ----------------------- rm -rf build # --------------------- configure ---------------------- mkdir build cd build ecbuild -- \ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ -DCMAKE_FIND_ROOT_PATH=/invalid \ $SRC_DIR ecbuild-3.14.1/regressions/ECBUILD_495/CMakeLists.txt0000664000175000017500000000020115200367620022140 0ustar alastairalastair configure_file( run.sh.in run.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-495 TYPE SCRIPT COMMAND run.sh ) ecbuild-3.14.1/regressions/ECBUILD_399/0000775000175000017500000000000015200367620017412 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_399/buildfail-CMakeLists.txt.in0000664000175000017500000000043115200367620024506 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) project( dummy VERSION 0.1 LANGUAGES NONE ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9 ) ecbuild_declare_project() ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_399/buildfail.sh.in0000775000175000017500000000123515200367620022312 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH cd buildfail # ---------------------- cleanup ----------------------- rm -rf build # ----------------------- build ------------------------ mkdir build cd build ecbuild -- .. # -------------------- contaminate --------------------- # In practice, this may be caused by using two different # installations of ecbuild echo "CMAKE_HOME_DIRECTORY:INTERNAL=/non/existent" \ >ecbuild_tmp/check_linker/CMakeCache.txt # ---------------------- rebuild ----------------------- ecbuild -- .. ecbuild-3.14.1/regressions/ECBUILD_399/ld-origin/0000775000175000017500000000000015200367620021276 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_399/ld-origin/dso2.c0000664000175000017500000000005615200367620022312 0ustar alastairalastairvoid fun1(void); void fun2(void) { fun1(); } ecbuild-3.14.1/regressions/ECBUILD_399/ld-origin/main.c0000664000175000017500000000007115200367620022364 0ustar alastairalastairvoid fun2(void); int main(void) { fun2(); return 0; } ecbuild-3.14.1/regressions/ECBUILD_399/ld-origin/dso1.c0000664000175000017500000000002415200367620022304 0ustar alastairalastairvoid fun1(void) {} ecbuild-3.14.1/regressions/ECBUILD_399/ld-origin/CMakeLists.txt0000664000175000017500000000133715200367620024042 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) project(test_ld_origin VERSION 1.0 LANGUAGES C) include(ecbuild_system NO_POLICY_SCOPE) ecbuild_requires_macro_version( 2.9 ) ecbuild_declare_project() # Allow RPATH to be overridden at build time # This allows to recreate the bug without having to install a dummy project set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) ecbuild_add_library(TARGET dso1 SOURCES dso1.c) ecbuild_add_library(TARGET dso2 SOURCES dso2.c) target_link_libraries(dso2 PRIVATE dso1) ecbuild_target_rpath(dso2 REPLACE "../lib") ecbuild_add_executable(TARGET main SOURCES main.c) target_link_libraries(main PRIVATE dso2) ecbuild_target_rpath(main REPLACE "../lib") ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/regressions/ECBUILD_399/ld-origin.sh.in0000775000175000017500000000066215200367620022246 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@ # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH # --------------------- cleanup ------------------------ rm -rf $HERE/ld-origin # ------------------ build project --------------------- mkdir -p $HERE/ld-origin cd $HERE/ld-origin ecbuild -- $SRC_DIR/ld-origin make ecbuild-3.14.1/regressions/ECBUILD_399/CMakeLists.txt0000664000175000017500000000117415200367620022155 0ustar alastairalastair configure_file( ld-origin.sh.in ld-origin.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-399-ld-origin TYPE SCRIPT COMMAND ld-origin.sh CONDITION UNIX ) #[=[ Description of the bug: the linker fix check (look for test_ld_origin in cmake/ecbuild_check_os.cmake) makes the build fail if two different versions of ecbuild are used in the same build directory. #]=] configure_file( buildfail.sh.in buildfail.sh @ONLY ) configure_file( buildfail-CMakeLists.txt.in buildfail/CMakeLists.txt @ONLY ) ecbuild_add_test( TARGET ECBUILD-399-buildfail TYPE SCRIPT COMMAND buildfail.sh CONDITION UNIX ) ecbuild-3.14.1/regressions/ECBUILD_433/0000775000175000017500000000000015200367620017377 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_433/proj/0000775000175000017500000000000015200367620020351 5ustar alastairalastairecbuild-3.14.1/regressions/ECBUILD_433/proj/mylib.c0000664000175000017500000000010215200367620021622 0ustar alastairalastair#include void hello(void) { printf("Hello!\n"); } ecbuild-3.14.1/regressions/ECBUILD_433/proj/myexe.c0000664000175000017500000000013215200367620021640 0ustar alastairalastairextern void hello(void); int main(int argc, char **argv) { hello(); return 0; } ecbuild-3.14.1/regressions/ECBUILD_433/proj/CMakeLists.txt0000664000175000017500000000044415200367620023113 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.0 QUIET) project(myproj VERSION 0.1.0 LANGUAGES C) ecbuild_add_library(TARGET mylib SOURCES mylib.c) ecbuild_add_executable(TARGET myexe SOURCES myexe.c LIBS mylib) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/regressions/ECBUILD_433/run.sh.in0000775000175000017500000000123315200367620021146 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin SRC_DIR=@CMAKE_CURRENT_SOURCE_DIR@/proj # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH cd $HERE # ---------------------- cleanup ----------------------- rm -rf build build2 # ----------------------- build ------------------------ mkdir build cd build ecbuild -- $SRC_DIR make # ---------------------- relocate ---------------------- cd $HERE mv build build2 # ------------------------ run ------------------------- build2/bin/myexe >myexe.out # -------------------- check output -------------------- grep -q "^Hello!$" myexe.out ecbuild-3.14.1/regressions/ECBUILD_433/CMakeLists.txt0000664000175000017500000000020115200367620022130 0ustar alastairalastair configure_file( run.sh.in run.sh @ONLY ) ecbuild_add_test( TARGET ECBUILD-433 TYPE SCRIPT COMMAND run.sh ) ecbuild-3.14.1/regressions/CMakeLists.txt0000664000175000017500000000053015200367620020475 0ustar alastairalastairadd_subdirectory( ECBUILD_359 ) add_subdirectory( ECBUILD_401 ) add_subdirectory( ECBUILD_407 ) add_subdirectory( ECBUILD_415 ) add_subdirectory( ECBUILD_433 ) add_subdirectory( ECBUILD_495 ) add_subdirectory( ECBUILD_509 ) add_subdirectory( ECBUILD_511 ) if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) add_subdirectory( ECBUILD_399 ) endif() ecbuild-3.14.1/tests/0000775000175000017500000000000015200367620014536 5ustar alastairalastairecbuild-3.14.1/tests/project_options/0000775000175000017500000000000015200367620017757 5ustar alastairalastairecbuild-3.14.1/tests/project_options/clean.sh0000775000175000017500000000033115200367620021375 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/project_options/configure.sh0000775000175000017500000000705015200367620022301 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- # (1) Options: (default) mkdir -p $HERE/build_1 ecbuild $SOURCE/test_project -B $HERE/build_1 | tee $HERE/build_1.log EXPECT_ONE_OF $HERE/build_1.log "Feature FEATUREON was not enabled" EXPECT_ONE_OF $HERE/build_1.log "Feature FEATUREOFF disabled" EXPECT_ONE_OF $HERE/build_1.log "Build files have been written" # (2) Options: -DENABLE_FEATUREON=ON mkdir -p $HERE/build_2 ecbuild -DENABLE_FEATUREON=ON $SOURCE/test_project -B $HERE/build_2 | tee $HERE/build_2.log EXPECT_ONE_OF $HERE/build_2.log "Configuring incomplete, errors occurred!" # (2a) Options: -DENABLE_FEATUREON=OFF mkdir -p $HERE/build_2a ecbuild -DENABLE_FEATUREON=OFF $SOURCE/test_project -B $HERE/build_2a | tee $HERE/build_2a.log EXPECT_ONE_OF $HERE/build_2a.log "Feature FEATUREON disabled" EXPECT_ONE_OF $HERE/build_2a.log "Feature FEATUREOFF disabled" EXPECT_ONE_OF $HERE/build_2a.log "Build files have been written" # (3) Options: -DENABLE_FEATUREON=ON -DFEATUREON_CONDITION=ON mkdir -p $HERE/build_3 ecbuild -DENABLE_FEATUREON=ON -DFEATUREON_CONDITION=ON $SOURCE/test_project -B $HERE/build_3 | tee $HERE/build_3.log EXPECT_ONE_OF $HERE/build_3.log "Feature FEATUREON enabled" EXPECT_ONE_OF $HERE/build_3.log "Feature FEATUREOFF disabled" EXPECT_ONE_OF $HERE/build_3.log "Build files have been written" # (4) Options: -DPROJA_ENABLE_FEATUREON=ON mkdir -p $HERE/build_4 ecbuild -DPROJA_ENABLE_FEATUREON=ON $SOURCE/test_project -B $HERE/build_4 | tee $HERE/build_4.log EXPECT_ONE_OF $HERE/build_4.log "Configuring incomplete, errors occurred!" # (4a) Options: -DPROJA_ENABLE_FEATUREON=OFF mkdir -p $HERE/build_4a ecbuild -DPROJA_ENABLE_FEATUREON=OFF $SOURCE/test_project -B $HERE/build_4a | tee $HERE/build_4a.log EXPECT_ONE_OF $HERE/build_4a.log "Feature FEATUREON disabled" EXPECT_ONE_OF $HERE/build_4a.log "Feature FEATUREOFF disabled" EXPECT_ONE_OF $HERE/build_4a.log "Build files have been written" # (5) Options: -DPROJA_ENABLE_FEATUREON=ON -DFEATUREON_CONDITION=ON -DENABLE_FEATUREON=OFF mkdir -p $HERE/build_5 ecbuild -DPROJA_ENABLE_FEATUREON=ON -DFEATUREON_CONDITION=ON -DENABLE_FEATUREON=OFF $SOURCE/test_project -B $HERE/build_5 | tee $HERE/build_5.log EXPECT_ONE_OF $HERE/build_5.log "Feature FEATUREON enabled" EXPECT_ONE_OF $HERE/build_5.log "Feature FEATUREOFF disabled" EXPECT_ONE_OF $HERE/build_5.log "Build files have been written" # (6) Options: -DPROJA_ENABLE_FEATUREOFF=ON mkdir -p $HERE/build_6 ecbuild -DPROJA_ENABLE_FEATUREOFF=ON $SOURCE/test_project -B $HERE/build_6 | tee $HERE/build_6.log EXPECT_ONE_OF $HERE/build_6.log "Configuring incomplete, errors occurred!" # (7) Options: -DPROJA_ENABLE_FEATUREOFF=ON -DFEATUREOFF_CONDITION=ON mkdir -p $HERE/build_7 ecbuild -DPROJA_ENABLE_FEATUREOFF=ON -DFEATUREOFF_CONDITION=ON $SOURCE/test_project -B $HERE/build_7 | tee $HERE/build_7.log EXPECT_ONE_OF $HERE/build_7.log "Feature FEATUREON was not enabled" EXPECT_ONE_OF $HERE/build_7.log "Feature FEATUREOFF enabled" EXPECT_ONE_OF $HERE/build_7.log "Build files have been written" ecbuild-3.14.1/tests/project_options/test_project/0000775000175000017500000000000015200367620022464 5ustar alastairalastairecbuild-3.14.1/tests/project_options/test_project/CMakeLists.txt0000664000175000017500000000052115200367620025222 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( proja LANGUAGES NONE VERSION 0.2 ) ecbuild_add_option( FEATURE FEATUREON DEFAULT ON CONDITION DEFINED FEATUREON_CONDITION ) ecbuild_add_option( FEATURE FEATUREOFF DEFAULT OFF CONDITION DEFINED FEATUREOFF_CONDITION )ecbuild-3.14.1/tests/project_options/CMakeLists.txt0000664000175000017500000000040115200367620022512 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_project_options TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/0000775000175000017500000000000015200367620025035 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/clean.sh0000775000175000017500000000033115200367620026453 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/configure.sh0000775000175000017500000000253415200367620027361 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- # Options: (default) mkdir -p $HERE/build_1 ecbuild $SOURCE/test_project -B $HERE/build_1 | tee $HERE/build_1.log EXPECT_ONE_OF $HERE/build_1.log "FEATURE_A, proja(ON): '', projb(OFF): '', projc(OFF): ''" # Options: -DENABLE_FEATURE_A=ON (fails because of projc depends on nonexisting package) mkdir -p $HERE/build_2 ecbuild -DENABLE_FEATURE_A=ON $SOURCE/test_project -B $HERE/build_2 | tee $HERE/build_2.log EXPECT_ONE_OF $HERE/build_2.log "Configuring incomplete, errors occurred!" # Options: -DPROJB_ENABLE_FEATURE_A=ON mkdir -p $HERE/build_3 ecbuild -DPROJB_ENABLE_FEATURE_A=ON $SOURCE/test_project -B $HERE/build_3 | tee $HERE/build_3.log EXPECT_ONE_OF $HERE/build_3.log "FEATURE_A, proja(ON): '', projb(ON): '', projc(OFF): ''"ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/0000775000175000017500000000000015200367620027542 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/projb/0000775000175000017500000000000015200367620030656 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/projb/CMakeLists.txt0000664000175000017500000000021715200367620033416 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( projb LANGUAGES NONE VERSION 0.1 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT OFF ) ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/projc/0000775000175000017500000000000015200367620030657 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/projc/CMakeLists.txt0000664000175000017500000000026715200367620033424 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( projc LANGUAGES NONE VERSION 0.3 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT ON REQUIRED_PACKAGES nonexistent ) ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/proja/0000775000175000017500000000000015200367620030655 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/proja/CMakeLists.txt0000664000175000017500000000021615200367620033414 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( proja LANGUAGES NONE VERSION 0.2 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT ON ) ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/test_project/CMakeLists.txt0000664000175000017500000000035515200367620032305 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( main LANGUAGES NONE VERSION 0.2 ) add_subdirectory( proja ) add_subdirectory( projb ) add_subdirectory( projc ) ecbuild_print_summary() ecbuild-3.14.1/tests/ecbuild_add_option_multiproject_defaults/CMakeLists.txt0000664000175000017500000000042215200367620027573 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_add_option_multiproject_defaults TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/test_requires_simple/0000775000175000017500000000000015200367620021005 5ustar alastairalastairecbuild-3.14.1/tests/test_requires_simple/build-and-run.sh0000775000175000017500000000106215200367620024004 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # Build the project ecbuild $SOURCE/test_project -B $HERE/build # Run only one specific test (which should invoke the dependencies) (cd $HERE/build; ctest -R write_world_after_hello) # Avoid using --test-dir option in ctest # Check if the output is as expected echo -n "Hello, World!" | diff - $HERE/build/output.txt ecbuild-3.14.1/tests/test_requires_simple/test_project/0000775000175000017500000000000015200367620023512 5ustar alastairalastairecbuild-3.14.1/tests/test_requires_simple/test_project/CMakeLists.txt0000664000175000017500000000116115200367620026251 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_test_requires_simple VERSION 0.1.0 LANGUAGES NONE ) ecbuild_add_test( TARGET clean_output COMMAND ${CMAKE_COMMAND} ARGS -E remove ${CMAKE_CURRENT_BINARY_DIR}/output.txt ) ecbuild_add_test( TARGET write_hello TEST_REQUIRES clean_output COMMAND bash ARGS -c "echo -n 'Hello, ' >> ${CMAKE_CURRENT_BINARY_DIR}/output.txt" ) ecbuild_add_test( TARGET write_world_after_hello TEST_REQUIRES write_hello COMMAND bash ARGS -c "echo -n 'World!' >> ${CMAKE_CURRENT_BINARY_DIR}/output.txt" ) ecbuild-3.14.1/tests/test_requires_simple/CMakeLists.txt0000664000175000017500000000041215200367620023542 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_test_requires_simple TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_regex_escape/0000775000175000017500000000000015200367620020657 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_regex_escape/test_ecbuild_regex_escape.cmake0000664000175000017500000000113015200367620027034 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) include( ecbuild_regex_escape ) set(testno 1) foreach(str "bla" "1.2" "a(b)" "a[b]" "x++" "a\\0" "x*" "x?" "a|b" "$v" "^a") message("Escaping '${str}'") ecbuild_regex_escape("${str}" test${testno}) message("-> ${test${testno}}") string(REGEX REPLACE "${test${testno}}" "match" test${testno}_match "${str}") if(NOT "${test${testno}_match}" STREQUAL "match") message(FATAL_ERROR "ecbuild_regex_escape not working as expected") endif() math(EXPR testno "${testno} + 1") endforeach() ecbuild-3.14.1/tests/ecbuild_regex_escape/CMakeLists.txt0000664000175000017500000000036115200367620023417 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_regex_escape TYPE SCRIPT COMMAND ${CMAKE_COMMAND} ARGS -DCMAKE_MODULE_PATH=${ECBUILD_MACROS_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_ecbuild_regex_escape.cmake ) ecbuild-3.14.1/tests/project_import/0000775000175000017500000000000015200367620017576 5ustar alastairalastairecbuild-3.14.1/tests/project_import/projectA/0000775000175000017500000000000015200367620021345 5ustar alastairalastairecbuild-3.14.1/tests/project_import/projectA/projecta-import.cmake.in0000664000175000017500000000025015200367620026070 0ustar alastairalastairset(projectA_FOO @projectA_FOO@) if(TARGET libA) message(FATAL_ERROR "libA should not be defined yet") else() message("libA not defined yet, as expected") endif() ecbuild-3.14.1/tests/project_import/projectA/libA.c0000664000175000017500000000004015200367620022352 0ustar alastairalastairint helloA(void) { return 1; } ecbuild-3.14.1/tests/project_import/projectA/CMakeLists.txt0000664000175000017500000000041715200367620024107 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(projectA VERSION 0.0 LANGUAGES C) set(projectA_FOO foo) set(projectA_BAR bar) ecbuild_add_library(TARGET libA SOURCES libA.c) ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/tests/project_import/projectA/projecta-post-import.cmake.in0000664000175000017500000000022515200367620027055 0ustar alastairalastairset(projectA_BAR @projectA_BAR@) if(NOT TARGET libA) message(FATAL_ERROR "libA not defined") else() message("libA defined as expected") endif() ecbuild-3.14.1/tests/project_import/projectC/0000775000175000017500000000000015200367620021347 5ustar alastairalastairecbuild-3.14.1/tests/project_import/projectC/CMakeLists.txt0000664000175000017500000000117615200367620024114 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(projectC VERSION 0.1 LANGUAGES NONE) find_package(projectA REQUIRED) find_package(projectB REQUIRED) set(EXP_projectA_FOO foo) set(EXP_projectA_BAR bar) set(EXP_projectB_FOO spam) set(EXP_projectB_BAR eggs) foreach(var projectA_FOO projectA_BAR projectB_FOO projectB_BAR) if(NOT DEFINED ${var}) message(FATAL_ERROR "${var} is not defined") elseif(NOT ${var} STREQUAL EXP_${var}) message(FATAL_ERROR "${var}: expected ${EXP_${var}}, got ${${var}}") else() message( "${var} = ${${var}} as expected") endif() endforeach() ecbuild-3.14.1/tests/project_import/run-test.sh.in0000775000175000017500000000175315200367620022331 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" export ecbuild_ROOT=@PROJECT_BINARY_DIR@ # --------------------- cleanup ------------------------ rm -rf $HERE/projectA/build rm -rf $HERE/projectA/install rm -rf $HERE/projectB/build rm -rf $HERE/projectB/install rm -rf $HERE/projectC/build rm -rf $HERE/projectC/install # ------------------ build projectA -------------------- cd $HERE mkdir -p projectA cd projectA projectA_ROOT=$PWD/install mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$projectA_ROOT @projectA_SOURCE_DIR@ make install # ------------------ build projectB -------------------- cd $HERE mkdir -p projectB cd projectB projectB_ROOT=$PWD/install mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$projectB_ROOT @projectB_SOURCE_DIR@ make install # ------------------ build projectC -------------------- cd $HERE mkdir -p projectC cd projectC export projectA_ROOT export projectB_ROOT mkdir build cd build cmake @projectC_SOURCE_DIR@ ecbuild-3.14.1/tests/project_import/projectB/0000775000175000017500000000000015200367620021346 5ustar alastairalastairecbuild-3.14.1/tests/project_import/projectB/projectb-post-import.cmake0000664000175000017500000000021315200367620026447 0ustar alastairalastairset(projectB_BAR eggs) if(NOT TARGET libB) message(FATAL_ERROR "libB not defined") else() message("libB defined as expected") endif() ecbuild-3.14.1/tests/project_import/projectB/CMakeLists.txt0000664000175000017500000000034215200367620024105 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.4 REQUIRED) project(projectB VERSION 0.0 LANGUAGES C) ecbuild_add_library(TARGET libB SOURCES libB.c) ecbuild_install_project(NAME ${PROJECT_NAME}) ecbuild-3.14.1/tests/project_import/projectB/projectb-import.cmake0000664000175000017500000000023615200367620025471 0ustar alastairalastairset(projectB_FOO spam) if(TARGET libB) message(FATAL_ERROR "libB should not be defined yet") else() message("libB not defined yet, as expected") endif() ecbuild-3.14.1/tests/project_import/projectB/libB.c0000664000175000017500000000004015200367620022354 0ustar alastairalastairint helloB(void) { return 2; } ecbuild-3.14.1/tests/project_import/CMakeLists.txt0000664000175000017500000000061315200367620022336 0ustar alastairalastair set( _ref ${CMAKE_CURRENT_BINARY_DIR} ) set( projectA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/projectA ) set( projectB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/projectB ) set( projectC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/projectC ) configure_file( run-test.sh.in ${_ref}/run-test.sh @ONLY ) ecbuild_add_test( TARGET project_import TYPE SCRIPT COMMAND ${_ref}/run-test.sh ) ecbuild-3.14.1/tests/ecbuild_add_flags/0000775000175000017500000000000015200367620020131 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_flags/run-test.sh.in0000775000175000017500000000033215200367620022654 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" cd $HERE rm -rf build # cleanup mkdir build cd build cmake -DCMAKE_MODULE_PATH=@ECBUILD_MACROS_DIR@ -DECBUILD_LOG_LEVEL=DEBUG ..ecbuild-3.14.1/tests/ecbuild_add_flags/test_ecbuild_add_flags.cmake0000664000175000017500000000366615200367620025600 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.6 REQUIRED ) project(TestFlags VERSION 1.0 LANGUAGES C CXX ) include(CheckCCompilerFlag) include( ecbuild_add_c_flags ) ecbuild_add_c_flags( "-O2" ) # should be able to add to (nearly) all compilers ecbuild_add_c_flags( "-g -O1" ) # should be able to add to (nearly) all compilers ecbuild_add_c_flags( "-O1" BUILD RELEASE) # should be able to add to (nearly) all compilers ecbuild_add_c_flags( "-g -O1" BUILD DEBUG) # should be able to add to (nearly) all compilers ecbuild_add_c_flags( "-fooxxx" NO_FAIL ) # should not add to any compiler ecbuild_add_cxx_flags( "-O1" ) # should be able to add to (nearly) all compilers ecbuild_add_cxx_flags( "-barxxx" NO_FAIL ) # should not add to any compiler message("CMAKE_C_FLAGS ${CMAKE_C_FLAGS}") message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}") if( CMAKE_C_FLAGS MATCHES "-O2" ) message("Flag -O2 added") else() message(FATAL_ERROR "Failed to add C flag -O2" ) endif() if( CMAKE_C_FLAGS MATCHES "-g -O1" ) message("Flag -g -O1 added") else() message(FATAL_ERROR "Failed to add C flag -g -O1" ) endif() if( CMAKE_C_FLAGS_RELEASE MATCHES "-O1" ) message("Flag -O1 added") else() message(FATAL_ERROR "Failed to add C flag -O1 to RELEASE" ) endif() if( CMAKE_C_FLAGS_DEBUG MATCHES "-g -O1" ) message("Flag -g -O1 added") else() message(FATAL_ERROR "Failed to add C flag -g -O1 to DEBUG" ) endif() if( CMAKE_C_FLAGS MATCHES "-fooxxx" ) message(FATAL_ERROR "Flag -fooxxx wrongly added" ) else() message("Successfully skipped addition of fake C flag -fooxxx") endif() if( CMAKE_CXX_FLAGS MATCHES "-O1" ) message("Flag -O1 added") else() message(FATAL_ERROR "Failed to add CXX flag -O1" ) endif() if( CMAKE_CXX_FLAGS MATCHES "-fantasyflag" ) message(FATAL_ERROR "Flag -fantasyflag wrongly added" ) else() message("Successfully skipped addition of fake CXX flag -fantasyflag") endif() ecbuild-3.14.1/tests/ecbuild_add_flags/CMakeLists.txt0000664000175000017500000000042115200367620022666 0ustar alastairalastairset(_dir ${CMAKE_CURRENT_BINARY_DIR}) configure_file(run-test.sh.in ${_dir}/run-test.sh @ONLY) configure_file(test_ecbuild_add_flags.cmake ${_dir}/CMakeLists.txt COPYONLY) ecbuild_add_test( TARGET test_ecbuild_add_flags TYPE SCRIPT COMMAND run-test.sh )ecbuild-3.14.1/tests/ecbuild_find_python/0000775000175000017500000000000015200367620020546 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/interpreter_and_libs_with_version_project/0000775000175000017500000000000015200367620031272 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/interpreter_and_libs_with_version_project/CMakeLists.txt0000664000175000017500000000245715200367620034042 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( project LANGUAGES NONE VERSION 0.2 ) ecbuild_find_python( VERSION 3.6 ) include(${CMAKE_SOURCE_DIR}/../cmake/expecting.cmake) expecting_true( CONDITION PYTHON_FOUND ) expecting_true( CONDITION PYTHONINTERP_FOUND ) expecting_true( CONDITION PYTHONLIBS_FOUND ) expecting_nonempty( CONDITION PYTHON_EXECUTABLE) expecting_nonempty( CONDITION PYTHON_VERSION_MAJOR ) expecting_nonempty( CONDITION PYTHON_VERSION_MINOR ) expecting_nonempty( CONDITION PYTHON_VERSION_PATCH ) expecting_nonempty( CONDITION PYTHON_VERSION_STRING ) expecting_nonempty( CONDITION PYTHON_INCLUDE_DIRS ) expecting_nonempty( CONDITION PYTHON_LIBRARIES ) expecting_nonempty( CONDITION PYTHON_SITE_PACKAGES ) expecting_true( CONDITION Python_FOUND ) expecting_true( CONDITION Python_Interpreter_FOUND ) expecting_true( CONDITION Python_Development_FOUND ) expecting_nonempty( CONDITION Python_EXECUTABLE ) expecting_nonempty( CONDITION Python_VERSION_MAJOR ) expecting_nonempty( CONDITION Python_VERSION_MINOR ) expecting_nonempty( CONDITION Python_VERSION_PATCH ) expecting_nonempty( CONDITION Python_VERSION ) expecting_nonempty( CONDITION Python_INCLUDE_DIRS ) expecting_nonempty( CONDITION Python_LIBRARIES ) expecting_nonempty( CONDITION Python_SITELIB )ecbuild-3.14.1/tests/ecbuild_find_python/clean.sh0000775000175000017500000000033115200367620022164 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/ecbuild_find_python/configure.sh0000775000175000017500000000335315200367620023072 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # Ensure Python 3.x is available # This effectively asserts that a working python3 exists, otherwise the script will fail here python3 --version # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- TC=1 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/interpreter_and_libs_project -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" TC=2 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/interpreter_and_libs_with_version_project -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" TC=3 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/interpreter_only_project -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" TC=4 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/interpreter_only_with_version_project -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" TC=5 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/nonexistent_version_project -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" ecbuild-3.14.1/tests/ecbuild_find_python/interpreter_only_project/0000775000175000017500000000000015200367620025700 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/interpreter_only_project/CMakeLists.txt0000664000175000017500000000244115200367620030441 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( project LANGUAGES NONE VERSION 0.2 ) ecbuild_find_python( NO_LIBS ) include(${CMAKE_SOURCE_DIR}/../cmake/expecting.cmake) expecting_true( CONDITION PYTHON_FOUND ) expecting_true( CONDITION PYTHONINTERP_FOUND ) expecting_false( CONDITION PYTHONLIBS_FOUND ) expecting_nonempty( CONDITION PYTHON_EXECUTABLE) expecting_nonempty( CONDITION PYTHON_VERSION_MAJOR ) expecting_nonempty( CONDITION PYTHON_VERSION_MINOR ) expecting_nonempty( CONDITION PYTHON_VERSION_PATCH ) expecting_nonempty( CONDITION PYTHON_VERSION_STRING ) expecting_empty( CONDITION PYTHON_INCLUDE_DIRS ) expecting_empty( CONDITION PYTHON_LIBRARIES ) expecting_nonempty( CONDITION PYTHON_SITE_PACKAGES ) expecting_true( CONDITION Python_FOUND ) expecting_true( CONDITION Python_Interpreter_FOUND ) expecting_false( CONDITION Python_Development_FOUND ) expecting_nonempty( CONDITION Python_EXECUTABLE ) expecting_nonempty( CONDITION Python_VERSION_MAJOR ) expecting_nonempty( CONDITION Python_VERSION_MINOR ) expecting_nonempty( CONDITION Python_VERSION_PATCH ) expecting_nonempty( CONDITION Python_VERSION ) expecting_empty( CONDITION Python_INCLUDE_DIRS ) expecting_empty( CONDITION Python_LIBRARIES ) expecting_nonempty( CONDITION Python_SITELIB )ecbuild-3.14.1/tests/ecbuild_find_python/interpreter_only_with_version_project/0000775000175000017500000000000015200367620030500 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/interpreter_only_with_version_project/CMakeLists.txt0000664000175000017500000000245415200367620033245 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( project LANGUAGES NONE VERSION 0.2 ) ecbuild_find_python( VERSION 3.6 NO_LIBS) include(${CMAKE_SOURCE_DIR}/../cmake/expecting.cmake) expecting_true( CONDITION PYTHON_FOUND ) expecting_true( CONDITION PYTHONINTERP_FOUND ) expecting_false( CONDITION PYTHONLIBS_FOUND ) expecting_nonempty( CONDITION PYTHON_EXECUTABLE) expecting_nonempty( CONDITION PYTHON_VERSION_MAJOR ) expecting_nonempty( CONDITION PYTHON_VERSION_MINOR ) expecting_nonempty( CONDITION PYTHON_VERSION_PATCH ) expecting_nonempty( CONDITION PYTHON_VERSION_STRING ) expecting_empty( CONDITION PYTHON_INCLUDE_DIRS ) expecting_empty( CONDITION PYTHON_LIBRARIES ) expecting_nonempty( CONDITION PYTHON_SITE_PACKAGES ) expecting_true( CONDITION Python_FOUND ) expecting_true( CONDITION Python_Interpreter_FOUND ) expecting_false( CONDITION Python_Development_FOUND ) expecting_nonempty( CONDITION Python_EXECUTABLE ) expecting_nonempty( CONDITION Python_VERSION_MAJOR ) expecting_nonempty( CONDITION Python_VERSION_MINOR ) expecting_nonempty( CONDITION Python_VERSION_PATCH ) expecting_nonempty( CONDITION Python_VERSION ) expecting_empty( CONDITION Python_INCLUDE_DIRS ) expecting_empty( CONDITION Python_LIBRARIES ) expecting_nonempty( CONDITION Python_SITELIB )ecbuild-3.14.1/tests/ecbuild_find_python/interpreter_and_libs_project/0000775000175000017500000000000015200367620026472 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/interpreter_and_libs_project/CMakeLists.txt0000664000175000017500000000244315200367620031235 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( project LANGUAGES NONE VERSION 0.2 ) ecbuild_find_python( ) include(${CMAKE_SOURCE_DIR}/../cmake/expecting.cmake) expecting_true( CONDITION PYTHON_FOUND ) expecting_true( CONDITION PYTHONINTERP_FOUND ) expecting_true( CONDITION PYTHONLIBS_FOUND ) expecting_nonempty( CONDITION PYTHON_EXECUTABLE) expecting_nonempty( CONDITION PYTHON_VERSION_MAJOR ) expecting_nonempty( CONDITION PYTHON_VERSION_MINOR ) expecting_nonempty( CONDITION PYTHON_VERSION_PATCH ) expecting_nonempty( CONDITION PYTHON_VERSION_STRING ) expecting_nonempty( CONDITION PYTHON_INCLUDE_DIRS ) expecting_nonempty( CONDITION PYTHON_LIBRARIES ) expecting_nonempty( CONDITION PYTHON_SITE_PACKAGES ) expecting_true( CONDITION Python_FOUND ) expecting_true( CONDITION Python_Interpreter_FOUND ) expecting_true( CONDITION Python_Development_FOUND ) expecting_nonempty( CONDITION Python_EXECUTABLE ) expecting_nonempty( CONDITION Python_VERSION_MAJOR ) expecting_nonempty( CONDITION Python_VERSION_MINOR ) expecting_nonempty( CONDITION Python_VERSION_PATCH ) expecting_nonempty( CONDITION Python_VERSION ) expecting_nonempty( CONDITION Python_INCLUDE_DIRS ) expecting_nonempty( CONDITION Python_LIBRARIES ) expecting_nonempty( CONDITION Python_SITELIB )ecbuild-3.14.1/tests/ecbuild_find_python/nonexistent_version_project/0000775000175000017500000000000015200367620026417 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/nonexistent_version_project/CMakeLists.txt0000664000175000017500000000047115200367620031161 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( project LANGUAGES NONE VERSION 0.2 ) ecbuild_find_python( VERSION 3.999) include(${CMAKE_SOURCE_DIR}/../cmake/expecting.cmake) expecting_false( CONDITION PYTHON_FOUND ) expecting_false( CONDITION Python_FOUND ) ecbuild-3.14.1/tests/ecbuild_find_python/cmake/0000775000175000017500000000000015200367620021626 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_python/cmake/expecting.cmake0000664000175000017500000000345115200367620024621 0ustar alastairalastair function( expecting_true ) set( options ) set( single_value_args CONDITION ) set( multi_value_args ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) ecbuild_debug( "Checking if true: ${_p_CONDITION}=${${_p_CONDITION}}" ) if ( NOT ${${_p_CONDITION}} ) ecbuild_critical( "Expected condition ${_p_CONDITION} to be true" ) endif() endfunction() function( expecting_false ) set( options ) set( single_value_args CONDITION ) set( multi_value_args ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) ecbuild_debug( "Checking if true: ${_p_CONDITION}=${${_p_CONDITION}}" ) if ( ${${_p_CONDITION}} ) ecbuild_critical( "Expected condition ${_p_CONDITION} to be false" ) endif() endfunction() function( expecting_empty ) set( options ) set( single_value_args CONDITION ) set( multi_value_args ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) ecbuild_debug( "Checking if nonempty: ${_p_CONDITION}=${${_p_CONDITION}}" ) if ( NOT "${${_p_CONDITION}}" STREQUAL "" ) ecbuild_critical( "Expected condition ${_p_CONDITION} to be a non-empty string" ) endif() endfunction() function( expecting_nonempty ) set( options ) set( single_value_args CONDITION ) set( multi_value_args ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) ecbuild_debug( "Checking if nonempty: ${_p_CONDITION}=${${_p_CONDITION}}" ) if ( "${${_p_CONDITION}}" STREQUAL "" ) ecbuild_critical( "Expected condition ${_p_CONDITION} to be a non-empty string" ) endif() endfunction() ecbuild-3.14.1/tests/ecbuild_find_python/CMakeLists.txt0000664000175000017500000000037515200367620023313 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_find_python TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_shared_libs/0000775000175000017500000000000015200367620020504 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_shared_libs/clean.sh0000775000175000017500000000035115200367620022124 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build rm -f $HERE/*.log ecbuild-3.14.1/tests/ecbuild_shared_libs/build-and-run.sh0000775000175000017500000000406715200367620023513 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE check_lib_exists() { local libname=$1 local ext=$2 if [ ! -f $HERE/build/lib/lib${libname}.$ext ]; then echo "$HERE/build/lib/lib${libname}.$ext not found" exit 1 fi } dyn_ext="so" if [[ $(uname) == "Darwin" ]]; then dyn_ext="dylib" fi static_ext="a" logf=$HERE/test_ecbuild_shared_libs.log # enable shared libraries across project $SOURCE/clean.sh ecbuild -DENABLE_TESTS=OFF -DTEST_SHARED_LIBS_BUILD_SHARED_LIBS=OFF $SOURCE/test_project -B $HERE/build cmake --build build check_lib_exists test_shared_libs ${static_ext} check_lib_exists lib2 ${static_ext} check_lib_exists lib1 ${dyn_ext} # test that BUILD_SHARED_LIBS is overriden $SOURCE/clean.sh ecbuild -DENABLE_TESTS=OFF -DTEST_SHARED_LIBS_BUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=ON $SOURCE/test_project -B $HERE/build cmake --build build check_lib_exists test_shared_libs ${static_ext} check_lib_exists lib2 ${static_ext} check_lib_exists lib1 ${dyn_ext} # test ecbuild failure for invalid argument $SOURCE/clean.sh ecbuild -DENABLE_TESTS=OFF -DTEST_SHARED_LIBS_BUILD_SHARED_LIBS=SHARED $SOURCE/test_project -B $HERE/build >$logf 2>&1 || result=$? if [ ! $result ]; then echo "ecbuild should have failed for invalid argument" cat $logf exit 1 fi # enable target specific override 1 $SOURCE/clean.sh ecbuild -DENABLE_TESTS=OFF -DECBUILD_TARGET_test_shared_libs_TYPE=SHARED -DBUILD_SHARED_LIBS=OFF $SOURCE/test_project -B $HERE/build cmake --build build check_lib_exists test_shared_libs ${dyn_ext} check_lib_exists lib2 ${static_ext} check_lib_exists lib1 ${dyn_ext} # enable target specific override 2 $SOURCE/clean.sh ecbuild -DENABLE_TESTS=OFF -DECBUILD_TARGET_test_shared_libs_TYPE=STATIC $SOURCE/test_project -B $HERE/build cmake --build build check_lib_exists test_shared_libs ${static_ext} check_lib_exists lib2 ${dyn_ext} check_lib_exists lib1 ${dyn_ext} ecbuild-3.14.1/tests/ecbuild_shared_libs/test_project/0000775000175000017500000000000015200367620023211 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_shared_libs/test_project/dummy_src.F900000664000175000017500000000003215200367620025466 0ustar alastairalastairprogram main end program ecbuild-3.14.1/tests/ecbuild_shared_libs/test_project/CMakeLists.txt0000664000175000017500000000057015200367620025753 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_shared_libs VERSION 0.1.0 LANGUAGES Fortran ) ecbuild_add_library( TARGET test_shared_libs SOURCES dummy_src.F90 ) # this should never be overriden ecbuild_add_library( TARGET lib1 TYPE SHARED SOURCES dummy_src.F90 ) ecbuild_add_library( TARGET lib2 SOURCES dummy_src.F90 ) ecbuild-3.14.1/tests/ecbuild_shared_libs/CMakeLists.txt0000664000175000017500000000040115200367620023237 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_shared_libs TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_find_package/0000775000175000017500000000000015200367620020620 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_package/projectA/0000775000175000017500000000000015200367620022367 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_package/projectA/libraryA.cc0000664000175000017500000000053315200367620024444 0ustar alastairalastair#include "libraryA.h" #ifdef A_PRIVATE #error A_PRIVATE should not be exported by target projectA_private #endif #ifndef A_PUBLIC #error A_PUBLIC should have been exported by target projectA_private #endif #ifndef A_EXPORT #error A_EXPORT should be defined #endif extern int libraryA_Private(); int libraryA() { return libraryA_Private(); } ecbuild-3.14.1/tests/ecbuild_find_package/projectA/libraryA_Private.cc0000664000175000017500000000023715200367620026137 0ustar alastairalastair#ifndef A_PRIVATE #error A_PRIVATE should be defined #endif #ifndef A_PUBLIC #error A_PUBLIC should be defined #endif int libraryA_Private() { return 1; }ecbuild-3.14.1/tests/ecbuild_find_package/projectA/projecta-import.cmake.in0000664000175000017500000000015215200367620027113 0ustar alastairalastair if( NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY ) message( "Importing projectA, not QUIET!!!") endif() ecbuild-3.14.1/tests/ecbuild_find_package/projectA/libraryA.h0000664000175000017500000000001715200367620024303 0ustar alastairalastairint libraryA();ecbuild-3.14.1/tests/ecbuild_find_package/projectA/CMakeLists.txt0000664000175000017500000000072415200367620025132 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( projectA VERSION 1.1.0 LANGUAGES CXX ) ecbuild_add_library( TARGET projectA_Private SOURCES libraryA_Private.cc PRIVATE_DEFINITIONS A_PRIVATE PUBLIC_DEFINITIONS A_PUBLIC ) ecbuild_add_library( TARGET projectA SOURCES libraryA.h libraryA.cc INSTALL_HEADERS LISTED PRIVATE_LIBS projectA_Private PUBLIC_DEFINITIONS A_EXPORT ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/tests/ecbuild_find_package/clean.sh0000775000175000017500000000056315200367620022245 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/projectA/build rm -rf $HERE/projectA/install rm -rf $HERE/projectB/build rm -rf $HERE/projectB/install rm -rf $HERE/projectC/build rm -rf $HERE/projectC/install ecbuild-3.14.1/tests/ecbuild_find_package/projectC/0000775000175000017500000000000015200367620022371 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_package/projectC/main.cc0000664000175000017500000000023315200367620023622 0ustar alastairalastair#include #include "libraryC.h" int main(int argc, char* argv[]) { std::cout << "libraryC = " << libraryC() << std::endl; return 0; } ecbuild-3.14.1/tests/ecbuild_find_package/projectC/libraryC.cc0000664000175000017500000000022615200367620024447 0ustar alastairalastair#ifndef A_EXPORT #error A_EXPORT should be exported by projectA via projectB #endif extern int libraryB(); int libraryC() { return libraryB(); } ecbuild-3.14.1/tests/ecbuild_find_package/projectC/libraryC.h0000664000175000017500000000001715200367620024307 0ustar alastairalastairint libraryC();ecbuild-3.14.1/tests/ecbuild_find_package/projectC/cmake/0000775000175000017500000000000015200367620023451 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_package/projectC/cmake/FindprojectB.cmake0000664000175000017500000000010115200367620027014 0ustar alastairalastairset( projectB_MODULE TRUE ) find_package( projectB NO_MODULE ) ecbuild-3.14.1/tests/ecbuild_find_package/projectC/CMakeLists.txt0000664000175000017500000000103115200367620025124 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( projectC VERSION 0.1.0 LANGUAGES CXX ) ecbuild_find_package( NAME projectB REQUIRED ) if( NOT projectB_MODULE ) ecbuild_critical( "projectB must be found via contained cmake/FindprojectB.cmake") endif() ecbuild_add_library( TARGET projectC SOURCES libraryC.cc libraryC.h INSTALL_HEADERS LISTED PRIVATE_LIBS projectB ) ecbuild_add_executable( TARGET main-C SOURCES main.cc LIBS projectC ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/tests/ecbuild_find_package/README.md0000664000175000017500000000126115200367620022077 0ustar alastairalastair# Transitive dependencies across projects and using ecbuild_find_package This example contains 3 projects, where projectB depends on projectA, and projectC depends on projectB. Since projectB requires linking against projectA, the `projectB/projectb-import.cmake.in` file propagates the dependency (it gets included when a package calls `find_package(projectB)`). It also demonstrates PRIVATE (build requirements) and PUBLIC (usage requirements) dependency keywords. projectC searches for projectB using a FindprojectB module, which in turn uses a find_package( projectB NO_MODULE ) This demonstrates that ecbuild_find_package now prioritises Find modules. ## Usage ./build-and-run.sh ecbuild-3.14.1/tests/ecbuild_find_package/build-and-run.sh0000775000175000017500000000205515200367620023622 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- build projectA --------------------- mkdir -p $HERE/projectA/build && cd $HERE/projectA/build pwd ecbuild --prefix=../install -- -Wno-deprecated $SOURCE/projectA make install export projectA_ROOT=$HERE/projectA/install # ----------------- build projectB --------------------- mkdir -p $HERE/projectB/build && cd $HERE/projectB/build ecbuild --prefix=../install -- -Wno-deprecated $SOURCE/projectB make install export projectB_ROOT=$HERE/projectB/install # ----------------- build projectC --------------------- mkdir -p $HERE/projectC/build && cd $HERE/projectC/build ecbuild --prefix=../install -- -Wno-deprecated $SOURCE/projectC make install # ----------------- Run --------------------- $HERE/projectC/install/bin/main-C ecbuild-3.14.1/tests/ecbuild_find_package/projectB/0000775000175000017500000000000015200367620022370 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_find_package/projectB/projectb-import.cmake.in0000664000175000017500000000042515200367620027120 0ustar alastairalastairif( NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY ) message( "Importing projectB, not QUIET!!!") endif() # projectB requires projectA. # find_dependency propagates QUIET and REQUIRED keywords from current scope include( CMakeFindDependencyMacro ) find_dependency( projectA ) ecbuild-3.14.1/tests/ecbuild_find_package/projectB/libraryB.h0000664000175000017500000000001715200367620024305 0ustar alastairalastairint libraryB();ecbuild-3.14.1/tests/ecbuild_find_package/projectB/libraryB.cc0000664000175000017500000000053215200367620024445 0ustar alastairalastair#ifdef A_PRIVATE #error A_PRIVATE should not be exported by target projectA_private #endif #ifdef A_PUBLIC #error A_PUBLIC should not be exported by target projectA #endif #ifndef A_EXPORT #error A_EXPORT should have been exported by target projectA #endif #include "libraryB.h" extern int libraryA(); int libraryB() { return libraryA(); } ecbuild-3.14.1/tests/ecbuild_find_package/projectB/CMakeLists.txt0000664000175000017500000000066415200367620025136 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( projectB VERSION 0.1.0 LANGUAGES CXX ) ecbuild_find_package( NAME projectA REQUIRED QUIET ) ecbuild_add_library( TARGET projectB SOURCES libraryB.cc libraryB.h INSTALL_HEADERS LISTED PUBLIC_LIBS projectA ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild_debug_var( CMAKE_MODULE_PATH ) ecbuild_debug_var( CMAKE_SYSTEM_MODULE_PATH )ecbuild-3.14.1/tests/ecbuild_find_package/CMakeLists.txt0000664000175000017500000000040215200367620023354 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_find_package TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/bundle_options/0000775000175000017500000000000015200367620017562 5ustar alastairalastairecbuild-3.14.1/tests/bundle_options/projx/0000775000175000017500000000000015200367620020724 5ustar alastairalastairecbuild-3.14.1/tests/bundle_options/projx/projb/0000775000175000017500000000000015200367620022040 5ustar alastairalastairecbuild-3.14.1/tests/bundle_options/projx/projb/CMakeLists.txt0000664000175000017500000000026015200367620024576 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( projb LANGUAGES NONE VERSION 0.2 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT OFF CONDITION SOME_PACKAGE_FOUND ) ecbuild-3.14.1/tests/bundle_options/projx/proja/0000775000175000017500000000000015200367620022037 5ustar alastairalastairecbuild-3.14.1/tests/bundle_options/projx/proja/CMakeLists.txt0000664000175000017500000000021615200367620024576 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( proja LANGUAGES NONE VERSION 0.1 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT ON ) ecbuild-3.14.1/tests/bundle_options/projx/CMakeLists.txt0000664000175000017500000000032215200367620023461 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( projx LANGUAGES NONE VERSION 0.1 ) add_subdirectory( proja ) add_subdirectory( projb ) ecbuild_print_summary()ecbuild-3.14.1/tests/bundle_options/clean.sh0000775000175000017500000000033115200367620021200 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/bundle_options/configure.sh0000775000175000017500000001246115200367620022106 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep -e "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- # (0) Options: (default) # proja, FEATURE_A is enabled (by default) # projb, FEATURE_A is disabled (by default) TC=0 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*proja(ON): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*projb(OFF): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" # (1) Options: -DSOME_PACKAGE_FOUND # proja, FEATURE_A is enabled (by default) # projb, FEATURE_A is disabled (by default), event if the conditional package is found TC=1 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DSOME_PACKAGE_FOUND=ON -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*proja(ON): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*projb(OFF): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" # (2) Options: -DENABLE_FEATURE_A=ON # proja, FEATURE_A is explicitly enabled (by global option) # projb, FEATURE_A is explicitly enabled (by global option), but fails since the conditional package is not found TC=2 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=ON -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log " Configuring incomplete, errors occurred" # (3) Options: -DENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=ON # proja, FEATURE_A is explicitly enabled (by global option) # projb, FEATURE_A is explicitly enabled (by global option), and succeeds because the conditional package is found TC=3 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=ON -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*proja(ON): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*projb(ON): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" # (4) Options: -DENABLE_FEATURE_A=OFF # proja, FEATURE_A is explicitly disabled (by global option) # projb, FEATURE_A is explicitly disabled (by global option) TC=4 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=OFF -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*proja(OFF): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*projb(OFF): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" # (5) Options: -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON # proja, FEATURE_A is explicitly disabled (by global option) # projb, FEATURE_A is explicitly enabled (by project-specific option), but fails since the conditional package is not found TC=5 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log " Configuring incomplete, errors occurred" # (6) Options: -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=ON # proja, FEATURE_A is explicitly disabled (by global option) # projb, FEATURE_A is explicitly enabled (by project-specific option), possible because the conditional package is found TC=6 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=ON -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*proja(OFF): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*projb(ON): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" # (7) Options: -DENABLE_FEATURE_A=ON -DPROJA_ENABLE_FEATURE_A=OFF # proja, FEATURE_A is explicitly disabled (by project-specific option) # projb, FEATURE_A is explicitly enabled (by global option), but fails since the conditional package is not found TC=7 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=ON -DPROJA_ENABLE_FEATURE_A=OFF -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log " Configuring incomplete, errors occurred" # (8) Options: -DENABLE_FEATURE_A=ON -DPROJB_ENABLE_FEATURE_A=OFF -DSOME_PACKAGE_FOUND=ON # proja, FEATURE_A is explicitly enabled (by global option) # projb, FEATURE_A is explicitly disabled (by project-specific option), event if the conditional package is found TC=8 mkdir -p $HERE/build_${TC} ecbuild $SOURCE/projx -DENABLE_FEATURE_A=ON -DPROJB_ENABLE_FEATURE_A=OFF -DSOME_PACKAGE_FOUND=ON -B $HERE/build_${TC} | tee $HERE/build_${TC}.log EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*proja(ON): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "FEATURE_A, .*projb(OFF): ''.*" EXPECT_ONE_OF $HERE/build_${TC}.log "Build files have been written" ecbuild-3.14.1/tests/bundle_options/CMakeLists.txt0000664000175000017500000000040015200367620022314 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_bundle_options TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/0000775000175000017500000000000015200367620024631 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/emptyfile.F900000664000175000017500000000002015200367620027077 0ustar alastairalastair! An empty file ecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/compiler_flags.cmake0000664000175000017500000000035615200367620030625 0ustar alastairalastairset( OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS "${OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS} -included_flag" ) set( OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS_BIT "${OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS_BIT} -included_bit_flag" ) ecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/run-test.sh.in0000775000175000017500000000055215200367620027360 0ustar alastairalastair#!/usr/bin/env bash set -euo pipefail HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" cd "$HERE" rm -rf build mkdir build cd build cmake -DCMAKE_MODULE_PATH=@ECBUILD_MACROS_DIR@ -DECBUILD_LOG_LEVEL=DEBUG -DCMAKE_BUILD_TYPE=BIT .. 2>&1 | tee configure.log grep -F "Skipping" configure.log grep -F "compiler flags are already defined" configure.log ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/test_ecbuild_override_compiler_flags_bailout.cmakeecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/test_ecbuild_override_compiler_flags_ba0000664000175000017500000000311115200367620034625 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.6 REQUIRED ) project(OverrideCompilerFlagsBailout VERSION 1.0 LANGUAGES Fortran) set( OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS "-developer_owned" ) set( ECBUILD_Fortran_FLAGS "-ecbuild_owned" ) set( ECBUILD_Fortran_FLAGS_BIT "-ecbuild_bit" ) ecbuild_override_compiler_flags( COMPILE_FLAGS ${CMAKE_CURRENT_SOURCE_DIR}/compiler_flags.cmake INHERIT_ECBUILD_FLAGS ) if( NOT OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS STREQUAL "-developer_owned" ) message(FATAL_ERROR "Project Fortran flags should not be overwritten when bailout is triggered") endif() if( DEFINED OVERRIDECOMPILERFLAGSBAILOUT_Fortran_FLAGS_BIT ) message(FATAL_ERROR "Build-type project Fortran flags should not be inherited when bailout is triggered") endif() ecbuild_add_library( TARGET bailoutflags SOURCES emptyfile.F90 ) get_property( _flags SOURCE emptyfile.F90 PROPERTY COMPILE_FLAGS ) if( NOT _flags MATCHES "-developer_owned" ) message(${_flags}) message(FATAL_ERROR "Missing developer-owned Fortran flags for emptyfile.F90") endif() if( _flags MATCHES "-ecbuild_owned" ) message(${_flags}) message(FATAL_ERROR "ECBUILD common Fortran flags should not be inherited when bailout is triggered") endif() if( _flags MATCHES "-ecbuild_bit" ) message(${_flags}) message(FATAL_ERROR "ECBUILD build-type Fortran flags should not be inherited when bailout is triggered") endif() if( _flags MATCHES "-included_flag" ) message(${_flags}) message(FATAL_ERROR "Compile flags include should be skipped when bailout is triggered") endif() ecbuild-3.14.1/tests/ecbuild_override_compiler_flags_bailout/CMakeLists.txt0000664000175000017500000000070615200367620027374 0ustar alastairalastairset(_dir ${CMAKE_CURRENT_BINARY_DIR}) configure_file(run-test.sh.in ${_dir}/run-test.sh @ONLY) configure_file(test_ecbuild_override_compiler_flags_bailout.cmake ${_dir}/CMakeLists.txt COPYONLY) configure_file(compiler_flags.cmake ${_dir}/compiler_flags.cmake COPYONLY) configure_file(emptyfile.F90 ${_dir}/emptyfile.F90 COPYONLY) ecbuild_add_test( TARGET test_ecbuild_override_compiler_flags_bailout TYPE SCRIPT COMMAND run-test.sh ) ecbuild-3.14.1/tests/project_summary/0000775000175000017500000000000015200367620017761 5ustar alastairalastairecbuild-3.14.1/tests/project_summary/clean.sh0000775000175000017500000000033115200367620021377 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/project_summary/configure.sh0000775000175000017500000000610115200367620022277 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- # Options: (defaults) mkdir -p $HERE/build_0 ecbuild $SOURCE/test_project -B $HERE/build_0 | tee $HERE/build_0.log EXPECT_ONE_OF $HERE/build_0.log "* FEATURE_A, proja(ON): '', projb(OFF): ''" EXPECT_ONE_OF $HERE/build_0.log "* FEATURE_B, projb(OFF): ''" EXPECT_ONE_OF $HERE/build_0.log "* FEATURE_C, projc(OFF): ''" EXPECT_ONE_OF $HERE/build_0.log "Build files have been written" # Options: -DENABLE_FEATURE_A=ON mkdir -p $HERE/build_1 ecbuild -DENABLE_FEATURE_A=ON $SOURCE/test_project -B $HERE/build_1 | tee $HERE/build_1.log EXPECT_ONE_OF $HERE/build_1.log "* FEATURE_A, proja(ON): '', projb(ON): ''" # Options: -DENABLE_FEATURE_A=ON -DPROJB_ENABLE_FEATURE_A=OFF mkdir -p $HERE/build_2 ecbuild -DENABLE_FEATURE_A=ON -DPROJB_ENABLE_FEATURE_A=OFF $SOURCE/test_project -B $HERE/build_2 | tee $HERE/build_2.log EXPECT_ONE_OF $HERE/build_2.log "* FEATURE_A, proja(ON): '', projb(OFF): ''" # Options: -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=OFF mkdir -p $HERE/build_3 ecbuild -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=OFF $SOURCE/test_project -B $HERE/build_3 | tee $HERE/build_3.log EXPECT_ONE_OF $HERE/build_3.log "* FEATURE_A, proja(OFF): '', projb(ON): ''" EXPECT_ONE_OF $HERE/build_3.log "* FEATURE_B, projb(OFF): ''" # Options: -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=ON mkdir -p $HERE/build_4 ecbuild -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DSOME_PACKAGE_FOUND=ON $SOURCE/test_project -B $HERE/build_4 | tee $HERE/build_4.log EXPECT_ONE_OF $HERE/build_4.log "* FEATURE_A, proja(OFF): '', projb(ON): ''" EXPECT_ONE_OF $HERE/build_4.log "* FEATURE_B, projb(ON): ''" # Options: -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DENABLE_FEATURE_B=ON -DSOME_PACKAGE_FOUND=ON mkdir -p $HERE/build_5 ecbuild -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DENABLE_FEATURE_B=ON -DSOME_PACKAGE_FOUND=ON $SOURCE/test_project -B $HERE/build_5 | tee $HERE/build_5.log EXPECT_ONE_OF $HERE/build_5.log "* FEATURE_A, proja(OFF): '', projb(ON): ''" EXPECT_ONE_OF $HERE/build_5.log "* FEATURE_B, projb(ON): ''" # Options: -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DENABLE_FEATURE_B=ON -DSOME_PACKAGE_FOUND=OFF mkdir -p $HERE/build_6 ecbuild -DENABLE_FEATURE_A=OFF -DPROJB_ENABLE_FEATURE_A=ON -DENABLE_FEATURE_B=ON -DSOME_PACKAGE_FOUND=OFF $SOURCE/test_project -B $HERE/build_6 | tee $HERE/build_6.log EXPECT_ONE_OF $HERE/build_6.log "Configuring incomplete, errors occurred!" ecbuild-3.14.1/tests/project_summary/test_project/0000775000175000017500000000000015200367620022466 5ustar alastairalastairecbuild-3.14.1/tests/project_summary/test_project/projb/0000775000175000017500000000000015200367620023602 5ustar alastairalastairecbuild-3.14.1/tests/project_summary/test_project/projb/CMakeLists.txt0000664000175000017500000000033515200367620026343 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( projb LANGUAGES NONE VERSION 0.1 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT OFF ) ecbuild_add_option( FEATURE FEATURE_B CONDITION SOME_PACKAGE_FOUND ) ecbuild-3.14.1/tests/project_summary/test_project/projc/0000775000175000017500000000000015200367620023603 5ustar alastairalastairecbuild-3.14.1/tests/project_summary/test_project/projc/CMakeLists.txt0000664000175000017500000000026015200367620026341 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( projc LANGUAGES NONE VERSION 0.3 ) ecbuild_add_option( FEATURE FEATURE_C DEFAULT ON REQUIRED_PACKAGES NONEXISTENT ) ecbuild-3.14.1/tests/project_summary/test_project/proja/0000775000175000017500000000000015200367620023601 5ustar alastairalastairecbuild-3.14.1/tests/project_summary/test_project/proja/CMakeLists.txt0000664000175000017500000000021615200367620026340 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( proja LANGUAGES NONE VERSION 0.2 ) ecbuild_add_option( FEATURE FEATURE_A DEFAULT ON ) ecbuild-3.14.1/tests/project_summary/test_project/CMakeLists.txt0000664000175000017500000000035315200367620025227 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( main LANGUAGES NONE VERSION 0.1 ) add_subdirectory( proja ) add_subdirectory( projb ) add_subdirectory( projc ) ecbuild_print_summary()ecbuild-3.14.1/tests/project_summary/CMakeLists.txt0000664000175000017500000000040115200367620022514 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_project_summary TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/project_options_cached_multiproject/0000775000175000017500000000000015200367620024047 5ustar alastairalastairecbuild-3.14.1/tests/project_options_cached_multiproject/clean.sh0000775000175000017500000000033115200367620025465 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/project_options_cached_multiproject/configure.sh0000775000175000017500000000410015200367620026362 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- # (1) Configure with default options, and then reconfigure with user specified options mkdir -p $HERE/build_1 ecbuild $SOURCE/test_project -B $HERE/build_1 -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.a.log # Ensure the option values are correct in CMake output EXPECT_ONE_OF $HERE/build_1.a.log "FEATUREA.*proja(ON): ''" EXPECT_ONE_OF $HERE/build_1.a.log "FEATUREA.*projb(OFF): ''" EXPECT_ONE_OF $HERE/build_1.a.log "FEATUREB.*proja(ON): ''" # Uses value specified at 'bundle' level EXPECT_ONE_OF $HERE/build_1.a.log "FEATUREB.*projb(ON): ''" EXPECT_ONE_OF $HERE/build_1.a.log "FEATUREC.*proja(OFF): ''" # Uses value specified at 'bundle' level EXPECT_ONE_OF $HERE/build_1.a.log "FEATUREC.*projb(OFF): ''" EXPECT_ONE_OF $HERE/build_1.a.log "Build files have been written" ecbuild $SOURCE/test_project -B $HERE/build_1 -DENABLE_FEATUREA=ON -DENABLE_FEATUREB=OFF -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.b.log # Ensure the option values are correct in CMake output EXPECT_ONE_OF $HERE/build_1.b.log "FEATUREA.*proja(ON): ''" EXPECT_ONE_OF $HERE/build_1.b.log "FEATUREA.*projb(ON): ''" EXPECT_ONE_OF $HERE/build_1.b.log "FEATUREB.*proja(OFF): ''" # Uses value specified by 'CLI' EXPECT_ONE_OF $HERE/build_1.b.log "FEATUREB.*projb(OFF): ''" EXPECT_ONE_OF $HERE/build_1.b.log "FEATUREC.*proja(OFF): ''" # Uses value specified at 'bundle' level EXPECT_ONE_OF $HERE/build_1.b.log "FEATUREC.*projb(OFF): ''" EXPECT_ONE_OF $HERE/build_1.b.log "Build files have been written" ecbuild-3.14.1/tests/project_options_cached_multiproject/test_project/0000775000175000017500000000000015200367620026554 5ustar alastairalastairecbuild-3.14.1/tests/project_options_cached_multiproject/test_project/projb/0000775000175000017500000000000015200367620027670 5ustar alastairalastairecbuild-3.14.1/tests/project_options_cached_multiproject/test_project/projb/CMakeLists.txt0000664000175000017500000000040515200367620032427 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( projb LANGUAGES NONE VERSION 0.1 ) ecbuild_add_option( FEATURE FEATUREA DEFAULT OFF ) ecbuild_add_option( FEATURE FEATUREB DEFAULT ON ) ecbuild_add_option( FEATURE FEATUREC DEFAULT OFF )ecbuild-3.14.1/tests/project_options_cached_multiproject/test_project/proja/0000775000175000017500000000000015200367620027667 5ustar alastairalastairecbuild-3.14.1/tests/project_options_cached_multiproject/test_project/proja/CMakeLists.txt0000664000175000017500000000040515200367620032426 0ustar alastairalastair find_package( ecbuild 3.4 REQUIRED ) project( proja LANGUAGES NONE VERSION 0.2 ) ecbuild_add_option( FEATURE FEATUREA DEFAULT ON ) ecbuild_add_option( FEATURE FEATUREB DEFAULT OFF ) ecbuild_add_option( FEATURE FEATUREC DEFAULT OFF )ecbuild-3.14.1/tests/project_options_cached_multiproject/test_project/CMakeLists.txt0000664000175000017500000000044715200367620031321 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( bundle LANGUAGES NONE VERSION 0.2 ) set ( ENABLE_FEATUREB ON CACHE BOOL "" ) set ( ENABLE_FEATUREC OFF CACHE BOOL "" ) add_subdirectory( proja ) add_subdirectory( projb ) ecbuild_print_summary()ecbuild-3.14.1/tests/project_options_cached_multiproject/CMakeLists.txt0000664000175000017500000000042515200367620026610 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_project_options_cached_multiproject TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/0000775000175000017500000000000015200367620023112 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_override_compiler_flags/emptyfile.cxx0000664000175000017500000000002115200367620025625 0ustar alastairalastair// An empty file ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/emptyfile.F900000664000175000017500000000002015200367620025360 0ustar alastairalastair! An empty file ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/test_ecbuild_override_compiler_flags.cmake0000664000175000017500000000463315200367620033535 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.6 REQUIRED ) project(OverrideCompilerFlags VERSION 1.0 LANGUAGES C CXX Fortran) set( ECBUILD_C_FLAGS "-user_common_c" ) set( ECBUILD_C_FLAGS_DEBUG "-user_debug_c" ) set( ECBUILD_C_FLAGS_BIT "-user_bit_c" ) set( ECBUILD_Fortran_FLAGS "-user_common_fortran" ) ecbuild_override_compiler_flags( COMPILE_FLAGS ${CMAKE_CURRENT_SOURCE_DIR}/compiler_flags.cmake INHERIT_ECBUILD_FLAGS ) ecbuild_add_library( TARGET overrideflags SOURCES emptyfile.c emptyfile.cxx emptyfile.F90 ) get_property( _flags SOURCE emptyfile.c PROPERTY COMPILE_FLAGS ) if( NOT _flags MATCHES "-user_common_c" ) message(${_flags}) message(FATAL_ERROR "Missing cached common C flags for emptyfile.c") endif() if( NOT _flags MATCHES "-g -fPIC" ) message(${_flags}) message(FATAL_ERROR "Missing compile-flags file common C flags for emptyfile.c") endif() if( CMAKE_BUILD_TYPE MATCHES BIT ) if( NOT _flags MATCHES "-user_bit_c" ) message(${_flags}) message(FATAL_ERROR "Missing cached BIT C flags for emptyfile.c") endif() if( NOT _flags MATCHES "-O2" ) message(${_flags}) message(FATAL_ERROR "Missing compile-flags file BIT C flags for emptyfile.c") endif() elseif( CMAKE_BUILD_TYPE MATCHES DEBUG ) if( NOT _flags MATCHES "-user_debug_c" ) message(${_flags}) message(FATAL_ERROR "Missing cached DEBUG C flags for emptyfile.c") endif() if( NOT _flags MATCHES "-O0" ) message(${_flags}) message(FATAL_ERROR "Missing compile-flags file DEBUG C flags for emptyfile.c") endif() endif() get_property( _flags SOURCE emptyfile.cxx PROPERTY COMPILE_FLAGS ) if( CMAKE_BUILD_TYPE MATCHES BIT ) if( NOT _flags MATCHES "-g -fPIC -O2" ) message(${_flags}) message(FATAL_ERROR "Incorrect BIT flags for emptyfile.cxx") endif() elseif( CMAKE_BUILD_TYPE MATCHES DEBUG ) if( NOT _flags MATCHES "-g -fPIC -O0" ) message(${_flags}) message(FATAL_ERROR "Incorrect DEBUG flags for emptyfile.cxx") endif() endif() get_property( _flags SOURCE emptyfile.F90 PROPERTY COMPILE_FLAGS ) if( NOT _flags MATCHES "-user_common_fortran" ) message(${_flags}) message(FATAL_ERROR "Missing cached common Fortran flags for emptyfile.F90") endif() if( NOT _flags MATCHES "-g -fortran_only_flag" ) message(${_flags}) message(FATAL_ERROR "Missing compile-flags file Fortran flags for emptyfile.F90") endif() ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/compiler_flags.cmake0000664000175000017500000000077715200367620027115 0ustar alastairalastairset( OVERRIDECOMPILERFLAGS_C_FLAGS "${OVERRIDECOMPILERFLAGS_C_FLAGS} -g -fPIC" ) set( OVERRIDECOMPILERFLAGS_CXX_FLAGS "-g -fPIC" ) set( OVERRIDECOMPILERFLAGS_Fortran_FLAGS "${OVERRIDECOMPILERFLAGS_Fortran_FLAGS} -g -fortran_only_flag" ) set( OVERRIDECOMPILERFLAGS_C_FLAGS_DEBUG "${OVERRIDECOMPILERFLAGS_C_FLAGS_DEBUG} -O0" ) set( OVERRIDECOMPILERFLAGS_CXX_FLAGS_DEBUG "-O0" ) set( OVERRIDECOMPILERFLAGS_C_FLAGS_BIT "${OVERRIDECOMPILERFLAGS_C_FLAGS_BIT} -O2" ) set( OVERRIDECOMPILERFLAGS_CXX_FLAGS_BIT "-O2" ) ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/run-test.sh.in0000775000175000017500000000061515200367620025641 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" cd $HERE rm -rf build # cleanup mkdir build cd build cmake -DCMAKE_MODULE_PATH=@ECBUILD_MACROS_DIR@ -DECBUILD_LOG_LEVEL=DEBUG -DCMAKE_BUILD_TYPE=BIT .. cd .. rm -rf build # cleanup mkdir build cd build cmake -DCMAKE_MODULE_PATH=@ECBUILD_MACROS_DIR@ -DECBUILD_LOG_LEVEL=DEBUG -DCMAKE_BUILD_TYPE=DEBUG .. ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/emptyfile.c0000664000175000017500000000002115200367620025245 0ustar alastairalastair// An empty file ecbuild-3.14.1/tests/ecbuild_override_compiler_flags/CMakeLists.txt0000664000175000017500000000105415200367620025652 0ustar alastairalastairset(_dir ${CMAKE_CURRENT_BINARY_DIR}) configure_file(run-test.sh.in ${_dir}/run-test.sh @ONLY) configure_file(test_ecbuild_override_compiler_flags.cmake ${_dir}/CMakeLists.txt COPYONLY) configure_file(emptyfile.c ${_dir}/emptyfile.c COPYONLY) configure_file(emptyfile.cxx ${_dir}/emptyfile.cxx COPYONLY) configure_file(emptyfile.F90 ${_dir}/emptyfile.F90 COPYONLY) configure_file(compiler_flags.cmake ${_dir}/compiler_flags.cmake COPYONLY) ecbuild_add_test( TARGET test_ecbuild_override_compiler_flags TYPE SCRIPT COMMAND run-test.sh ) ecbuild-3.14.1/tests/ecbuild_remove_fortran_flags/0000775000175000017500000000000015200367620022431 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_remove_fortran_flags/test_ecbuild_remove_fortran_flags.cmake0000664000175000017500000000270315200367620032367 0ustar alastairalastair set(CMAKE_Fortran_COMPILER_LOADED TRUE) set(CMAKE_BUILD_TYPE Testing) set(CMAKE_Fortran_FLAGS_TESTING "unused") include(ecbuild_log) include(ecbuild_remove_fortran_flags) function(test_remove_flags args input expected) set(CMAKE_Fortran_FLAGS "${input}") ecbuild_remove_fortran_flags(${args}) if(NOT CMAKE_Fortran_FLAGS STREQUAL "${expected}") message(FATAL_ERROR "ecbuild_remove_fortran_flags(\"${args}\"): " "input \"${input}\", " "output \"${CMAKE_Fortran_FLAGS}\", " "expected \"${expected}\"") endif() endfunction() test_remove_flags("-g" "-g" "") test_remove_flags("-g" " -g" " ") test_remove_flags("-g" "-g " "") test_remove_flags("-g" "-g -foo" "-foo") test_remove_flags("-g" "-bar -g -baz" "-bar -baz") test_remove_flags("-g" "-ggg -g -gcc -g" "-ggg -gcc ") test_remove_flags("-g" "-gcc" "-gcc") test_remove_flags("-g" "--g -g-" "--g -g-") test_remove_flags("-g" "---g" "---g") test_remove_flags("-g" " -g" " ") test_remove_flags("-g" "-g " "") test_remove_flags("-g" " -g " " ") test_remove_flags("-g" "-g-g" "-g-g") test_remove_flags("-foo;-bar" "-foobar" "-foobar") test_remove_flags("-foo;-bar" "-barfoo" "-barfoo") test_remove_flags("-foo;-bar" "-foo -bar" "") test_remove_flags("-foo;-bar" "-foo -g -bar" "-g ") test_remove_flags("-foo;-bar" "-g -bar -foo" "-g ") set(CMAKE_BUILD_TYPE Unused) test_remove_flags("-foo" "" "") test_remove_flags("-foo;BUILD;Unused" "" "") ecbuild-3.14.1/tests/ecbuild_remove_fortran_flags/CMakeLists.txt0000664000175000017500000000040115200367620025164 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_remove_fortran_flags TYPE SCRIPT COMMAND ${CMAKE_COMMAND} ARGS -DCMAKE_MODULE_PATH=${ECBUILD_MACROS_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_ecbuild_remove_fortran_flags.cmake ) ecbuild-3.14.1/tests/sg_pl/0000775000175000017500000000000015200367620015642 5ustar alastairalastairecbuild-3.14.1/tests/sg_pl/test_sg_pl.h0000664000175000017500000000131215200367620020153 0ustar alastairalastair#ifndef TEST_SG_PL_H #define TEST_SG_PL_H // Case 1: Regular (non-template) class with base and member class RegularClass : public BaseClass { public: int value; }; // Case 2: Template class with base and member template class TemplateClass : public BaseClass { public: T data; }; // Case 3: Explicit template specialization -- must not crash sg.pl template <> class TemplateClass : public BaseClass { public: int data; }; // Case 4: Explicit specialization with no body (semicolon-only form) template <> class TemplateClass; // Case 5: Class after the specializations -- tests parser recovery class AfterSpecClass : public BaseClass { public: double result; }; #endif ecbuild-3.14.1/tests/sg_pl/run-test.sh.in0000775000175000017500000000517615200367620020400 0ustar alastairalastair#!/usr/bin/env bash set -ex # ------------------------------------------------------------------ # Test: sg.pl handles explicit template specializations (template <>) # # Verifies: # 1. sg.pl exits 0 (no crash on template <>) # 2. RegularClass.b exists and contains correct specName # 3. TemplateClass.b exists and contains correct template specName # 4. No .b file generated for the explicit specialization # 5. AfterSpecClass.b exists (parser recovery after specialization) # 6. Exactly 3 .b files total # ------------------------------------------------------------------ PERL="@PERL_EXECUTABLE@" SG_PL="@ECBUILD_MACROS_DIR@/sg.pl" HEADER="@CMAKE_CURRENT_SOURCE_DIR@/test_sg_pl.h" OUTDIR="@CMAKE_CURRENT_BINARY_DIR@/sg_output" # Clean and create output directory rm -rf "${OUTDIR}" mkdir -p "${OUTDIR}" # Run sg.pl -- primary assertion: exit code 0 "${PERL}" "${SG_PL}" "${HEADER}" "${OUTDIR}" eckit # ------------------------------------------------------------------ # Assert expected .b files exist # ------------------------------------------------------------------ echo "Checking RegularClass.b exists..." test -f "${OUTDIR}/RegularClass.b" echo "Checking TemplateClass.b exists..." test -f "${OUTDIR}/TemplateClass.b" echo "Checking AfterSpecClass.b exists..." test -f "${OUTDIR}/AfterSpecClass.b" # ------------------------------------------------------------------ # Assert NO .b file for the explicit specialization # ------------------------------------------------------------------ echo "Checking no .b file for explicit specialization..." count=$(ls -1 "${OUTDIR}" | grep -c 'TemplateClass<' || true) if [ "${count}" -ne 0 ]; then echo "FAIL: found .b file for template specialization" ls -la "${OUTDIR}" exit 1 fi # Exactly 3 .b files expected file_count=$(ls -1 "${OUTDIR}"/*.b | wc -l | tr -d ' ') if [ "${file_count}" -ne 3 ]; then echo "FAIL: expected 3 .b files, found ${file_count}" ls -la "${OUTDIR}" exit 1 fi # ------------------------------------------------------------------ # Assert .b file content # ------------------------------------------------------------------ echo "Checking RegularClass.b content..." grep -q 'static const char\* specName' "${OUTDIR}/RegularClass.b" grep -q 'return "RegularClass"' "${OUTDIR}/RegularClass.b" echo "Checking TemplateClass.b content..." grep -q 'static std::string specName' "${OUTDIR}/TemplateClass.b" grep -q 'Traits::name()' "${OUTDIR}/TemplateClass.b" echo "Checking AfterSpecClass.b content..." grep -q 'static const char\* specName' "${OUTDIR}/AfterSpecClass.b" grep -q 'return "AfterSpecClass"' "${OUTDIR}/AfterSpecClass.b" echo "All checks passed." ecbuild-3.14.1/tests/sg_pl/CMakeLists.txt0000664000175000017500000000031715200367620020403 0ustar alastairalastairecbuild_find_perl( REQUIRED ) set(_dir ${CMAKE_CURRENT_BINARY_DIR}) configure_file(run-test.sh.in ${_dir}/run-test.sh @ONLY) ecbuild_add_test( TARGET test_sg_pl TYPE SCRIPT COMMAND run-test.sh ) ecbuild-3.14.1/tests/test_properties/0000775000175000017500000000000015200367620017771 5ustar alastairalastairecbuild-3.14.1/tests/test_properties/build-and-run.sh0000775000175000017500000000105415200367620022771 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # Build the project ecbuild $SOURCE/test_project -B $HERE/build # Run only one specific test (which should invoke the others) (cd $HERE/build; ctest -R write_world_after_hello) # Avoid using --test-dir option in ctest # Check if the output is as expected echo -n "Hello, World!" | diff - $HERE/build/output.txt ecbuild-3.14.1/tests/test_properties/test_project/0000775000175000017500000000000015200367620022476 5ustar alastairalastairecbuild-3.14.1/tests/test_properties/test_project/CMakeLists.txt0000664000175000017500000000133715200367620025242 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_test_properties VERSION 0.1.0 LANGUAGES NONE ) ecbuild_add_test( TARGET clean_output TEST_PROPERTIES FIXTURES_SETUP clean_output COMMAND ${CMAKE_COMMAND} ARGS -E remove ${CMAKE_CURRENT_BINARY_DIR}/output.txt ) ecbuild_add_test( TARGET write_hello TEST_PROPERTIES FIXTURES_SETUP write_hello FIXTURES_REQUIRED clean_output COMMAND bash ARGS -c "echo -n 'Hello, ' >> ${CMAKE_CURRENT_BINARY_DIR}/output.txt" ) ecbuild_add_test( TARGET write_world_after_hello TEST_PROPERTIES FIXTURES_REQUIRED write_hello COMMAND bash ARGS -c "echo -n 'World!' >> ${CMAKE_CURRENT_BINARY_DIR}/output.txt" ) ecbuild-3.14.1/tests/test_properties/CMakeLists.txt0000664000175000017500000000040515200367620022530 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_test_properties TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/interface_library/0000775000175000017500000000000015200367620020222 5ustar alastairalastairecbuild-3.14.1/tests/interface_library/clean.sh0000775000175000017500000000034515200367620021645 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* $HERE/*.log ecbuild-3.14.1/tests/interface_library/build-and-run.sh0000775000175000017500000000162715200367620023230 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE run_test() { local tname=$1 local exp_sts=$2 shift 2 local bdir=$HERE/build_$tname local idir=$HERE/install_$tname local logf=$HERE/$tname.log mkdir -p $bdir && cd $bdir local sts=0 echo "Running test '$tname'" ecbuild --prefix=$idir -- -Wno-deprecated $* $SOURCE/test_project >$logf 2>&1 || sts=$? make install if [[ $sts -ne $exp_sts ]] ; then echo "Test '$tname': expected exit code $exp_sts, got $sts" cat $logf exit 1 fi } # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ---------------------- tests ------------------------- run_test test_interface_library 0 ecbuild-3.14.1/tests/interface_library/test_project/0000775000175000017500000000000015200367620022727 5ustar alastairalastairecbuild-3.14.1/tests/interface_library/test_project/CMakeLists.txt0000664000175000017500000000077615200367620025501 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_interface_library VERSION 0.1.0 LANGUAGES C ) ecbuild_add_library( TARGET intfb_lib TYPE INTERFACE PUBLIC_INCLUDES $ $ENV{HOME} PUBLIC_LIBS some_lib PUBLIC_DEFINITIONS MYDEF=1 ) ecbuild_install_project( NAME test_interface_library ) ecbuild-3.14.1/tests/interface_library/.gitignore0000664000175000017500000000007415200367620022213 0ustar alastairalastairbuild_test_interface_library install_test_interface_library ecbuild-3.14.1/tests/interface_library/CMakeLists.txt0000664000175000017500000000040715200367620022763 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_interface_library TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_add_option/0000775000175000017500000000000015200367620020345 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option/clean.sh0000775000175000017500000000034515200367620021770 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* $HERE/*.log ecbuild-3.14.1/tests/ecbuild_add_option/build-and-run.sh0000775000175000017500000000400615200367620023345 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE run_test() { local tname=$1 local exp_sts=$2 shift 2 local bdir=$HERE/build_$tname local logf=$HERE/$tname.log mkdir -p $bdir && cd $bdir local sts=0 echo "Running test '$tname'" ecbuild -- -Wno-deprecated $* $SOURCE/test_project >$logf 2>&1 || sts=$? if [[ $sts -ne $exp_sts ]] ; then echo "Test '$tname': expected exit code $exp_sts, got $sts" cat $logf exit 1 fi } # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ---------------------- tests ------------------------- run_test all_def 0 \ -DEXPECT_TEST_A=ON -DEXPECT_TEST_B=ON -DEXPECT_TEST_C=OFF -DEXPECT_TEST_D=ON -DEXPECT_TEST_E=OFF -DEXPECT_TEST_F=ON -DEXPECT_TEST_G=OFF \ -DEXPECT_TEST_H=ON -DEXPECT_TEST_I=ON -DEXPECT_TEST_J=OFF -DEXPECT_TEST_K=OFF run_test all_off 0 \ -DENABLE_TEST_A=OFF -DENABLE_TEST_B=OFF -DENABLE_TEST_C=OFF -DENABLE_TEST_D=OFF -DENABLE_TEST_E=OFF -DENABLE_TEST_F=OFF -DENABLE_TEST_G=OFF \ -DEXPECT_TEST_A=OFF -DEXPECT_TEST_B=OFF -DEXPECT_TEST_C=OFF -DEXPECT_TEST_D=OFF -DEXPECT_TEST_E=OFF -DEXPECT_TEST_F=OFF -DEXPECT_TEST_G=OFF \ -DENABLE_TEST_H=OFF -DENABLE_TEST_I=OFF -DENABLE_TEST_J=OFF -DENABLE_TEST_K=OFF \ -DEXPECT_TEST_H=OFF -DEXPECT_TEST_I=OFF -DEXPECT_TEST_J=OFF -DEXPECT_TEST_K=OFF run_test ok_on 0 \ -DENABLE_TEST_A=ON -DENABLE_TEST_B=ON -DENABLE_TEST_C=ON -DENABLE_TEST_D=ON -DENABLE_TEST_F=ON \ -DEXPECT_TEST_A=ON -DEXPECT_TEST_B=ON -DEXPECT_TEST_C=ON -DEXPECT_TEST_D=ON -DEXPECT_TEST_F=ON -DEXPECT_TEST_E=OFF -DEXPECT_TEST_G=OFF \ -DEXPECT_TEST_H=ON -DEXPECT_TEST_I=ON -DEXPECT_TEST_J=OFF -DEXPECT_TEST_K=OFF run_test fail_pkg_E 1 -DENABLE_TEST_E=ON run_test fail_cond_G 1 -DENABLE_TEST_G=ON run_test fail_pkg_J 1 -DENABLE_TEST_J=ON run_test fail_pkg_K 1 -DENABLE_TEST_K=ON ecbuild-3.14.1/tests/ecbuild_add_option/test_project/0000775000175000017500000000000015200367620023052 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option/test_project/cmake/0000775000175000017500000000000015200367620024132 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_add_option/test_project/cmake/Findfoo.cmake0000664000175000017500000000026515200367620026523 0ustar alastairalastairset(_foo_FOUND 1) set(_foo_VERSION 1.2.3 ) include( FindPackageHandleStandardArgs ) find_package_handle_standard_args( foo REQUIRED_VARS _foo_FOUND VERSION_VAR _foo_VERSION ) ecbuild-3.14.1/tests/ecbuild_add_option/test_project/cmake/Findbar.cmake0000664000175000017500000000002115200367620026472 0ustar alastairalastairset(bar_FOUND 0) ecbuild-3.14.1/tests/ecbuild_add_option/test_project/CMakeLists.txt0000664000175000017500000000264215200367620025616 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_add_option VERSION 0.1.0 LANGUAGES NONE ) ecbuild_add_option(FEATURE TEST_A) # should default to ON ecbuild_add_option(FEATURE TEST_B DEFAULT ON) ecbuild_add_option(FEATURE TEST_C DEFAULT OFF) ecbuild_add_option(FEATURE TEST_D REQUIRED_PACKAGES "NAME foo") ecbuild_add_option(FEATURE TEST_E REQUIRED_PACKAGES "NAME foo" "NAME bar") set(COND_F TRUE) ecbuild_add_option(FEATURE TEST_F CONDITION COND_F) set(COND_G FALSE) ecbuild_add_option(FEATURE TEST_G CONDITION COND_G) ecbuild_add_option(FEATURE TEST_H REQUIRED_PACKAGES "foo 1.2" ) # should pass as available is version 1.2.3 ecbuild_add_option(FEATURE TEST_I REQUIRED_PACKAGES "foo VERSION 1.2" ) # should pass as available is version 1.2.3 ecbuild_add_option(FEATURE TEST_J REQUIRED_PACKAGES "foo 2.1" ) # should fail as available is version 1.2.3 ecbuild_add_option(FEATURE TEST_K REQUIRED_PACKAGES "foo VERSION 2.1" ) # should fail as available is version 1.2.3 foreach(var IN ITEMS A B C D E F G H I J K) set(expected ${EXPECT_TEST_${var}}) set(actual ${HAVE_TEST_${var}}) if(expected AND NOT actual) message(SEND_ERROR "HAVE_TEST_${var} = ${actual}, expected 1") elseif(actual AND NOT expected) message(SEND_ERROR "HAVE_TEST_${var} = ${actual}, expected 0") else() message("HAVE_TEST_${var} = ${actual} as expected") endif() endforeach() ecbuild-3.14.1/tests/ecbuild_add_option/CMakeLists.txt0000664000175000017500000000040015200367620023077 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_add_option TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/project_options_cached/0000775000175000017500000000000015200367620021246 5ustar alastairalastairecbuild-3.14.1/tests/project_options_cached/clean.sh0000775000175000017500000000033115200367620022664 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} # --------------------- cleanup ------------------------ echo "cleaning $HERE" rm -rf $HERE/build_* ecbuild-3.14.1/tests/project_options_cached/configure.sh0000775000175000017500000000717615200367620023601 0ustar alastairalastair#!/usr/bin/env bash set -e function EXPECT_ONE_OF() { local file=$1 local pattern=$2 local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) if [ "$found" != "1" ]; then echo "File ${file} does not contain exacly one of '$2'" exit 1 fi } HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # --------------------- cleanup ------------------------ $SOURCE/clean.sh # ----------------- configure project --------------------- # (1) Configure with default options, and then reconfigure with user specified options mkdir -p $HERE/build_1 ecbuild $SOURCE/test_project -B $HERE/build_1 -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.a.log # Ensure the option values are correct in CMake output EXPECT_ONE_OF $HERE/build_1.a.log "Feature FEATUREA disabled" EXPECT_ONE_OF $HERE/build_1.a.log "Feature FEATUREB enabled" EXPECT_ONE_OF $HERE/build_1.a.log "Build files have been written" # Ensure the option values are correct in CMakeCache EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREA_defined_value:INTERNAL=OFF" EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREB_defined_value:INTERNAL=ON" ecbuild $SOURCE/test_project -B $HERE/build_1 -DENABLE_FEATUREA=ON -DENABLE_FEATUREB=OFF -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.b.log # Ensure the option values are correct in CMake output EXPECT_ONE_OF $HERE/build_1.b.log "Feature FEATUREA enabled" EXPECT_ONE_OF $HERE/build_1.b.log "Feature FEATUREB disabled" EXPECT_ONE_OF $HERE/build_1.b.log "Build files have been written" # Ensure the option values are correct in CMakeCache EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREA_defined_value:INTERNAL=ON" EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREB_defined_value:INTERNAL=OFF" ecbuild $SOURCE/test_project -B $HERE/build_1 -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.c.log # Ensure the option values are correct in CMake output EXPECT_ONE_OF $HERE/build_1.c.log "Feature FEATUREA enabled" EXPECT_ONE_OF $HERE/build_1.c.log "Feature FEATUREB disabled" EXPECT_ONE_OF $HERE/build_1.c.log "Build files have been written" # Ensure the option values are correct in CMakeCache EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREA_defined_value:INTERNAL=ON" EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREB_defined_value:INTERNAL=OFF" ecbuild $SOURCE/test_project -B $HERE/build_1 -DENABLE_FEATUREA=OFF -DENABLE_FEATUREB=ON -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.d.log # Ensure the option values are correct in CMake output EXPECT_ONE_OF $HERE/build_1.d.log "Feature FEATUREA disabled" EXPECT_ONE_OF $HERE/build_1.d.log "Feature FEATUREB enabled" EXPECT_ONE_OF $HERE/build_1.d.log "Build files have been written" # Ensure the option values are correct in CMakeCache EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREA_defined_value:INTERNAL=OFF" EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREB_defined_value:INTERNAL=ON" ecbuild $SOURCE/test_project -B $HERE/build_1 -DECBUILD_LOG_LEVEL=DEBUG | tee $HERE/build_1.e.log EXPECT_ONE_OF $HERE/build_1.e.log "Feature FEATUREA disabled" EXPECT_ONE_OF $HERE/build_1.e.log "Feature FEATUREB enabled" EXPECT_ONE_OF $HERE/build_1.e.log "Build files have been written" # Ensure the option values are correct in CMakeCache EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREA_defined_value:INTERNAL=OFF" EXPECT_ONE_OF $HERE/build_1/CMakeCache.txt "project_ENABLE_FEATUREB_defined_value:INTERNAL=ON" ecbuild-3.14.1/tests/project_options_cached/test_project/0000775000175000017500000000000015200367620023753 5ustar alastairalastairecbuild-3.14.1/tests/project_options_cached/test_project/CMakeLists.txt0000664000175000017500000000037515200367620026520 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED ) project( project LANGUAGES NONE VERSION 0.2 ) ecbuild_add_option( FEATURE FEATUREA DEFAULT OFF ) ecbuild_add_option( FEATURE FEATUREB DEFAULT ON )ecbuild-3.14.1/tests/project_options_cached/CMakeLists.txt0000664000175000017500000000041015200367620024001 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_project_options_cached TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/0000775000175000017500000000000015200367620025233 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/0000775000175000017500000000000015200367620026505 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/src/0000775000175000017500000000000015200367620027274 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/src/test_foo.cc0000664000175000017500000000017215200367620031425 0ustar alastairalastair#include "foo/foo.h" #include int main() { std::cout << foo::true_random_int() << std::endl; return 0; } ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/src/foo.cc0000664000175000017500000000021615200367620030365 0ustar alastairalastair#include "foo/foo.h" namespace foo { int true_random_int() { // Determined in a truly random dice roll return 4; } } ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/src/include/0000775000175000017500000000000015200367620030717 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/src/include/foo/0000775000175000017500000000000015200367620031502 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/src/include/foo/foo.h0000664000175000017500000000007315200367620032436 0ustar alastairalastair#pragma once namespace foo { int true_random_int(); } ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/cmake/0000775000175000017500000000000015200367620027565 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/cmake/fooConfig.cmake0000664000175000017500000000100015200367620032467 0ustar alastairalastairinclude("${CMAKE_CURRENT_LIST_DIR}/fooTargets.cmake") get_target_property(_imported_configs foo::foo IMPORTED_CONFIGURATIONS) message(STATUS "_imported_configs=${_imported_configs}") foreach(_config ${_imported_configs}) get_target_property(_library_chk foo::foo "IMPORTED_LOCATION_${_config}") message(STATUS "_library_chk=${_library_chk}") if(EXISTS "${_library_chk}") set_target_properties(foo::foo PROPERTIES IMPORTED_LOCATION "${_library_chk}") break() endif() endforeach() ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/libfoo/CMakeLists.txt0000664000175000017500000000305515200367620031250 0ustar alastairalastaircmake_minimum_required(VERSION 3.18 FATAL_ERROR) project(foo VERSION 1.33.7 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) add_library(foo SHARED src/foo.cc ) target_include_directories(foo PUBLIC $ $ ) set_target_properties(foo PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} PUBLIC_HEADER "src/include/foo/foo.h" ) add_executable(foo_test src/test_foo.cc ) target_link_libraries(foo_test PRIVATE foo) include(GNUInstallDirs) include(CMakePackageConfigHelpers) install( TARGETS foo EXPORT fooTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/foo ) install( EXPORT fooTargets FILE fooTargets.cmake NAMESPACE foo:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/foo ) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/fooConfigVersion.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) install(FILES ${CMAKE_CURRENT_LIST_DIR}/cmake/fooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/fooConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/foo ) ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/run-test.sh0000775000175000017500000000213615200367620027355 0ustar alastairalastair#!/usr/bin/env bash set -ex echo "HI" TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" foo_src="$TEST_ROOT/libfoo" project_src="$TEST_ROOT/project" foo_install="$(pwd)/foo-install" project_install="$(pwd)/project-install" mkdir -p foo-{build,install} cmake \ -B foo-build \ -S "$foo_src" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$foo_install" cmake --build foo-build --target install -j mkdir -p project-{build,install} cmake \ -B project-build \ -S "$project_src" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$project_install" \ -DCMAKE_PREFIX_PATH="$foo_install" \ -Decbuild_ROOT="$TEST_ROOT/../../" cmake --build project-build --target install -j lib_file_count="$(find $(pwd)/project-install \( -type f -o -type l \) -name 'libfoo.*' | wc -l)" if [[ ! "${lib_file_count}" -eq 3 ]]; then echo "ERROR: Install tree is not correct" exit 1 fi random=$($project_install/bin/project) if [[ ! "${random}" -eq 4 ]]; then echo "ERROR: project executable did run but did not output the expected value" exit 1 fi ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/project/0000775000175000017500000000000015200367620026701 5ustar alastairalastairecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/project/main.cc0000664000175000017500000000017215200367620030134 0ustar alastairalastair#include "foo/foo.h" #include int main() { std::cout << foo::true_random_int() << std::endl; return 0; } ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/project/CMakeLists.txt0000664000175000017500000000123515200367620031442 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.12 REQUIRED HINTS ${CMAKE_SOURCE_DIR}) project(project VERSION 1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) ecbuild_find_package(NAME foo VERSION 1.33 REQUIRED) ecbuild_add_executable( TARGET project SOURCES main.cc LIBS foo::foo ) ecbuild_install_dependency_with_soversion(foo::foo) ecbuild_add_executable( TARGET project_copy SOURCES main.cc LIBS foo::foo ) ecbuild_install_dependency_with_soversion(foo::foo) ecbuild-3.14.1/tests/ecbuild_install_dependency_with_soversion/CMakeLists.txt0000664000175000017500000000031215200367620027767 0ustar alastairalastairecbuild_add_test( TARGET test_ecbuild_install_dependency_with_soversion TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run-test.sh WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/bundle_subdir/0000775000175000017500000000000015200367620017357 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subdir/run-test.sh.in0000775000175000017500000000117615200367620022111 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" ECBUILD_PATH=@CMAKE_SOURCE_DIR@/bin # Add ecbuild to path export PATH=$ECBUILD_PATH:$PATH # --------------------- cleanup ------------------------ rm -rf $HERE/build rm -rf $HERE/mylib/build rm -rf $HERE/mylib/install # ------------- build the "system" package ------------- cd $HERE/mylib mkdir build cd build ecbuild --prefix=../install -- -DINSTALL_LIB_DIR=lib .. make install export mylib_DIR=$HERE/mylib/install/lib/cmake/mylib # ---------------- build the bundle -------------------- cd $HERE mkdir build cd build ecbuild -- ../mybundle ecbuild-3.14.1/tests/bundle_subdir/mylib.in/0000775000175000017500000000000015200367620021100 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subdir/mylib.in/mylib-import.cmake.in0000664000175000017500000000004215200367620025127 0ustar alastairalastairset( mylib_CONFNAME @_CONFNAME@ ) ecbuild-3.14.1/tests/bundle_subdir/mylib.in/CMakeLists.txt0000664000175000017500000000043615200367620023643 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) project( mylib VERSION 0.1.0 LANGUAGES NONE ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9.5 ) ecbuild_declare_project() ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/tests/bundle_subdir/mybundle/0000775000175000017500000000000015200367620021176 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subdir/mybundle/myexe/0000775000175000017500000000000015200367620022325 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subdir/mybundle/myexe/CMakeLists.txt.in0000664000175000017500000000104515200367620025472 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) project( myexe VERSION 0.1.0 LANGUAGES NONE ) include( ecbuild_system NO_POLICY_SCOPE ) ecbuild_requires_macro_version( 2.9.5 ) ecbuild_declare_project() if( @_FUNC@ STREQUAL "std" ) find_package( mylib REQUIRED ) else() #( @_FUNC@ STREQUAL "ecbfind" ) ecbuild_find_package( NAME mylib REQUIRED ) endif() if( NOT mylib_CONFNAME STREQUAL "BUNDLE" ) message( FATAL_ERROR "mylib_CONFNAME == '${mylib_CONFNAME}', expected 'BUNDLE'" ) endif() ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/tests/bundle_subdir/mybundle/CMakeLists.txt0000664000175000017500000000051315200367620023735 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild QUIET) include( ecbuild_bundle ) project( mybundle VERSION 0.1.0.0 LANGUAGES NONE ) ecbuild_bundle_initialize() ecbuild_requires_macro_version( 2.9.5 ) add_subdirectory( mylib ) add_subdirectory( myexe ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/tests/bundle_subdir/CMakeLists.txt0000664000175000017500000000170615200367620022123 0ustar alastairalastair set( _funcs std ecbfind ) foreach( _func ${_funcs} ) set( _ref ${CMAKE_CURRENT_BINARY_DIR}/${_func} ) set( _FUNC ${_func} ) configure_file( run-test.sh.in ${_ref}/run-test.sh @ONLY ) file( COPY mybundle/CMakeLists.txt DESTINATION ${_ref}/mybundle/ ) configure_file( mybundle/myexe/CMakeLists.txt.in ${_ref}/mybundle/myexe/CMakeLists.txt @ONLY ) set( _confs SYSTEM BUNDLE ) set( _dir_SYSTEM ${_ref} ) set( _dir_BUNDLE ${_ref}/mybundle ) foreach( _conf ${_confs} ) set( _dir ${_dir_${_conf}} ) set( _CONFNAME ${_conf} ) file( GLOB_RECURSE _infiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/mylib.in "${CMAKE_CURRENT_SOURCE_DIR}/mylib.in/*" ) foreach( _infile ${_infiles} ) configure_file( mylib.in/${_infile} ${_dir}/mylib/${_infile} @ONLY ) endforeach() endforeach() ecbuild_add_test( TARGET bundle-subdir-${_func} TYPE SCRIPT COMMAND ${_ref}/run-test.sh ) endforeach() ecbuild-3.14.1/tests/test_custom_build_type/0000775000175000017500000000000015200367620021327 5ustar alastairalastairecbuild-3.14.1/tests/test_custom_build_type/build-and-run.sh0000775000175000017500000000433715200367620024336 0ustar alastairalastair#!/usr/bin/env bash set -e set -x HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE function assert_flag() { local file=$1 local variable=$2 local flag=$3 local found=$(grep "${variable} = " ${file} | grep "\\${flag}" | wc -l) if [ $found -ne 1 ]; then echo "File ${file} does not contain exacly one of '$3'" exit 1 fi } # 1) Build the project -- using toolchain mkdir -p $HERE/build-1 cd $HERE/build-1 cmake $SOURCE/test_project \ -DCMAKE_BUILD_TYPE=CUSTOM \ -DCMAKE_TOOLCHAIN_FILE=$SOURCE/toolchain.cmake # Check that the flags are correctly set for Fortran, C and C++ assert_flag CMakeFiles/proj_f.dir/flags.make "Fortran_FLAGS" "-Wno-common-f-flag" assert_flag CMakeFiles/proj_f.dir/flags.make "Fortran_FLAGS" "-Wno-custom-f-flag" assert_flag CMakeFiles/proj_c.dir/flags.make "C_FLAGS" "-Wno-common-c-flag" assert_flag CMakeFiles/proj_c.dir/flags.make "C_FLAGS" "-Wno-custom-c-flag" assert_flag CMakeFiles/proj_cxx.dir/flags.make "CXX_FLAGS" "-Wno-common-cxx-flag" assert_flag CMakeFiles/proj_cxx.dir/flags.make "CXX_FLAGS" "-Wno-custom-cxx-flag" # 2) Build the project -- using explicit ECBUILD_*_FLAGS_ variables mkdir -p $HERE/build-2 cd $HERE/build-2 cmake $SOURCE/test_project \ -DCMAKE_BUILD_TYPE=CUSTOM \ -DECBUILD_Fortran_FLAGS="-Wno-common-f-flag" \ -DECBUILD_C_FLAGS="-Wno-common-c-flag" \ -DECBUILD_CXX_FLAGS="-Wno-common-cxx-flag" \ -DECBUILD_Fortran_FLAGS_CUSTOM="-Wno-custom-f-flag" \ -DECBUILD_C_FLAGS_CUSTOM="-Wno-custom-c-flag" \ -DECBUILD_CXX_FLAGS_CUSTOM="-Wno-custom-cxx-flag" # Check that the flags are correctly set for Fortran, C and C++ assert_flag CMakeFiles/proj_f.dir/flags.make "Fortran_FLAGS" "-Wno-common-f-flag" assert_flag CMakeFiles/proj_f.dir/flags.make "Fortran_FLAGS" "-Wno-custom-f-flag" assert_flag CMakeFiles/proj_c.dir/flags.make "C_FLAGS" "-Wno-common-c-flag" assert_flag CMakeFiles/proj_c.dir/flags.make "C_FLAGS" "-Wno-custom-c-flag" assert_flag CMakeFiles/proj_cxx.dir/flags.make "CXX_FLAGS" "-Wno-common-cxx-flag" assert_flag CMakeFiles/proj_cxx.dir/flags.make "CXX_FLAGS" "-Wno-custom-cxx-flag" ecbuild-3.14.1/tests/test_custom_build_type/test_project/0000775000175000017500000000000015200367620024034 5ustar alastairalastairecbuild-3.14.1/tests/test_custom_build_type/test_project/proj.c0000664000175000017500000000003415200367620025147 0ustar alastairalastair int main() { return 0; } ecbuild-3.14.1/tests/test_custom_build_type/test_project/proj.cpp0000664000175000017500000000003415200367620025507 0ustar alastairalastair int main() { return 0; } ecbuild-3.14.1/tests/test_custom_build_type/test_project/proj.F900000664000175000017500000000002115200367620025257 0ustar alastairalastairPROGRAM MAIN END ecbuild-3.14.1/tests/test_custom_build_type/test_project/CMakeLists.txt0000664000175000017500000000055615200367620026602 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_test_custom_build_type VERSION 0.1.0 LANGUAGES Fortran C CXX ) ecbuild_enable_fortran (REQUIRED) ecbuild_add_executable (TARGET proj_f SOURCES proj.F90) ecbuild_add_executable (TARGET proj_c SOURCES proj.c) ecbuild_add_executable (TARGET proj_cxx SOURCES proj.cpp) ecbuild-3.14.1/tests/test_custom_build_type/CMakeLists.txt0000664000175000017500000000041415200367620024066 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_test_custom_build_type TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/test_custom_build_type/toolchain.cmake0000664000175000017500000000077115200367620024316 0ustar alastairalastair set( OpenMP_C_FLAGS "-openmp" ) set( OpenMP_CXX_FLAGS "-openmp" ) set( OpenMP_Fortran_FLAGS "-openmp" ) set( ECBUILD_Fortran_FLAGS "-Wno-common-f-flag") set( ECBUILD_C_FLAGS "-Wno-common-c-flag" ) set( ECBUILD_CXX_FLAGS "-Wno-common-cxx-flag" ) set( ECBUILD_Fortran_FLAGS_CUSTOM "-Wno-custom-f-flag" ) set( ECBUILD_C_FLAGS_CUSTOM "-Wno-custom-c-flag" ) set( ECBUILD_CXX_FLAGS_CUSTOM "-Wno-custom-cxx-flag" ) ecbuild-3.14.1/tests/find_ecbuild/0000775000175000017500000000000015200367620017145 5ustar alastairalastairecbuild-3.14.1/tests/find_ecbuild/test-CMakeLists.txt0000664000175000017500000000050515200367620022662 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.0 REQUIRED) project(dummy VERSION 0.1 LANGUAGES NONE) if(NOT DEFINED ECBUILD_MACROS_DIR) ecbuild_critical("ecbuild has not been loaded properly") endif() if(NOT ecbuild_DIR) ecbuild_critical("ecbuild_DIR has not been defined properly") endif() ecbuild-3.14.1/tests/find_ecbuild/run-test.sh.in0000775000175000017500000000026215200367620021672 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" cd $HERE rm -rf build # cleanup mkdir build cd build @_EXPORTS@ cmake @_CMDLINE_OPTS@ ..ecbuild-3.14.1/tests/find_ecbuild/CMakeLists.txt0000664000175000017500000000203315200367620021703 0ustar alastairalastair # Configs to test: # - CMAKE_MODULE_PATH # - ecbuild_DIR from environment # - ecbuild_DIR from command-line definition set(_configs module direnv direnv-full dircmd) foreach(_config ${_configs}) set(_ref ${CMAKE_CURRENT_BINARY_DIR}/${_config}) if(_config STREQUAL "module") unset(_EXPORTS) set(_CMDLINE_OPTS "-DCMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake") elseif(_config STREQUAL "direnv") set(_EXPORTS "export ecbuild_DIR=${PROJECT_SOURCE_DIR}") unset(_CMDLINE_OPTS) elseif(_config STREQUAL "direnv-full") set(_EXPORTS "export ecbuild_DIR=${PROJECT_SOURCE_DIR}/lib/cmake/ecbuild") unset(_CMDLINE_OPTS) elseif(_config STREQUAL "dircmd") unset(_EXPORTS) set(_CMDLINE_OPTS "-Decbuild_DIR=${PROJECT_SOURCE_DIR}/lib/cmake/ecbuild") endif() configure_file(run-test.sh.in ${_ref}/run-test.sh @ONLY) configure_file(test-CMakeLists.txt ${_ref}/CMakeLists.txt COPYONLY) ecbuild_add_test( TARGET find-ecbuild-${_config} TYPE SCRIPT COMMAND ${_ref}/run-test.sh ) endforeach() ecbuild-3.14.1/tests/test_requires_complex/0000775000175000017500000000000015200367620021163 5ustar alastairalastairecbuild-3.14.1/tests/test_requires_complex/build-and-run.sh0000775000175000017500000000143415200367620024165 0ustar alastairalastair#!/usr/bin/env bash set -e HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} # Add ecbuild to path export PATH=$SOURCE/../../bin:$PATH echo $PATH echo $SOURCE # Build the project ecbuild $SOURCE/test_project -B $HERE/build # Run only one specific test (which should invoke the dependency) (cd $HERE/build; ctest -R write_world) # Avoid using --test-dir option in ctest # Check if the output is as expected echo -n "World!" | diff - $HERE/build/world.txt # Run only one specific test (which should invoke the dependencies) (cd $HERE/build; ctest -R combine_hello_world) # Avoid using --test-dir option in ctest # Check if the output is as expected echo -n "Hello, World!" | diff - $HERE/build/helloworld.txt ecbuild-3.14.1/tests/test_requires_complex/test_project/0000775000175000017500000000000015200367620023670 5ustar alastairalastairecbuild-3.14.1/tests/test_requires_complex/test_project/CMakeLists.txt0000664000175000017500000000166015200367620026433 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( test_test_requires_complex VERSION 0.1.0 LANGUAGES NONE ) ecbuild_add_test( TARGET clean_output COMMAND ${CMAKE_COMMAND} ARGS -E remove ${CMAKE_CURRENT_BINARY_DIR}/hello.txt ${CMAKE_CURRENT_BINARY_DIR}/world.txt ${CMAKE_CURRENT_BINARY_DIR}/helloworld.txt ) ecbuild_add_test( TARGET write_hello TEST_REQUIRES clean_output COMMAND bash ARGS -c "echo -n 'Hello, ' >> ${CMAKE_CURRENT_BINARY_DIR}/hello.txt" ) ecbuild_add_test( TARGET write_world TEST_REQUIRES clean_output COMMAND bash ARGS -c "echo -n 'World!' >> ${CMAKE_CURRENT_BINARY_DIR}/world.txt" ) ecbuild_add_test( TARGET combine_hello_world TEST_REQUIRES write_hello write_world COMMAND bash ARGS -c "cat ${CMAKE_CURRENT_BINARY_DIR}/hello.txt ${CMAKE_CURRENT_BINARY_DIR}/world.txt >> ${CMAKE_CURRENT_BINARY_DIR}/helloworld.txt" ) ecbuild-3.14.1/tests/test_requires_complex/CMakeLists.txt0000664000175000017500000000041315200367620023721 0ustar alastairalastair ecbuild_add_test( TARGET test_ecbuild_test_requires_complex TYPE SCRIPT COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} ) ecbuild-3.14.1/tests/bundle_override_features/0000775000175000017500000000000015200367620021604 5ustar alastairalastairecbuild-3.14.1/tests/bundle_override_features/bundle/0000775000175000017500000000000015200367620023055 5ustar alastairalastairecbuild-3.14.1/tests/bundle_override_features/bundle/project_a/0000775000175000017500000000000015200367620025023 5ustar alastairalastairecbuild-3.14.1/tests/bundle_override_features/bundle/project_a/CMakeLists.txt0000664000175000017500000000203715200367620027565 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( project_a VERSION 0.0.0 LANGUAGES C ) if( HAVE_TESTS ) ecbuild_error( "Tests should be disabled, as PROJECT_A_ENABLE_TESTS=${PROJECT_A_ENABLE_TESTS}," " even though ENABLE_TESTS=${ENABLE_TESTS}" ) endif() if( DEFINED ENABLE_X ) if( NOT _configured_before ) ecbuild_error( "This test is designed to have ENABLE_X undefined (upon first run at least)" ) set( _configured_before TRUE CACHE BOOL INTERNAL ) endif() endif() ecbuild_add_option( FEATURE X DEFAULT ON ) if( NOT HAVE_X ) ecbuild_error( "Feature X should be default-enabled as ENABLE_X is undefined" ) endif() ecbuild_add_option( FEATURE Y DEFAULT ON ) if( NOT HAVE_Y ) ecbuild_error( "Feature Y should be enabled, with ENABLE_Y=${ENABLE_Y} as set at bundle level" ) endif() ecbuild_add_option( FEATURE Z DEFAULT OFF ) if( HAVE_Z ) ecbuild_error( "Feature Y should be disabled, with ENABLE_Z=${ENABLE_Z} as set at bundle level" ) endif()ecbuild-3.14.1/tests/bundle_override_features/bundle/project_b/0000775000175000017500000000000015200367620025024 5ustar alastairalastairecbuild-3.14.1/tests/bundle_override_features/bundle/project_b/CMakeLists.txt0000664000175000017500000000156115200367620027567 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) project( project_b VERSION 0.0.0 LANGUAGES C ) if( NOT HAVE_TESTS ) ecbuild_error( "Tests should be enabled" ) endif() if( NOT DEFINED PROJECT_B_ENABLE_X ) ecbuild_error( "This test is designed to have PROJECT_B_ENABLE_X=OFF" ) endif() ecbuild_add_option( FEATURE X DEFAULT ON ) if( HAVE_X ) ecbuild_error( "Feature X should be disabled, as PROJECT_B_ENABLE_X=${PROJECT_B_ENABLE_X}," " even though ENABLE_X=OFF" ) endif() ecbuild_add_option( FEATURE Y DEFAULT OFF ) if( NOT HAVE_Y ) ecbuild_error( "Feature Y should be enabled, as ENABLE_Y=${ENABLE_Y} as set at bundle level" ) endif() ecbuild_add_option( FEATURE Z DEFAULT OFF ) if( HAVE_Z ) ecbuild_error( "Feature Y should be disabled, with ENABLE_Z=${ENABLE_Z} as set at bundle level" ) endif()ecbuild-3.14.1/tests/bundle_override_features/bundle/CMakeLists.txt0000664000175000017500000000060515200367620025616 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package( ecbuild REQUIRED ) set( ENABLE_TESTS ON CACHE BOOL "" ) set( PROJECT_A_ENABLE_TESTS OFF CACHE BOOL "" ) set( PROJECT_B_ENABLE_X OFF CACHE BOOL "" ) set(ENABLE_Y ON CACHE BOOL "" ) set(ENABLE_Z OFF CACHE BOOL "" ) project( bundle VERSION 0.0.0 LANGUAGES C ) add_subdirectory( project_a ) add_subdirectory( project_b ) ecbuild-3.14.1/tests/bundle_override_features/run-test.sh.in0000775000175000017500000000050015200367620024324 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" # --------------------- cleanup ------------------------ rm -rf $HERE/build # ---------------- build the bundle -------------------- cd $HERE export ecbuild_DIR=@PROJECT_BINARY_DIR@ mkdir build cd build cmake @bundle_SOURCE_DIR@ ecbuild-3.14.1/tests/bundle_override_features/CMakeLists.txt0000664000175000017500000000042115200367620024341 0ustar alastairalastair set( _ref ${CMAKE_CURRENT_BINARY_DIR} ) set( bundle_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bundle ) configure_file( run-test.sh.in ${_ref}/run-test.sh @ONLY ) ecbuild_add_test( TARGET bundle-override-features TYPE SCRIPT COMMAND ${_ref}/run-test.sh ) ecbuild-3.14.1/tests/CMakeLists.txt0000664000175000017500000000223315200367620017276 0ustar alastairalastairadd_subdirectory( bundle_options ) add_subdirectory( bundle_subdir ) add_subdirectory( bundle_subproj ) # ECBUILD-460 add_subdirectory( bundle_override_features ) # ECBUILD-486 add_subdirectory( ecbuild_regex_escape ) add_subdirectory( ecbuild_remove_fortran_flags ) # ECBUILD-484 add_subdirectory( ecbuild_add_option ) add_subdirectory( ecbuild_add_option_multiproject_defaults ) add_subdirectory( ecbuild_add_flags ) add_subdirectory( ecbuild_find_package ) add_subdirectory( ecbuild_find_python ) add_subdirectory( find_ecbuild ) add_subdirectory( ecbuild_shared_libs ) add_subdirectory( interface_library ) add_subdirectory( project_import ) add_subdirectory( project_options ) add_subdirectory( project_options_cached ) add_subdirectory( project_options_cached_multiproject ) add_subdirectory( project_summary ) add_subdirectory( ecbuild_override_compiler_flags ) add_subdirectory( ecbuild_override_compiler_flags_bailout ) add_subdirectory( test_properties ) add_subdirectory( test_requires_simple ) add_subdirectory( test_requires_complex ) add_subdirectory( test_custom_build_type ) add_subdirectory( ecbuild_install_dependency_with_soversion ) add_subdirectory( sg_pl ) ecbuild-3.14.1/tests/bundle_subproj/0000775000175000017500000000000015200367620017553 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subproj/run-test.sh.in0000775000175000017500000000043115200367620022276 0ustar alastairalastair#!/usr/bin/env bash set -e HERE="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" # --------------------- cleanup ------------------------ rm -rf $HERE/build # ---------------- build the bundle -------------------- cd $HERE mkdir build cd build cmake @mybundle_SOURCE_DIR@ ecbuild-3.14.1/tests/bundle_subproj/mybundle/0000775000175000017500000000000015200367620021372 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subproj/mybundle/mylib/0000775000175000017500000000000015200367620022506 5ustar alastairalastairecbuild-3.14.1/tests/bundle_subproj/mybundle/mylib/mylib-import.cmake.in0000664000175000017500000000005015200367620026534 0ustar alastairalastairset( mylib_found_using_find_package 1 ) ecbuild-3.14.1/tests/bundle_subproj/mybundle/mylib/CMakeLists.txt0000664000175000017500000000027015200367620025245 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) find_package(ecbuild 3.0 REQUIRED ) project( mylib VERSION 0.1.0 LANGUAGES NONE ) ecbuild_install_project( NAME ${PROJECT_NAME} ) ecbuild-3.14.1/tests/bundle_subproj/mybundle/ecbuild0000777000175000017500000000000015200367620023562 2../../../ustar alastairalastairecbuild-3.14.1/tests/bundle_subproj/mybundle/CMakeLists.txt0000664000175000017500000000076315200367620024140 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) project( mybundle VERSION 0.1.0.0 LANGUAGES NONE ) add_subdirectory( ecbuild ) add_subdirectory( mylib ) find_package( mylib REQUIRED ) if( NOT mylib_found_using_find_package ) # This variable is defined within the export files that are only called during find_package() message( FATAL_ERROR "The variable mylib_found_using_find_package is not set" ) endif() message( "mylib has been found successfully within a standard CMake project" ) ecbuild-3.14.1/tests/bundle_subproj/CMakeLists.txt0000664000175000017500000000041315200367620022311 0ustar alastairalastair set( _ref ${CMAKE_CURRENT_BINARY_DIR} ) set( mybundle_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mybundle ) configure_file( run-test.sh.in ${_ref}/run-test.sh @ONLY ) ecbuild_add_test( TARGET bundle-subproj TYPE SCRIPT COMMAND ${_ref}/run-test.sh ) ecbuild-3.14.1/README.rst0000664000175000017500000000270415200367620015066 0ustar alastairalastair============================ ecbuild - ECMWF build system ============================ ecBuild is built on top of CMake and consists of a set of macros as well as a wrapper around CMake. Calling:: ecbuild $SRC_DIR is equivalent to:: cmake -DCMAKE_MODULE_PATH=$ECBUILD_DIR/cmake $SRC_DIR Prior knowledge of CMake is assumed. For a tutorial, see e.g. https://cmake.org/cmake/help/latest/guide/tutorial/index.html Quick start =========== ecBuild does not need to be compiled, and can be used directly from the source repository. If you want to install it, please refer to the ``_ file. 1. Retrieve the source code:: git clone https://github.com/ecmwf/ecbuild 2. Add ``ecbuild`` to your ``PATH``:: export PATH=$PWD/ecbuild/bin:$PATH Examples ======== The `examples/ `_ directory contains some sample projects that show how ecBuild can be used in various situations. For a quick introduction on how to write an ecBuild project, have a look at ``_. Building a project ================== Just like CMake, ecBuild uses out-of-source builds. We will assume that your project sources are in ``$SRC_DIR`` (e.g. ``examples/simple``), and that your build directory is ``$BUILD_DIR`` (e.g. ``$SRC_DIR/build``):: mkdir -p $BUILD_DIR cd $BUILD_DIR ecbuild $SRC_DIR # see `ecbuild --help`, you may pass CMake options as well make # add your favourite options, e.g. -j ecbuild-3.14.1/bin/0000775000175000017500000000000015200367620014144 5ustar alastairalastairecbuild-3.14.1/bin/ecbuild0000775000175000017500000003165315200367620015511 0ustar alastairalastair#!/bin/bash --noprofile # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. set -eua CMAKE_MIN_REQUIRED=3.11 CMAKE_BUILD_VERSION=3.18.3 usage() { echo "Usage: ecbuild [--help] [--version]" exit $1 } help() { cat < ecbuild [option...] [--] [cmake-argument...] DESCRIPTION: ecbuild is a build system based on CMake, but providing a lot of macro's to make it easier to work with. Upon execution, the equivalent cmake command is printed. ecbuild/cmake must be called from an out-of-source build directory and forbids in-source builds. SYNOPSIS: --help Display this help --version Display ecbuild version Available values for "option": --cmakebin= Set which cmake binary to use. Default is 'cmake' --prefix= Set the install path to . Equivalent to cmake argument "-DCMAKE_INSTALL_PREFIX=" --build= Set the build-type to . Equivalent to cmake argument "-DCMAKE_BUILD_TYPE=" can be any of: - debug : Lowest optimization level, useful for debugging - release : Highest optimization level, for best performance - bit : Highest optimization level while staying bit-reproducible - ...others depending on project --log= Set the ecbuild log-level Equivalent to "-DECBUILD_LOG_LEVEL=" can be any of: - DEBUG - INFO - WARN - ERROR - CRITICAL - OFF Every choice outputs also the log-levels listed below itself --static Build static libraries. Equivalent to "-DBUILD_SHARED_LIBS=OFF" --dynamic, --shared Build dynamic libraries (usually the default). Equivalent to "-DBUILD_SHARED_LIBS=ON" --config= Configuration file using CMake syntax that gets included Equivalent to cmake argument "-DECBUILD_CONFIG=" --toolchain= Use a platform specific toolchain, containing settings such as compilation flags, locations of commonly used dependencies. should be the path to a custom toolchain file. Equivalent to cmake argument "-DCMAKE_TOOLCHAIN_FILE=" --cache= (advanced) A file called "ecbuild-cache.cmake" is generated during configuration. This file can be moved to a safe location, and specified for future builds to speed up checking of compiler/platform capabilities. Note that this is only accelerating fresh builds, as cmake internally caches also. Therefore this option is *not* recommended. --get-cmake[=] Automatically download CMake binaries from version $CMAKE_BUILD_VERSION. Requires an internet connection. If no prefix is given, install into $PWD/.local/. --build-cmake[=] Automatically download and build CMake version $CMAKE_BUILD_VERSION. Requires an internet connection and may take a while. If no prefix is given, install into $PWD/.local/. --dryrun Don't actually execute the cmake call, just print what would have been executed. Available values for "cmake-argument": Any value that can be usually passed to cmake to (re)configure the build. Typically these values start with "-D". example: -DENABLE_TESTS=ON -DENABLE_MPI=OFF -DECKIT_PATH=... They can be explicitly separated from [option...] with a "--", for the case there is a conflicting option with the "cmake" executable, and the latter's option is requested. ------------------------------------------------------------------------ NOTE: When reconfiguring a build, it is only necessary to change the relevant options, as everything stays cached. For example: > ecbuild --prefix=PREFIX . > ecbuild -DENABLE_TESTS=ON . ------------------------------------------------------------------------ Compiling: To compile the project with threads: > make -j To get verbose compilation/linking output: > make VERBOSE=1 Testing: To run the project's tests > ctest Also check the ctest manual/help for more options on running tests Installing: To install the project in location PREFIX with "--prefix=PREFIX" or "-DCMAKE_INSTALL_PREFIX=PREFIX" > make install ------------------------------------------------------------------------ ECMWF" EOF exit $1 } INSTALL_DIR="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" export ecbuild_ROOT="$( cd "$INSTALL_DIR/.." && pwd -P )" export ecbuild_DIR=$ecbuild_ROOT # for versions of CMake < 3.12 ECBUILD_MODULE_PATH="" # If there is a directory share/ecbuild/cmake relative to the parent directory # (as in an install tree), add it to CMAKE_MODULE_PATH if [ -d $INSTALL_DIR/../share/ecbuild/cmake ]; then ECBUILD_MODULE_PATH="$( cd "$INSTALL_DIR/../share/ecbuild/cmake" && pwd -P )" # If there is a cmake subdirectory relative to the script directory (as in a # tarball), add it to CMAKE_MODULE_PATH elif [ -d $INSTALL_DIR/../cmake ]; then ECBUILD_MODULE_PATH="$( cd "$INSTALL_DIR/../cmake" && pwd -P )" fi # Fail if we couldn't find ecBuild modules if [ ! -f "$ECBUILD_MODULE_PATH/ecbuild_system.cmake" ]; then echo "FATAL: ecBuild modules could not be found in either $INSTALL_DIR/../share/ecbuild/cmake or $INSTALL_DIR/../cmake" >&2 exit 1 fi ADD_ECBUILD_OPTIONS="-DCMAKE_MODULE_PATH=$ECBUILD_MODULE_PATH" version() { ecbuild_version=$(cat ${ECBUILD_MODULE_PATH}/VERSION) echo "ecbuild version ${ecbuild_version}" command -v cmake >/dev/null 2>&1 || { exit 0; } cmake --version | head -1 exit 0 } log() { log_level=$(tr "[a-z]" "[A-Z]" <<< "$1") ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_LOG_LEVEL=${log_level}" } prefix() { ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_INSTALL_PREFIX=${1/#\~\//$HOME/}" } config() { arg=${1/#\~\//$HOME/} if [ -f $arg ]; then config_file=$arg config_file="$( cd $( dirname "${config_file}" ) && pwd -P )/$( basename ${config_file} )" else echo "Error:" echo " Config file [$arg] is not found or is not a file." exit 1 fi ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_CONFIG=${config_file}" } toolchain() { arg=${1/#\~\//$HOME/} if [ -f $arg ]; then toolchain_file=$arg fi if [ -z ${toolchain_file+x} ]; then echo "Error toolchain $arg is not valid" exit 1 else ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${toolchain_file}" fi } cache() { arg=$1 if [ -f $arg ]; then cache_file=$arg cache_file="$( cd $( dirname "${cache_file}" ) && pwd -P )/$( basename ${cache_file} )" else echo "Error:" echo " Cache file [$arg] is not found or is not a file." exit 1 fi ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_CACHE=${cache_file}" } if test $# -eq 0; then usage 1 fi while test $# -gt 0; do # Split --option=value in $opt="--option" and $val="value" opt="" val="" case "$1" in --*=*) opt=`echo "$1" | sed 's/=.*//'` val=`echo "$1" | sed 's/--[_a-zA-Z0-9-]*=//'` ;; --*) opt=$1 ;; # -D*) # ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS $1" # ;; *) break ;; esac # echo "debug opt: $opt $val" # Parse options case "$opt" in --help) help 0 ;; --version) version ;; --dryrun) dryrun="yes" ;; --cmakebin) cmakebin="$val" ;; --prefix) prefix "$val" ;; --build) ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_BUILD_TYPE=$val" ;; --log) log $val ;; --static) ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DBUILD_SHARED_LIBS=OFF" ;; --dynamic) ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DBUILD_SHARED_LIBS=ON" ;; --shared) ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DBUILD_SHARED_LIBS=ON" ;; --toolchain) toolchain $val ;; --config) config $val ;; --cache) cache $val ;; --get-cmake) get_cmake="bin" if [[ -n $val ]]; then cmake_prefix="$val" fi ;; --build-cmake) get_cmake="src" if [[ -n $val ]]; then cmake_prefix="$val" fi ;; --) shift break ;; *) echo "unknown option: $opt" usage 1 ;; esac shift done # If no arguments remain, set srcARG to "." if [ $# -eq 0 ]; then srcARG="." fi if [ -z ${toolchain_file+x} ]; then if [ -z ${ECBUILD_TOOLCHAIN+x} ]; then : else toolchain ${ECBUILD_TOOLCHAIN} echo "ecbuild toolchain set using environment variable ECBUILD_TOOLCHAIN" fi fi src=${srcARG:=""} cmake=${cmakebin:=cmake} dryrun=${dryrun:=no} get_cmake=${get_cmake:=""} cmake_prefix=${cmake_prefix:=$PWD/.local} cmake_found="" cmake_version_sufficient="" # Check that version $1 satisfies $2 # CMake versions have no more than 4 fields # Version sort (sort -V) is not available on all platforms version_gte() { [ "$2" = "$(echo -e "$1\n$2" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 -g | head -n1)" ] } # Download a CMake tarball # $1: version # $2: suffix (optional) download_cmake() { tarball=cmake-$1${2:-""}.tar.gz if [[ ! -r $tarball ]]; then shortver=$(echo $1 | cut -d. -f1-2) url=http://www.cmake.org/files/v$shortver/$tarball # -N Download only if the remote version of the file is newer # --continue Continue an interrupted download # -T 60 Time out a download attempt after 60 seconds # -t 3 Only make 3 download attempts wget -N --continue -T 60 -t 3 $url || { echo "Failed to download CMake release $1." >&2 echo "Please download from $url" >&2 echo "and place $tarball in $PWD" >&2 exit 1 } fi echo $tarball } # Use already built CMake if any if [[ -x "${cmake_prefix}/bin/cmake" ]]; then echo "Using already built CMake in ${cmake_prefix}/bin/cmake" >&2 cmake="${cmake_prefix}/bin/cmake" # Get a CMake binary if requested and no sufficient version found elif [[ $get_cmake = "bin" ]]; then plat=$(uname -s) arch=$(uname -m) if [[ "${plat}" != "Linux" ]] && [[ "${plat}" != "Darwin" ]] ; then echo "Cannot download CMake binaries for this platform." >&2 echo "Please use --build-cmake to build from source." >&2 exit 1 fi if [[ "${arch}" != "x86_64" ]] ; then echo "Cannot download CMake binaries for this architecture." >&2 echo "Please use --build-cmake to build from source." >&2 exit 1 fi echo "Downloading CMake version ${CMAKE_BUILD_VERSION} binaries and installing into ${cmake_prefix} ..." >&2 tarball=$(download_cmake "${CMAKE_BUILD_VERSION}" "-${plat}-${arch}") mkdir -p "${cmake_prefix}" tar xzf $tarball -C "${cmake_prefix}" --strip-components=1 cmake="${cmake_prefix}/bin/cmake" # Build CMake from source if requested and no sufficient version found elif [[ $get_cmake = "src" ]]; then echo "Building CMake version ${CMAKE_BUILD_VERSION} and installing into ${cmake_prefix} ..." >&2 tarball=$(download_cmake "${CMAKE_BUILD_VERSION}") tar xzf $tarball ( mkdir -p build_cmake cd build_cmake ../cmake-${CMAKE_BUILD_VERSION}/bootstrap --prefix="${cmake_prefix}" && make && make install ) cmake="${cmake_prefix}/bin/cmake" fi # Check if the cmake version is sufficient if $(command -v $cmake >/dev/null 2>&1); then cmake_found="yes" cmake_version=$($cmake --version | head -n1 | awk '{ print $3 }') echo "Found CMake version $cmake_version" >& 2 if version_gte $cmake_version $CMAKE_MIN_REQUIRED; then cmake_version_sufficient="yes" fi fi # Fail if we don't have a sufficient CMake if [[ ! $cmake_version_sufficient ]]; then if [[ ! $cmake_found ]]; then echo "CMake is required and cannot be found in the PATH." >&2 else echo "CMake version $CMAKE_MIN_REQUIRED is required but only $cmake_version was found." >&2 fi echo "" >&2 echo " Try 'module load cmake', specify a CMake binary with --cmakebin=/path/to/cmake" >&2 echo " or let ecbuild download and build CMake with the --build-cmake option." >&2 exit 1 fi echo "" echo "$cmake ${ADD_ECBUILD_OPTIONS} $@ $src" echo "" if [ ${dryrun} == "yes" ]; then echo "[DRYRUN] -- not executing" exit 0 fi $cmake ${ADD_ECBUILD_OPTIONS} "$@" $src ecbuild-3.14.1/bin/CMakeLists.txt0000664000175000017500000000007315200367620016704 0ustar alastairalastairinstall( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} ) ecbuild-3.14.1/ecbuild-post-import.cmake.in0000664000175000017500000000046315200367620020710 0ustar alastairalastairif(@PROJECT_NAME@_IS_BUILD_DIR_EXPORT) set(ecbuild_MACROS_DIR @ECBUILD_MACROS_DIR@) else() set(ecbuild_MACROS_DIR ${ecbuild_BASE_DIR}/share/ecbuild/cmake) endif() if(NOT ${ecbuild_MACROS_DIR} IN_LIST CMAKE_MODULE_PATH) list(INSERT CMAKE_MODULE_PATH 0 ${ecbuild_MACROS_DIR}) endif() include(ecbuild) ecbuild-3.14.1/bamboo/0000775000175000017500000000000015200367620014633 5ustar alastairalastairecbuild-3.14.1/bamboo/env.sh0000775000175000017500000000037615200367620015770 0ustar alastairalastair#!/bin/bash #[[ $(uname) == "Darwin" ]] && return # no module environment on the Mac # initialise module environment if it is not #if [[ ! $(command -v module > /dev/null 2>&1) ]]; then # . /usr/local/apps/module/init/bash #fi #module load cmake/new ecbuild-3.14.1/bamboo/flags.cmake0000664000175000017500000000000015200367620016717 0ustar alastairalastairecbuild-3.14.1/lib/0000775000175000017500000000000015200367620014142 5ustar alastairalastairecbuild-3.14.1/lib/cmake/0000775000175000017500000000000015200367620015222 5ustar alastairalastairecbuild-3.14.1/lib/cmake/ecbuild/0000775000175000017500000000000015200367620016631 5ustar alastairalastairecbuild-3.14.1/lib/cmake/ecbuild/ecbuild-config-version.cmake0000664000175000017500000000063315200367620024172 0ustar alastairalastairinclude(${CMAKE_CURRENT_LIST_DIR}/../../../cmake/ecbuild_parse_version.cmake) ecbuild_parse_version_file(${CMAKE_CURRENT_LIST_DIR}/../../../VERSION PREFIX PACKAGE) if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() set(PACKAGE_VERSION_COMPATIBLE TRUE) if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_EXACT TRUE) endif() endif() ecbuild-3.14.1/lib/cmake/ecbuild/ecbuild-config.cmake0000664000175000017500000000125615200367620022511 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. get_filename_component(ecbuild_MACROS_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../cmake ABSOLUTE) cmake_policy( PUSH ) cmake_policy( SET CMP0057 NEW ) if(NOT ${ecbuild_MACROS_DIR} IN_LIST CMAKE_MODULE_PATH) list(INSERT CMAKE_MODULE_PATH 0 ${ecbuild_MACROS_DIR}) endif() cmake_policy( POP ) include(ecbuild) ecbuild-3.14.1/share/0000775000175000017500000000000015200367620014476 5ustar alastairalastairecbuild-3.14.1/share/ecbuild/0000775000175000017500000000000015200367620016105 5ustar alastairalastairecbuild-3.14.1/share/ecbuild/check_linker/0000775000175000017500000000000015200367620020526 5ustar alastairalastairecbuild-3.14.1/share/ecbuild/check_linker/dso2.c0000664000175000017500000000005615200367620021542 0ustar alastairalastairvoid fun1(void); void fun2(void) { fun1(); } ecbuild-3.14.1/share/ecbuild/check_linker/main.c0000664000175000017500000000007015200367620021613 0ustar alastairalastairvoid fun2(void); int main(void) { fun2(); return 0; } ecbuild-3.14.1/share/ecbuild/check_linker/dso1.c0000664000175000017500000000002415200367620021534 0ustar alastairalastairvoid fun1(void) {} ecbuild-3.14.1/share/ecbuild/check_linker/CMakeLists.txt0000664000175000017500000000225315200367620023270 0ustar alastairalastaircmake_minimum_required( VERSION 3.18 FATAL_ERROR ) #[=[ From https://sourceware.org/bugzilla/show_bug.cgi?id=20535 > $ cat dso1.c > void fun1(void) {} > > $ cat dso2.c > void fun1(void); > void fun2(void) { fun1(); } > > $ cat main.c > void fun2(void); > int main(void) { > fun2(); > return 0; > } > > $ mkdir dsos > $ gcc -shared -fPIC -o dsos/libdso1.so dso1.c > $ gcc -shared -fPIC -o dsos/libdso2.so -Wl,-rpath='$ORIGIN' dso2.c -Ldsos -ldso1 > $ gcc -Wl,-rpath='$ORIGIN/dsos' main.c -Ldsos -ldso2 #]=] set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) project(test_ld_origin VERSION 1.0 LANGUAGES C) add_library(dso1 SHARED dso1.c) add_library(dso2 SHARED dso2.c) target_link_libraries(dso2 PRIVATE dso1) set_target_properties(dso2 PROPERTIES INSTALL_RPATH "$ORIGIN") add_executable(main main.c) target_link_libraries(main dso2) set_target_properties(main PROPERTIES INSTALL_RPATH "$ORIGIN/../lib") set_target_properties(dso1 dso2 main PROPERTIES LIBRARY_OUTPUT_DIRECTORY lib RUNTIME_OUTPUT_DIRECTORY bin) install(TARGETS dso1 dso2 main LIBRARY DESTINATION lib RUNTIME DESTINATION bin) ecbuild-3.14.1/share/ecbuild/cmake0000777000175000017500000000000015200367620020534 2../../cmakeustar alastairalastairecbuild-3.14.1/share/ecmwf_license_header.txt0000664000175000017500000000061015200367620021347 0ustar alastairalastair/* * (C) Copyright 2011- ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. In * applying this licence, ECMWF does not waive the privileges and immunities * granted to it by virtue of its status as an intergovernmental organisation * nor does it submit to any jurisdiction. */ ecbuild-3.14.1/share/CMakeLists.txt0000664000175000017500000000122715200367620017240 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. # ecbuild_add_resources( TARGET ecbuild_share # SOURCE_PACK ecmwf_license_header.txt # DONT_PACK_DIRS ecbuild ) # install( DIRECTORY ecbuild/toolchains USE_SOURCE_PERMISSIONS DESTINATION ${INSTALL_DATA_DIR} ) install( DIRECTORY ecbuild/check_linker DESTINATION ${INSTALL_DATA_DIR} ) ecbuild-3.14.1/ecbuild_3.0_release_notes.rst0000664000175000017500000003551015200367620021031 0ustar alastairalastair========================= ecBuild 3.0 Release Notes ========================= Minimal CMake version requirement ================================= The minimal CMake version required for ecbuild 3 is 3.6. However we strongly recommend to update to a more recent version when possible. Backwards compatibility ======================= Many breaking changes have been done in order for ecBuild and users to take advantage of modern CMake features. In order to ensure a smooth transition, a compatibility layer has been kept and allows to build ecbuild2-compliant packages. However, this layer is deprecated by definition and efforts should be made to modernise the building scripts. Deprecated features print out warnings if the CMake variable ``ECBUILD_2_COMPAT_DEPRECATE`` is ``ON`` (add ``-DECBUILD_2_COMPAT_DEPRECATE=ON`` to the command line). The compatibility layer can be turned off completely by setting ``ECBUILD_2_COMPAT`` to ``OFF``. Bear in mind that packages built with the compatibility layer turned off may break dependencies relying on this layer (for third-party libraries handling for instance). Modernising ecBuild code ======================== This section contains some guidelines on the tasks that need to be done in order to modernise the code and make it work when compatibility mode is turned off. See below for details on the specific changes and how to handle them. 1. Put the version number into the main ``CMakeLists.txt`` in the ``project`` call 2. Replace ``REQUIRED_PACKAGES`` parameters of ``ecbuild_add_option`` by a combination of a ``find_package`` and ``CONDITION`` on the relevant packages. 3. Replace ``ecbuild_use_package`` by either ``add_subdirectory`` or ``ecbuild_find_package`` as appropriate 4. Declare a visibility for your link libraries and includes, either with the ``PRIVATE_*`` and ``PUBLIC_*`` parameters of ``ecbuild_add_library`` or by using ``target_link_libraries`` directly. 5. Advertise your usage requirements explicitly (replacement for the legacy TPL system) 6. Update the capitalisation of variable names New features ============ Project declaration ------------------- Fewer lines are now needed to enable ecBuild in a project:: cmake_minimum_required(VERSION 3.12 FATAL_ERROR) # ecbuild requires at least 3.6 find_package(ecbuild 3.0 REQUIRED) # note: the version requirement is optional project(foo LANGUAGES C CXX) # define options, targets... ecbuild_install_project(NAME ${PROJECT_NAME}) Project version management -------------------------- Instead of having a ``VERSION.cmake`` file, you should either create a file ``VERSION`` which contains the version that can contain an additional suffix; e.g. ``1.2-beta``. Alternatively you can declare the version (without suffix) as a parameter to the ``project`` command:: project(foo VERSION 1.2 LANGUAGES C CXX) This automatically defines the following variables: * ``foo_VERSION_STR`` (the full version number with suffix, as printed in ``VERSION`` file. * ``foo_VERSION`` (the full version number, without suffix) * ``foo_VERSION_MAJOR``, ``foo_VERSION_MINOR``, ``foo_VERSION_PATCH``, and ``foo_VERSION_TWEAK`` for the components of the version number (in this order) * ``foo_VERSION_SUFFIX`` (the suffix extracted from ``foo_VERSION_STR``) Variable naming conventions --------------------------- Some variable names have been changed in order to stick with the CMake naming schemes. Project information ^^^^^^^^^^^^^^^^^^^ All project-related variables now use the same capitalisation as the project itself, e.g. if the project name is ``projectA``, the version variable is ``projectA_VERSION``. This also includes variables resulting from a call to ``find_package`` (or ecBuild substitutes), like ``projectA_FOUND``. Features and options ^^^^^^^^^^^^^^^^^^^^ For options declared with ``ecbuild_add_option``, the status can be queried by checking ``HAVE_`` or ``_HAVE_``, where ```` and ```` have the same capitalisation as the original names. In order to comply with CMake package components checking, dependent packages can also use ``__FOUND``, e.g. ``projectA_TESTS_FOUND`` (where the project name is ``projectA`` and the feature is ``TESTS``). New macros ---------- ecbuild_configure_file ^^^^^^^^^^^^^^^^^^^^^^ This is a wrapper around `configure_file `_ and `file(GENERATE) `_, allowing to resolve both configuration variables and generator expressions at the same time. Target dependencies ------------------- Modern CMake aims to make the visibility of dependencies explicit. Build-only dependencies should be declared ``PRIVATE``, whereas usage requirements should be declared ``INTERFACE``. The ``PUBLIC`` flag exposes them both for build-time and as usage requirements. Bear in mind that any ``INTERFACE`` or ``PUBLIC`` requirement (library, include directory, compile flag) will be propagated transitively to dependent targets, even when building shared libraries. ``ecbuild_add_library(PUBLIC_LIBS | PRIVATE_LIBS)`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ These parameters have been added to allow easy update of the ``LIBS`` parameter of ``ecbuild_add_library``. This parameter is now deprecated and is only available in compatibility mode. Include directories and compile flags ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ With the use of targets, most include directories do not need to be set explicitly. If a library is defined with ``ecbuild_add_library``, the installation include directory is exported automatically. You may want to add build-only include directories using the ``BUILD_INTERFACE`` generator expression. In any case, the use of ``include_directories`` is not recommended, please link include directories to the relevant targets using either the ``{PUBLIC,PRIVATE}_INCLUDES`` parameters of ``ecbuild_add_*``, or ``target_include_directories``. The same is true for compile flags that should be explicitly associated to the relevant targets. As a consequence, the ``_INCLUDE_DIRECTORIES`` and ``_COMPILE_DEFINITIONS`` variables should not be used anymore for CMake projects. Bundles ------- The way bundles (or super-builds) work has been simplified. The interface of ``ecbuild_bundle`` has not changed and is the preferred way, but it is also possible to add "drop-in" packages just by using ``add_subdirectory``. Note however that there should still be a call to ``ecbuild_find_package`` or ``find_package`` to explicit dependencies and make sure the needed variables and targets are defined in the project scope. The use of ``ecbuild_use_package`` for bundles is kept only as part of the compatibility layer. Exported packages ----------------- CMake files location ^^^^^^^^^^^^^^^^^^^^ The CMake package configuration files are now installed into ``lib/cmake/`` instead of ``share//cmake``. Package configuration file ^^^^^^^^^^^^^^^^^^^^^^^^^^ The way package configuration files are generated, as well as their contents, has been modernised (see `configure_package_config_file `_ for details). The TPL handling has been removed (see below for details). The new config file template allows dependent packages to require specific features via the ``COMPONENTS`` parameter of ``find_package`` and ``ecbuild_find_package``. All features defined via ``ecbuild_add_option`` will have a corresponding ``__FOUND`` variable that can be queried from dependent packages to check whether the feature is available. Package version file ^^^^^^^^^^^^^^^^^^^^ The version file is now directly generated by CMake (see `write_basic_package_version_file `_ for details). Package targets file ^^^^^^^^^^^^^^^^^^^^ Instead of using one targets file per build, bundles now use one file per project. Interface libraries ------------------- The ``ecbuild_add_library`` macro now supports ``TYPE INTERFACE``, wrapping `CMake INTERFACE libraries `_. These libraries do not have any build stage, but can be used for aggregating libraries, include directories and compile definitions, or for header-only libraries. The ``PRIVATE`` visibility makes no sense for these libraries and should not be used. The ``PUBLIC_INCLUDES`` and ``PUBLIC_LIBS`` will be used to populate the interface properties. Fortran interfaces ------------------ The ``ecbuild_generate_fortran_interfaces`` macro now creates an INTERFACE library target that can be linked to by using ``target_link_libraries`` or the ``*LIBS`` parameters of ecBuild macros, the include directories will be propagated automatically. Deprecated / Removed features ============================= Third-party libraries (TPL) --------------------------- The TPL facilities are deprecated, and package maintainers should not rely on them. Instead, in case a package has **usage** dependencies, it should ensure they are available as well. One way of doing this is to create a file called ``-import.cmake.in`` at the top-level source directory (where the main ``CMakeLists.txt`` is located), which will be configured (see `configure_file `_) and loaded by CMake when calling ``find_package`` (or an ecBuild wrapper). For instance, if the package ``bar`` requires ``foo`` as a usage dependency, the ``bar-import.cmake.in`` file could contain:: include(CMakeFindDependencyMacro) set(bar_foo_FOUND @foo_FOUND@) if(bar_foo_FOUND) find_dependency(foo 1.3 HINTS @foo_DIR@ ) endif() Since the include directories and compile flags can (and should) be associated to the targets, the ``_LIBRARIES``, ``_INCLUDE_DIRECTORIES``, and ``_COMPILE_DEFINITIONS`` variables are not exported anymore (except in the compatibility layer). ecbuild_use_package ------------------- The ``ecbuild_use_package`` macro is only available in compatibility mode and should not be used anymore. This macro had two different use cases, which should be replaced by different code, as suggested in the following. Include a package as a sub-project ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This behaviour allows to import a package provided as a source code subdirectory, either by setting ``_SOURCE_DIR`` , or by matching the package name with the name of an actual subdirectory. This should be replaced by a direct call to ``add_subdirectory``. Look for a package ^^^^^^^^^^^^^^^^^^ This behaviour is equivalent to ``ecbuild_find_package``, which should be used as a replacement. Extra targets ------------- The special targets ``execs``, ``libs``, ``and`` ``links`` has been removed. C++11 feature checking ---------------------- ecbuild_add_cxx11_flags ^^^^^^^^^^^^^^^^^^^^^^^ This macro is only available in compatibility mode and should not be used anymore. CMake can handle C++ standard requirements directly:: set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) ecbuild_check_cxx11 ^^^^^^^^^^^^^^^^^^^ This function has been removed, a placeholder is available in compatibility mode. If you want to check for specific features, see the `CMAKE_CXX_COMPILE_FEATURES `_ variable. Package search path manipulation macros --------------------------------------- The ``ecbuild_add_extra_search_paths`` and ``ecbuild_list_extra_search_paths`` macros have been removed, since the package search paths are handled by ``ecbuild_find_package`` and ``find_package`` directly. ecbuild_add_option(REQUIRED_PACKAGES) ------------------------------------- The ``REQUIRED_PACKAGES`` of ``ecbuild_add_option`` is only available in compatibility mode and should not be used anymore. Instead, check for the package before and use ``CONDITION``:: find_package(foo 1.3 QUIET) # or ecbuild_find_package ecbuild_add_option(FEATURE FOO CONDITION foo_FOUND) The behaviour of ``REQUIRED_PACKAGES`` is as follows, you may want to mimic that functionality: 1. ``REQUIRED_PACKAGES`` takes a list of strings, each one representing a package requirement. If the string starts with ``PROJECT``, it should contains valid arguments for a direct call to ``ecbuild_use_package``. Otherwise, you can use either ``ecbuild_find_package`` or ``find_package``. We recommend using ``ecbuild_find_package`` for ECMWF software built with ecBuild. 2. Some special cases were present in the ``REQUIRED_PACKAGES`` handling: requiring ``MPI``, ``OMP``, ``Python``, or ``LEXYACC`` called the corresponding ``ecbuild_find_*`` macro. ecbuild_generate_rpc -------------------- This macro is deprecated and only available in compatibility mode. External "contrib" modules -------------------------- GreatCMakeCookOff ^^^^^^^^^^^^^^^^^ The files imported from the `GreatCMakeCookOff repository on GitHub `_ have been removed CMake 3.7 modules ^^^^^^^^^^^^^^^^^ The modules ``CheckFortranCompilerFlag.cmake``, ``CheckFortranSourceCompiles.cmake``, and ``CMakeCheckCompilerFlagCommonPatterns.cmake`` were backported from CMake 3.7, and have now been removed since they also exist in CMake 3.6. Find*.cmake ----------- In order to reduce the amount of code to maintain within ecBuild, many Find*.cmake scripts have been removed. If your project has specific needs, please include the appropriate scripts in the ``cmake/`` directory. Here is a list of the modules that have been removed: * contrib/FindNumPy.cmake * contrib/GreatCMakeCookOff/FindEigen.cmake * FindADSM.cmake * FindAEC.cmake * FindAIO.cmake * FindArmadillo.cmake * FindHPSS.cmake * FindLibGFortran.cmake * FindLibIFort.cmake * FindLustreAPI.cmake * FindNAG.cmake (still available in compat mode) * FindNDBM.cmake * FindNetCDF3.cmake (still available in compat mode) * FindOpenCL.cmake * FindOpenJPEG.cmake * FindPGIFortran.cmake * FindProj4.cmake * FindREADLINE.cmake * FindRealtime.cmake * FindRPC.cmake * FindRPCGEN.cmake * Findspot.cmake * FindSZip.cmake * FindTrilinos.cmake * FindViennaCL.cmake * FindXLFortranLibs.cmake Boost unit tests ---------------- The ``BOOST`` keyword has been removed from ``ecbuild_add_test``, as well as all associated facilities. Boost unit tests can still be used but the user is responsible for linking to Boost libraries. ecbuild_bundle(STASH) --------------------- The ``STASH`` keyword of ``ecbuild_bundle`` is ECMWF-specific and requires hardcoding some internal URLs into the ecBuild source code. Therefore, it is only available in compatibility mode and should not be used anymore. Please put the full git URL instead (you may want to use a variable to enable easy changes). ecbuild-3.14.1/doc/0000775000175000017500000000000015200367620014141 5ustar alastairalastairecbuild-3.14.1/doc/contrib.rst0000664000175000017500000000015615200367620016335 0ustar alastairalastairecBuild third party scripts ########################### .. toctree:: :maxdepth: 1 :glob: contrib/* ecbuild-3.14.1/doc/generate.py0000664000175000017500000000142415200367620016306 0ustar alastairalastair#!/usr/bin/env python """Generate sphinx documentation tree for ecBuild CMake macros.""" from glob import glob from os import makedirs, path import sys TOC = [('macros', 'ecbuild*.cmake'), ('find', 'Find*.cmake'), ('contrib', 'contrib/*.cmake')] CWD = path.abspath(path.dirname(__file__)) def generate(basedir): for section, pattern in TOC: section = path.join(CWD, section) if not path.exists(section): makedirs(section) for m in sorted(glob(path.join(basedir, pattern))): base = path.splitext(path.basename(m))[0] with open(path.join(section, base) + '.rst', 'w') as c: c.write('.. cmake-module :: %s\n' % path.relpath(m, section)) if __name__ == '__main__': generate(sys.argv[1]) ecbuild-3.14.1/doc/macros.rst0000664000175000017500000000012315200367620016153 0ustar alastairalastairecBuild macros ############## .. toctree:: :maxdepth: 1 :glob: macros/* ecbuild-3.14.1/doc/requirements.txt0000664000175000017500000000015615200367620017427 0ustar alastairalastair# These are the requirements for readthedoc docutils Sphinx>=4.4.0 setuptools>=51.0.0 sphinx-rtd-theme>=0.5.0 ecbuild-3.14.1/doc/conf.py0000664000175000017500000000302315200367620015436 0ustar alastairalastair#============================================================================= # CMake - Cross Platform Makefile Generator # Copyright 2000-2013 Kitware, Inc., Insight Software Consortium # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= import sys import os import re def parse_version(ver_str): return re.sub("^((([0-9]+)\\.)+([0-9]+)).*", "\\1", ver_str) here = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, here) source_suffix = '.rst' master_doc = 'index' project = 'ecBuild' copyright = 'ECMWF' with open(os.path.join(here, '..', 'VERSION'), 'r') as f: release = f.readline().strip() # full version string version = parse_version(release) # feature version primary_domain = 'cmake' exclude_patterns = [] extensions = ['cmake'] templates_path = [os.path.join(here, 'templates')] nitpicky = True html_show_sourcelink = True html_static_path = [os.path.join(here, 'static')] html_theme = 'sphinx_rtd_theme' html_title = 'ecBuild %s Documentation' % release html_short_title = '%s Documentation' % release html_favicon = os.path.join(here, 'static', 'ecbuild.ico') # Extract the docs from the .cmake files from generate import generate generate(os.path.join(here, '..', 'cmake')) ecbuild-3.14.1/doc/cmake.py0000664000175000017500000003760115200367620015602 0ustar alastairalastair# ============================================================================= # CMake - Cross Platform Makefile Generator # Copyright 2000-2013 Kitware, Inc., Insight Software Consortium # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. # ============================================================================= import os import re # Monkey patch for pygments reporting an error when generator expressions are # used. # https://bitbucket.org/birkenfeld/pygments-main/issue/942/cmake-generator-expressions-not-handled from pygments.lexers import CMakeLexer from pygments.token import Name, Operator from pygments.lexer import bygroups CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator))) # Monkey patch for sphinx generating invalid content for qcollectiongenerator # https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords import html from sphinxcontrib.qthelp import QtHelpBuilder old_build_keywords = QtHelpBuilder.build_keywords def new_build_keywords(self, title, refs, subitems): old_items = old_build_keywords(self, title, refs, subitems) new_items = [] for item in old_items: before, rest = item.split("ref=\"", 1) ref, after = rest.split("\"") if ("<" in ref and ">" in ref): new_items.append(before + 'ref="' + html.escape(ref) + '"' + after) else: new_items.append(item) return new_items QtHelpBuilder.build_keywords = new_build_keywords from docutils.parsers.rst import Directive, directives from docutils.transforms import Transform class EncodedString(str): """ Safely convert an object to a string, handling encoding issues. This replaces previously used `ErrorString` and `SafeString` classes (recently removed/deprecated from `docutils`), which were used to handle encoding errors when converting objects to strings for error messages. """ def __new__(cls, obj): try: if isinstance(obj, bytes): return super().__new__(cls, obj.decode('utf-8', errors='replace')) return super().__new__(cls, str(obj)) except Exception: try: return super().__new__(cls, repr(obj)) except Exception: return super().__new__(cls, object.__repr__(obj)) from docutils import io, nodes from sphinx.directives import ObjectDescription from sphinx.domains import Domain, ObjType from sphinx.roles import XRefRole from sphinx.util.nodes import make_refnode from sphinx import addnodes class CMakeModule(Directive): required_arguments = 1 optional_arguments = 0 final_argument_whitespace = True option_spec = {'encoding': directives.encoding} def __init__(self, *args, **keys): self.re_start = re.compile(r'^#\[(?P=*)\[\.rst:$') Directive.__init__(self, *args, **keys) def run(self): settings = self.state.document.settings if not settings.file_insertion_enabled: raise self.warning('"%s" directive disabled.' % self.name) env = self.state.document.settings.env rel_path, path = env.relfn2path(self.arguments[0]) path = os.path.normpath(path) encoding = self.options.get('encoding', settings.input_encoding) e_handler = settings.input_encoding_error_handler try: settings.record_dependencies.add(path) f = io.FileInput(source_path=path, encoding=encoding, error_handler=e_handler) except UnicodeEncodeError as error: raise self.severe('Problems with "%s" directive path:\n' 'Cannot encode input file path "%s" ' '(wrong locale?).' % (self.name, EncodedString(path))) except IOError as error: raise self.severe('Problems with "%s" directive path:\n%s.' % (self.name, EncodedString(error))) raw_lines = f.read().splitlines() f.close() rst = None lines = [] for line in raw_lines: if rst is not None and rst != '#': # Bracket mode: check for end bracket pos = line.find(rst) if pos >= 0: if line[0] == '#': line = '' else: line = line[0:pos] rst = None else: # Line mode: check for .rst start (bracket or line) m = self.re_start.match(line) if m: rst = ']%s]' % m.group('eq') line = '' elif line == '#.rst:': rst = '#' line = '' elif rst == '#': if line == '#' or line[:2] == '# ': line = line[2:] else: rst = None line = '' elif rst is None: line = '' lines.append(line) if rst is not None and rst != '#': raise self.warning('"%s" found unclosed bracket "#[%s[.rst:" in %s' % (self.name, rst[1:-1], path)) self.state_machine.insert_input(lines, path) return [] class _cmake_index_entry: def __init__(self, desc): self.desc = desc def __call__(self, title, targetid, main='main'): return ('pair', u'%s ; %s' % (self.desc, title), targetid, main) _cmake_index_objs = { 'command': _cmake_index_entry('command'), 'generator': _cmake_index_entry('generator'), 'manual': _cmake_index_entry('manual'), 'module': _cmake_index_entry('module'), 'policy': _cmake_index_entry('policy'), 'prop_cache': _cmake_index_entry('cache property'), 'prop_dir': _cmake_index_entry('directory property'), 'prop_gbl': _cmake_index_entry('global property'), 'prop_inst': _cmake_index_entry('installed file property'), 'prop_sf': _cmake_index_entry('source file property'), 'prop_test': _cmake_index_entry('test property'), 'prop_tgt': _cmake_index_entry('target property'), 'variable': _cmake_index_entry('variable'), } def _cmake_object_inventory(env, document, line, objtype, targetid): inv = env.domaindata['cmake']['objects'] if targetid in inv: document.reporter.warning( 'CMake object "%s" also described in "%s".' % (targetid, env.doc2path(inv[targetid][0])), line=line) inv[targetid] = (env.docname, objtype) class CMakeTransform(Transform): # Run this transform early since we insert nodes we want # treated as if they were written in the documents. default_priority = 210 def __init__(self, document, startnode): Transform.__init__(self, document, startnode) self.titles = {} def parse_title(self, docname): """Parse a document title as the first line starting in [A-Za-z0-9<] or fall back to the document basename if no such line exists. The cmake --help-*-list commands also depend on this convention. Return the title or False if the document file does not exist. """ env = self.document.settings.env title = self.titles.get(docname) if title is None: fname = os.path.join(env.srcdir, docname+'.rst') try: f = open(fname, 'r') except IOError: title = False else: for line in f: if len(line) > 0 and (line[0].isalnum() or line[0] == '<'): title = line.rstrip() break f.close() if title is None: title = os.path.basename(docname) self.titles[docname] = title return title def apply(self): env = self.document.settings.env # Treat some documents as cmake domain objects. objtype, sep, tail = env.docname.rpartition('/') make_index_entry = _cmake_index_objs.get(objtype) if make_index_entry: title = self.parse_title(env.docname) # Insert the object link target. if objtype == 'command': targetname = title.lower() else: targetname = title targetid = '%s:%s' % (objtype, targetname) targetnode = nodes.target('', '', ids=[targetid]) self.document.note_explicit_target(targetnode) self.document.insert(0, targetnode) # Insert the object index entry. indexnode = addnodes.index() indexnode['entries'] = [make_index_entry(title, targetid)] self.document.insert(0, indexnode) # Add to cmake domain object inventory _cmake_object_inventory(env, self.document, 1, objtype, targetid) class CMakeObject(ObjectDescription): def handle_signature(self, sig, signode): # called from sphinx.directives.ObjectDescription.run() signode += addnodes.desc_name(sig, sig) return sig def add_target_and_index(self, name, sig, signode): if self.objtype == 'command': targetname = name.lower() else: targetname = name targetid = '%s:%s' % (self.objtype, targetname) if targetid not in self.state.document.ids: signode['names'].append(targetid) signode['ids'].append(targetid) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) _cmake_object_inventory(self.env, self.state.document, self.lineno, self.objtype, targetid) make_index_entry = _cmake_index_objs.get(self.objtype) if make_index_entry: self.indexnode['entries'].append(make_index_entry(name, targetid)) class CMakeXRefRole(XRefRole): # See sphinx.util.nodes.explicit_title_re; \x00 escapes '<'. _re = re.compile(r'^(.+?)(\s*)(?$', re.DOTALL) _re_sub = re.compile(r'^([^()\s]+)\s*\(([^()]*)\)$', re.DOTALL) def __call__(self, typ, rawtext, text, *args, **keys): # Translate CMake command cross-references of the form: # `command_name(SUB_COMMAND)` # to have an explicit target: # `command_name(SUB_COMMAND) ` if typ == 'cmake:command': m = CMakeXRefRole._re_sub.match(text) if m: text = '%s <%s>' % (text, m.group(1)) # CMake cross-reference targets frequently contain '<' so escape # any explicit `` with '<' not preceded by whitespace. while True: m = CMakeXRefRole._re.match(text) if m and len(m.group(2)) == 0: text = '%s\x00<%s>' % (m.group(1), m.group(3)) else: break return XRefRole.__call__(self, typ, rawtext, text, *args, **keys) # We cannot insert index nodes using the result_nodes method # because CMakeXRefRole is processed before substitution_reference # nodes are evaluated so target nodes (with 'ids' fields) would be # duplicated in each evaluted substitution replacement. The # docutils substitution transform does not allow this. Instead we # use our own CMakeXRefTransform below to add index entries after # substitutions are completed. # # def result_nodes(self, document, env, node, is_ref): # pass class CMakeXRefTransform(Transform): # Run this transform early since we insert nodes we want # treated as if they were written in the documents, but # after the sphinx (210) and docutils (220) substitutions. default_priority = 221 def apply(self): env = self.document.settings.env # Find CMake cross-reference nodes and add index and target # nodes for them. for ref in self.document.traverse(addnodes.pending_xref): if not ref['refdomain'] == 'cmake': continue objtype = ref['reftype'] make_index_entry = _cmake_index_objs.get(objtype) if not make_index_entry: continue objname = ref['reftarget'] targetnum = env.new_serialno('index-%s:%s' % (objtype, objname)) targetid = 'index-%s-%s:%s' % (targetnum, objtype, objname) targetnode = nodes.target('', '', ids=[targetid]) self.document.note_explicit_target(targetnode) indexnode = addnodes.index() indexnode['entries'] = [make_index_entry(objname, targetid, '')] ref.replace_self([indexnode, targetnode, ref]) class CMakeDomain(Domain): """CMake domain.""" name = 'cmake' label = 'CMake' object_types = { 'command': ObjType('command', 'command'), 'generator': ObjType('generator', 'generator'), 'variable': ObjType('variable', 'variable'), 'module': ObjType('module', 'module'), 'policy': ObjType('policy', 'policy'), 'prop_cache': ObjType('prop_cache', 'prop_cache'), 'prop_dir': ObjType('prop_dir', 'prop_dir'), 'prop_gbl': ObjType('prop_gbl', 'prop_gbl'), 'prop_inst': ObjType('prop_inst', 'prop_inst'), 'prop_sf': ObjType('prop_sf', 'prop_sf'), 'prop_test': ObjType('prop_test', 'prop_test'), 'prop_tgt': ObjType('prop_tgt', 'prop_tgt'), 'manual': ObjType('manual', 'manual'), } directives = { 'command': CMakeObject, 'variable': CMakeObject, # Other object types cannot be created except by the CMakeTransform # 'generator': CMakeObject, # 'module': CMakeObject, # 'policy': CMakeObject, # 'prop_cache': CMakeObject, # 'prop_dir': CMakeObject, # 'prop_gbl': CMakeObject, # 'prop_inst': CMakeObject, # 'prop_sf': CMakeObject, # 'prop_test': CMakeObject, # 'prop_tgt': CMakeObject, # 'manual': CMakeObject, } roles = { 'command': CMakeXRefRole(fix_parens=True, lowercase=True), 'generator': CMakeXRefRole(), 'variable': CMakeXRefRole(), 'module': CMakeXRefRole(), 'policy': CMakeXRefRole(), 'prop_cache': CMakeXRefRole(), 'prop_dir': CMakeXRefRole(), 'prop_gbl': CMakeXRefRole(), 'prop_inst': CMakeXRefRole(), 'prop_sf': CMakeXRefRole(), 'prop_test': CMakeXRefRole(), 'prop_tgt': CMakeXRefRole(), 'manual': CMakeXRefRole(), } initial_data = { 'objects': {}, # fullname -> docname, objtype } def clear_doc(self, docname): to_clear = set() for fullname, (fn, _) in self.data['objects'].items(): if fn == docname: to_clear.add(fullname) for fullname in to_clear: del self.data['objects'][fullname] def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): targetid = '%s:%s' % (typ, target) obj = self.data['objects'].get(targetid) if obj is None: # TODO: warn somehow? return None return make_refnode(builder, fromdocname, obj[0], targetid, contnode, target) def get_objects(self): for refname, (docname, type) in self.data['objects'].items(): yield (refname, refname, type, docname, refname, 1) def setup(app): app.add_directive('cmake-module', CMakeModule) app.add_transform(CMakeTransform) app.add_transform(CMakeXRefTransform) app.add_domain(CMakeDomain) ecbuild-3.14.1/doc/static/0000775000175000017500000000000015200367620015430 5ustar alastairalastairecbuild-3.14.1/doc/static/ecbuild.ico0000664000175000017500000030657615200367620017554 0ustar alastairalastair hf 00 %  2 (.C@@ (BVK(    <<<,HHH[?pT tttfCCCK1O(e0IJl0n3wC̱oAQ;)GHH{{{_=KMŠ]vDn4s6p8X/U*243}{Z=}[rMvRjCW.^5]-L)d#]B󒒑=?>}zZ/k7sBzP\gAQ+O*;"9)D(`9JKJytph4vT6@,:3޼ÐyŒjJ|Mj@T0?$.}}xqc<'2(|y| idF`[}VQy%5|(,   BBB~MMM &?[rq^E-VVV5㯯Ѐ .Q#Fm8q<I$ eDG***NwwwtPlFxUjDV-T+b7d2Z-?!88+ prq.0/dQF\sJvMxP_`Y/T-[9T+R)ې9!8&U5z{{354_F3i6l7k7h6sFÐouQc?N*K)D%"'@+G'T-s;=<_D,t:t;q9m7h6~X__;K)D%9!'hRTS@0\>~S*f4l7zRh@V3Z>=#:,ϖB%Y/zKH…BǍFbuvv~rpnJA:Q)|Reh2z;߅A!H#O'P&K%E"}>k6B$ weTB2!666=. %d.d= I&T*^,f/l1m1o2o3n2m1k0e.\,S(F"k:h '   q[0Eӵ y+ @%7C"M&[+f/m1r2u3w4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1[0Y/W.U-T-iHɜˠˡˢˢˢmD'?#=";"8!6 Q?{n"L'-28 =#kUțQ.Q,V.[0_2d4i7vDMٴլK†JÈIŊHƋHƍFȎFʑG˓H͕IΗJϙKћLќLҞMӟMԠNԡNբOբO֣O֣O֣O֣P֣P֣O֣O֣O֢OբOբOӠMϜLƔIg{}|~xtpe5d3c3b3a2_2]1[0Y/W.U-S,T/tΦϧϨϨΨwC'>#<":!8 6F3ƚv %&,17 <"A%pzQ+V.[0_2g8yMQPȱ˛n‡NĉMŊLƍLǎKȐJʐI˒H̔IΗJϙKЛLҜLӞMԟNԠNբO֢O֣OפPפPץPץPץPץPץPץPפPפP֣P֣OԡOҟNəJRX|>|D{~{xlIf4e4c3a2_1]1[0Y/W.U-S,R,dCϧҮҮӮҮÔD(>#<":!8 5A-ڼX~%*06;"A$I)ɜeU-Z/g<|SVUUÌYÊRŌPǍPȏOɑNʒM˔L͕K͖KϘKКKќLӞMԠNաNբO֣OפPץPئPئQئQاQاQاQئQئQئQإPץPפPգPӡN͜LFK~?|>z=x=v?~pQg5e4c3a2_1]0[0Y/W.T-R,P+Q.rղִֵֶɞD(=#;"9!7 5A.:#օ)/4:!?$E&U5ҭqPkE~YYXWȖmιÊUōUƏTȐSʒS˔Q̕Q͗PΘOϙNЛLќLҞMԠNաO֣OפPץPئQاQ٧Q٨Q٨Q٨RڨR٨R٨Q٨Q٧Q٧QئQئPץPգOϞMÔHowC@~?|>z=x=v=ȗn{XrTg5e4c3`2_1\0Z/X/V.T-R,P+O+[;ӯٻٻڼϩD)=#;"9!6 4D15!'-39!>#D&I(kLܿk\[[ZөݽČXƎWǐWɒVʕU˖U͘TΙSϛSѝQҝPӞOԟNաO֣OפPئPاQ٨QڨRکRکRڪR۪R۪RڪRڪRکRکRڨR٨Q٧QئQդOҠNȘJ[d~>@?~?|>z=x=˚pr;p9n8sJ~tVf5d4b3`2^1\0Z/X.V.T-R,P+M*N,k۽¸ùմD)<":!8 64L;2Z%+17 =#C%K*sW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4c3a2_1\0Z/X.U-S,Q+O*L)J(H'E&C%A$>#<":!7 5E2m_H8||H?“ĕŖșʝ̟΢ХӨի׭ٱ~۴~޷~⾆ڶ޸ʈ|zyxwusqoh\[[ZYXXWV߰UݮTܬS۪R٨QئQפPբO̟Zk7i6g5d4b3`2]1[0Y/W.T-R,P+M*K)I(F'D&B%?$=#;"8!6I6re?--||}um“ĕŗǙɼ̟͢͢Фѧԫ֭ٱ۳ݷߺĈܴэ}{zywurp_\[ZYYXWV߰UݮTܬSڪR٧QץP֣OաNӟMƝal7j6h5e4c3a2^1\0Z/W.U-S,P+N*L)I(G'E&B%@$>#;"9!:$_Oug?--|||ڊ2)ÔĕŗǙµϧ˟͡ϤѧԪխذڳܶߺ⽁āɇޱ֑}{ywusj\[ZYXXWVޯUݭT۫SکRاQפPբOԠNҞMћL͚PÞm8k7i6f5d4a3_2]1[0X/V.T-Q+O*L)J(H'E&C%A$?#<":!L8{ldT5".ڇ,|E|_W”ÕĖŗƙڼҭ˟͡ΤѦөլׯڲܶ߹ἃăǃ˃χږ|{xus`[ZYXWV߱UޯTܬS۪R٨QئQ֣PաOӟNҝMКKϘJ͖IƘ[˱t>n8l7i6g5e4b3`2^1[0Y/W.T-R,P+M*K)H(F'D&A%?$=#?'kYrK81/,E|!ÕĖŘƙֵԱ˟̡ΣЦҨԫ֮ٲ۵ݸໄ⿅ÄDŽʅ΅фԇӆyvl[ZYXWV߰UݮTܫSکR٧QפPբOԠNҞMћLϙKΗJ̔I˒HɐGƐNg¿·Ŷİs{Es:q9o8l7j6h5e4c3a2^1\0Y/W.U-S,P+N*K)I(G'D&B%@$=#V@yk[9$1/-||D<ÖėŘƚӰ׵ʞ̡ͣϥѧӪխذٳܷߺ⽆ņɆ͇чՇօ׆ޞݧ́`YYXW߱UޯTܬS۪R٨QإP֣OԡNӞMќLКKΗJ͕I˓HʐGȎFƌEʼnDÇC֭ÈL~?{>y=vy=wz=wz=wŚƛ̦ټɟʠ̡ͣϥШҪԬկױڴܷ޺ཉÉƉɈˇˆ˅ʃȀ~{xvdܬSڪR٨Qܮa}ɚ׵Ϫ།֪o͗QȎFnjEŊDćCŊJٴ~?|>z=wwE{LSZahoœuǘ|͡׶۽ͤtsWZ:H'F&C%A$?#<":!8 531.,*=|N|lgǝӲѮɟʠˡ̣ͤϦѨҪԬծװس۵ݸ޺༈ᾈ}zx߸uܱjաOԟNҞMќLКKΗJ͕I̓HʑHɏGǍFƌF˖ZϞh׮ϹٴܺƯ͸ϾǴݿضԮϥʝŔxo`fDR,O*M)J(H'E&C%A$?#<":!8 531.,)N|`~}y̥׸Ȟɟʠˢ̣ΥϦШҪӫծְزٴ۶ܸ޹ߺ༆ἄἃἁ}z޷xݵvܳs֤ZћLϙKΗJ͕I̓HʑHɏGȍFƋEʼnDÇC…B̙cӧ||>z=x#<":!7 530.,)`|u%غʣȟɠʡˢ̣ͤΦЧѩӫԭ֮װرٳ۵ܶݷݸݸݷ޷ݶ}ݵ{ܳy۲wڰtجoΗL̔I˒HʐGɏFǍFƋEʼnDÇC…BAΟn͜l{>x=v#<"9!7 520.+)u|u%ӲȞȞɟʠˡ̣ͤΥϧѨҪӫԭծׯװرٲٳڳڳڳڲ~ڱ|ٯzخw׬u֪rѡdȎFǍFƋEŊDĈDÆC„BA@ҧ|Ƒ^y=w~D̶ܺHt;r:p9n8l7j7h6f5d4b3`2^1\0Z/X.V-T-Q,O+M*K)I(G'D&B%@$>#;"9!7 520.,)'N|=E@faƜǞȞȟɟʠʠʡˢ̢ͣͤΥϥЦЦЦѧѧѦѦѥ}Ѥ{УyТwϠtΟr͝p˙j~Dx=w<Ƒc۹v@p9o8m8k7i6h5f5d4b3`2^1\0Z/X/V.T-R,P+N*L)I(G'E&C%A$?#<":!8 641/-+(&= 82#PKӘKFĘǝȞȞȞȟɟʟʠˠ̡̢͢͢ΣΣΣΣ΢΢~Ρ}Ρ|͠y͞w̝u̜sʙpɘnŐczDײĐfn8l7k7i6h5f5e4c3a2_2]1\0Z/X.V.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(b`d?4@== %t77{tsNN ( Gf79IIKK ^ LLmff== (>^;NPP {dd瓓BB^C_=ߧLL`Mr }hh[[_RGzzE: vTT)N' *oac 385x75i)??ecbuild-3.14.1/doc/static/cmake.css0000664000175000017500000000034515200367620017224 0ustar alastairalastair/* Import the Sphinx theme style. */ @import url("default.css"); /* Wrap sidebar content even within words so that long document names do not escape sidebar borders. */ div.sphinxsidebarwrapper { word-wrap: break-word; } ecbuild-3.14.1/doc/static/ecbuild-logo-16.png0000664000175000017500000005171315200367620020736 0ustar alastairalastairPNG  IHDR>aSIDATx^}$UB9l9r,SQ@ (*JPJ .y<;sPUSݷ:(S};;1[eY]R o?J"evP^+n-vAUUH!aq3CH0jivb ^ $=n}]uu|G݃˥AӰ'צi0,"&s p1(H=,l"K$]!:uR]]0sRm$E25x|'2MZ3g b`01N 냴~S$ DSC 2zډZ/zϯ_xqEy TM*D9aG<xrzSX28G--X|^躊Dts f ]GQT:jNHe/q'CT\\L\<4`CGbBs|+&,ɾý0& c|͌6@ҽ;ho_zxo ꣟Μ#f݊sJ04yOC/ڻGEpoH! @C?ƠO f_ p HtsWe ?E?s~%nY>t뢅3=k.~-q~O|̙^`#ReNLX ^g \ ˿כ|?s_r 0cz4Z[̳@-!&[*X 6 0%A(ky"yOY <@K$*'*}lzOqŧ4K%bڢBVA|N|b Tܖ6VZC%;o6#ܿVi}Ekg]?@4nqn" E5"Zra ke_X-z t.;<{#3 3:]gEDNTlY@&.J0VZk~ 2w}\86hd gWSp{w?_O Ħ<r9-g_~3 Nw=pK<ՒB򵃒n FZhe闋=ht0i[UuQ]? gF.v1xo~;Y{]ԥCܰ$ R 6')T&hZ5ߓ07B5`$U3♝M( bwq$I\+ Jb:C1 )PS\š&>~ Z0N7lH75>STZ^^ _B$7}cJu 0(Hi0s(I0'ҀvG)\ZKa[߯Z %w/o~X-H&"ucn*a $m)s(Ⱦ>l>gM5nDkng6-Gmmv 73;`^kBXHbp!}(3t5>=Ww^KpjO9Ϝ1+{YVJ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B.Csy]B[0h$rkG MRQ*]k\%l10cEe:ˈ'H$Y;AR1iD-ˌrGdY ${doc_format_log} # log stdout, pass stderr ${${format}_extra_commands} DEPENDS ${doc_format_last} COMMENT "sphinx-build ${format}: see doc/${doc_format_log}" VERBATIM ) set_property(SOURCE ${doc_format_output} PROPERTY SYMBOLIC 1) list(APPEND doc_format_outputs ${doc_format_output}) set(doc_format_last ${doc_format_output}) endforeach() add_custom_target(documentation ALL DEPENDS ${doc_format_outputs}) ecbuild-3.14.1/doc/templates/0000775000175000017500000000000015200367620016137 5ustar alastairalastairecbuild-3.14.1/doc/templates/layout.html0000664000175000017500000000132615200367620020344 0ustar alastairalastair{% extends "!layout.html" %} {% block rootrellink %}
  • ecBuild
  • ecBuild{{ reldelim1 }}
  • {{ shorttitle|e }}{{ reldelim1 }}
  • {% endblock %} {# Put some context in the html title element. Workaround for #} {# https://bitbucket.org/birkenfeld/sphinx/issue/1492/qthelp-generate-html-title-element-should #} {% block htmltitle %} {{ title|striptags|e }} {{ "—"|safe }} {{ docstitle|e }} {% endblock %} ecbuild-3.14.1/ecbuild_3.4_release_notes.rst0000664000175000017500000003317215200367620021037 0ustar alastairalastair========================= ecBuild 3.4 Release Notes ========================= Main changes ============ Minimal CMake version --------------------- The minimal CMake version required is 3.11, from ecBuild 3.4. However, we strongly encourage using the latest version. A good compromise is to aim for a minimum of **CMake 3.12** Including ecbuild ----------------- There is now a more modern way to include the ecbuild macros, which is more inline with modern CMake 3. This uses a standard find_package and avoids all the explicit initialising of ecbuild. You will only need to call the project macro and it will take care of the ecbuild init. In case you intend to distribute your package inside a tarball using ``make package_source``, you will need to update ``CMAKE_MODULE_PATH`` before calling ``find_package(ecbuild)``. Example:: cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild ) # Before project() !!! project( eckit LANGUAGES CXX ) Project version --------------- CMake 3.0 (via policy `CMP0048 `_) requires a project version to be provided to the ``project`` command. Therefore, the use of ``VERSION.cmake`` files is not supported anymore. You have 2 options: * Recommended: if you use the above way to initialise ecbuild, then you just need a VERSION file with the version string inside, eg: ``1.4.5-rc2`` * You can provide the VERSION in the project function call, as in standard CMake. This however does not support adding *suffixes* to the version (eg -rc2) and is limited up to 4 version numbers. Backwards compatibility ----------------------- From ecBuild 3.4, backwards compatibility wil be disabled by default. If you want to build a project that requires backwards compatibility, you need to pass ``-DECBUILD_2_COMPAT=ON`` on the CMake / ecBuild command line. Library dependencies -------------------- Modern CMake relies on properties to provide information about libraries (include directories, preprocessor definitions, dependencies...), and most of those properties can have specific visibility: * ``PRIVATE``: the property is visible only when building the library (build requirement) * ``INTERFACE``: the property is visible only in targets depending on the library (usage requirement) * ``PUBLIC``: same as using both ``PRIVATE`` and ``INTERFACE`` For convenience, ``ecbuild_add_library`` now supports the following arguments: * ``PRIVATE_LIBS``, ``PUBLIC_LIBS``: the library depends on those libraries (see *Public (interface) vs. private dependencies* if you are not sure which one to use), ``PUBLIC`` means that further dependencies will need to have those available as well (see *Transitive public dependencies*) * ``PRIVATE_INCLUDES``: those include directories are needed to build the library (note that you do not need those that come with a library target that declares them as ``INTERFACE`` or ``PUBLIC``) * ``PUBLIC_INCLUDES``: those include directories are needed to use the library * ``PRIVATE_DEFINITIONS``: those ``#define`` are needed to build the library * ``PUBLIC_DEFINITIONS``: those ``#define`` are needed to use the library As a consequence, the ``LIBS``, ``INCLUDES``, and ``DEFINITIONS`` keywords should not be used anymore. ecbuild_use_package  -------------------- The ``ecbuild_use_package`` macro should not be used anymore. It had two distinct use cases: * Include a package as a sub-project: use ``add_subdirectory`` instead * Look for a package: use ``ecbuild_find_package`` or ``find_package`` instead (see also *ecbuild_find_package vs. find_package*) For example:: # change this ... ecbuild_use_package( PROJECT eckit VERSION 1.9 REQUIRED ) # ... to this: ecbuild_find_package( NAME eckit VERSION 1.9 REQUIRED ) Feature Variable names ---------------------- Feature names are now always with the original package name (not capitals). So you may need to adapt the code as in this example:: ecbuild_find_package( NAME metkit VERSION 1.4 REQUIRED ) # OLD code, note the capitals if( NOT METKIT_HAVE_GRIB ) ... # NEW code if( NOT metkit_HAVE_GRIB ) ... **Note:** that this may imply changes in the generated header files ``package_config.h.in`` Version Variables ----------------- Variables that have the package in the name, e.g. ``_VERSION`` are now with the exact capitalisation as in the project name (no longer FULLCAPS), similar to the feature variables mentioned above. They also follow the CMake 3 convention for version variables with ``_VERSION_MAJOR`` instead of ``_MAJOR_VERSION`` So code and generated files need to be adapted.  For example, in the ``package_version.h``:: # change this ... #define ECKIT_MAJOR_VERSION @ECKIT_MAJOR_VERSION@ #define ECKIT_MINOR_VERSION @ECKIT_MINOR_VERSION@ #define ECKIT_PATCH_VERSION @ECKIT_PATCH_VERSION@ # ... to this: #define eckit_VERSION_MAJOR @eckit_VERSION_MAJOR@ #define eckit_VERSION_MINOR @eckit_VERSION_MINOR@ #define eckit_VERSION_PATCH @eckit_VERSION_PATCH@ get_target_property LOCATION ---------------------------- In previous versions, we still allowed an old CMake policy of using target LOCATION. This is now deprecated and highly discouraged in new CMake 3 code. You will need to change the code, especially in tests where you use targets just built to use ``$``:: # BEFORE get_target_property( odc_bin odc LOCATION ) ecbuild_add_test( NAME odc_test_foo COMMAND ${odc_bin} ... ) # AFTER simply call ecbuild_add_test( NAME odc_test_foo COMMAND $ ... ) # OR better, if the command is the result of add_executable or ecbuild_add_executable: ecbuild_add_test( NAME odc_test_foo COMMAND odc ... ) **Note:** If you use target properties in generated scripts (eg for testing), you will need to both ``configure_file()`` and then take that and use ``file(GENERATE...)`` to obtain the ``$`` expansions in the script.  There is a very convenient ``ecbuild_configure_file()`` that does exactly that.:: ecbuild_configure_file(mir-test.sh.in mir-test.sh @ONLY) # where mir-test.sh.in contains $ where needed Options and required packages ----------------------------- Options can be declared with specific package requirements, in order to replace boilerplate:: ecbuild_add_option( FEATURE FOOBAR REQUIRED_PACKAGES "NAME foo VERSION 1.3" "NAME bar VERSION 4.2 COMPONENTS FOO" ) Every item specified in ``REQUIRED_PACKAGES`` will be passed to ``ecbuild_find_package`` unchanged, and therefore must be a suitable argument list. There used to be special cases for packages ``MPI``, ``OMP``, ``Python``, and ``LEXYACC``. This is not the case anymore. If you need those special cases, please call the corresponding ``ecbuild_find_`` macro directly and add a ``CONDITION _FOUND`` to ``ecbuild_add_option``. GNU-compliant install directories --------------------------------- The default values for ``INSTALL_{BIN,INCLUDE,LIB}_DIR`` now use the `GNUInstallDirs `_ CMake module to honour the GNU coding standards, in particular on 64-bit platforms the default directory for the libraries is now ``lib64`` instead of ``lib``. Pitfalls ======== Public (interface) vs. private dependencies ------------------------------------------- It may be tempting to declare all library dependencies ``PUBLIC`` to avoid having to make the dependency graph explicit. However, this is not advised (think of the CMake equivalent of a header file that ``#include`` all the needed headers, both your own and the ones from external libraries, and that you would include from every single file). Here are some guidelines to help you choose the appropriate type of dependency for every package. * The dependency is an implementation detail that is not visible outside of the library: ``PRIVATE`` * The dependency is a component of the library, and it makes no sense to use the library without it: ``PUBLIC`` * The dependency is used within the library, but a user of the library should not assume that it will always be the case: ``PRIVATE`` * Any user of the library will have to use the dependency in their code as well (for instance, to create objects that need to be passed to the library API): ``PUBLIC`` * It has been decided that the library will expose the dependency as a convenience: ``PUBLIC`` Declaring public build interfaces --------------------------------- In order to allow building software against dependencies that are in build directories (necessary for developers daily work and for building bundles for operations), **libraries** need to publish their build interface:: ecbuild_add_library( NAME eccodes ... PUBLIC_INCLUDES $ $ ... ) Transitive public dependencies ------------------------------ Suppose package ``packA`` exports a library ``libA``, and package ``packB`` defines the following:: find_package(packA REQUIRED) ecbuild_add_library( NAME libB # ... PUBLIC_LIBS libA ) Any package using ``libB`` from ``packB`` will therefore have to look for ``libA``, and therefore ``packA`` as well. One solution is to require the user to look for both packages:: find_package(packA REQUIRED) find_package(packB REQUIRED) But this is error-prone and inconvenient in case of API changes: How do you know ``packB`` will always require ``packA``. The *recommended approach* is the to use the macro that CMake provides for such cases: `find_dependency `_. To use that macro in conjunction with ecBuild, add the following to a file ``packB-import.cmake.in``:: include(CMakeFindDependencyMacro) find_dependency(packA) # you may want to specify HINTS as well, e.g. @packA_DIR@ # Optional: further variables packB exports for use set(PACKB_LIBRARIES @PACKB_LIBRARIES@) This will make sure that ``find_package(packB)`` fails with an appropriate error message if ``packA`` cannot be found. For example, metkit depends on eckit and optionally on eccodes and odc, when the respective features are enabled, so the file metkit-import.cmake.in looks like:: set( metkit_HAVE_GRIB @metkit_HAVE_GRIB@ ) set( metkit_HAVE_ODB @metkit_HAVE_ODB@ ) include( CMakeFindDependencyMacro ) find_dependency( eckit HINTS ${CMAKE_CURRENT_LIST_DIR}/../eckit @eckit_DIR@ ) if( metkit_HAVE_GRIB ) find_dependency( eccodes HINTS ${CMAKE_CURRENT_LIST_DIR}/../eccodes @eccodes_DIR@ ) endif() if( metkit_HAVE_ODB ) find_dependency( odc HINTS ${CMAKE_CURRENT_LIST_DIR}/../odc @odc_DIR@ ) endif() **Note:** when following this recommended way and assuming we drop the support for ecbuild 2, then you can remove all the _TPLS exports of variables.  ``ecbuild_find_package`` vs. ``find_package`` --------------------------------------------- ``ecbuild_find_package`` is a wrapper around ``find_package`` with some extra functionality to help locating packages. In particular, ``ecbuild_find_package(pkgA)`` will search the following locations, in this order: * ``pkgA_BINARY_DIR``, which is defined if ``pkgA`` is a sub-project * ``CMAKE_MODULE_PATH``, for ``FindpkgA.cmake`` * ``pkgA_DIR``, ``pkgA_ROOT`` (including for CMake < 3.12), ``pkgA_PATH``, ``PKGA_PATH`` in the CMake scope * ``pkgA_ROOT``, ``pkgA_PATH``, ``PKGA_PATH`` in the environment * ``CMAKE_PREFIX_PATH`` in the CMake scope * ``pkgA_DIR``, ``CMAKE_PREFIX_PATH`` in the environment What to put into ``-import.cmake`` ------------------------------------------- If your source tree contains a file named ``-import.cmake`` or ``-import.cmake.in``, it will be installed alongside your package, and included by a call to ``find_package()``. You can use that to specify additional variables, define macros, etc. The following are strongly recommended: * ``find_dependency`` calls for packages that are usage requirements (see *Transitive public dependencies*) The following may be useful: * Extra variables defining paths to resources (note that ``_BASE_DIR`` will point to the project build or install directory, depending on whether the project is included in the current CMake project or already installed on the system) * ``include`` calls for files containing macros or functions (``_CMAKE_DIR`` will point to the appropriate ``lib/cmake`` directory) The following are not recommended, but may be provided as a convenience: * ``_LIBRARIES``: a list of targets to link against in order to use the project. The user should be responsible for linking against the appropriate targets rather than relying on this variable The following are deprecated and should not be provided: * ``_INCLUDE_DIRS``: a list of include directories. Those should be declared as ``PUBLIC_INCLUDES`` when defining your library targets. * ``_FOUND``: this will be set by CMake when ``find_package`` succeeds. :: include( CMakeFindDependencyMacro ) # for find_dependency # package foo is required find_dependency( foo HINTS @foo_DIR@ ) # add hints as needed # package bar is optional, triggered by feature BAR set( example_HAVE_BAR @example_HAVE_BAR@ ) if( example_HAVE_BAR ) find_dependency( bar HINTS @bar_DIR@ ) endif() # additional resources in /share/example set( example_RESOURCES ${example_BASE_DIR}/share/example ) # some CMake macros include( ${example_CMAKE_DIR}/example_macros.cmake ) ecbuild-3.14.1/.cd/0000775000175000017500000000000015200367620014040 5ustar alastairalastairecbuild-3.14.1/.cd/conda/0000775000175000017500000000000015200367620015124 5ustar alastairalastairecbuild-3.14.1/.cd/conda/meta.yaml0000664000175000017500000000213215200367620016734 0ustar alastairalastair{% set name = "ecbuild" %} {% set git_tag = environ.get('GIT_DESCRIBE_TAG', '0.0.0').lstrip('v') %} {% set version = git_tag.replace('-', '') | lower %} package: name: {{ name|lower }} version: {{ version }} source: path: ../.. build: number: 0 skip: true # [win] requirements: build: - cmake - {{ compiler('cxx') }} run: - cmake - {{ compiler('cxx') }} test: commands: - test -f $PREFIX/bin/ecbuild - test -d $PREFIX/share/ecbuild/cmake - $PREFIX/bin/ecbuild --version about: home: https://github.com/ecmwf/ecbuild license: Apache-2.0 license_family: APACHE license_file: LICENSE summary: | A CMake-based build system, consisting of a collection of CMake macros and functions that ease the managing of software build systems. description: | ecBuild is built on top of CMake and consists of a set of macros as well as a wrapper around CMake. doc_url: https://github.com/ecmwf/ecbuild#readme dev_url: https://github.com/ecmwf/ecbuild extra: recipe-maintainers: - simondsmart - marcosbento - wdeconinck - iainrussell ecbuild-3.14.1/.cd/conda/build.sh0000664000175000017500000000045315200367620016561 0ustar alastairalastair#!/usr/bin/env bash set -eux SOURCE_DIR=$(pwd) BUILD_DIR=build ECBUILD_BIN=$SOURCE_DIR/bin/ecbuild test -x $(which $ECBUILD_BIN) rm -rf $BUILD_DIR mkdir $BUILD_DIR cd $BUILD_DIR $ECBUILD_BIN --prefix=$PREFIX --log=DEBUG -- -DINSTALL_LIB_DIR=lib $SOURCE_DIR make test -j $CPU_COUNT make install ecbuild-3.14.1/tools/0000775000175000017500000000000015200367620014534 5ustar alastairalastairecbuild-3.14.1/tools/license.pl0000775000175000017500000001107315200367620016520 0ustar alastairalastair#!/usr/bin/perl # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. use strict; my $LICENSE = <<"EOF"; (C) Copyright 1996- ECMWF. This software is licensed under the terms of the Apache Licence Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. In applying this licence, ECMWF does not waive the privileges and immunities granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. EOF my %COMMENTS = ( java => { start => "/*\n" , end => " */\n\n" , comment => " * " }, xml => { start => "\n\n" , after => "\<\?xml[^<]*\>" }, # xsd => { start => "\n\n" }, # jsp => { start => "\n\n" }, sh => { comment => "# ", end => "\n", after => "^#!/.*\n" }, pl => { comment => "# ", end => "\n", after => "^#!/.*\n" }, pm => { comment => "# ", end => "\n", after => "^#!/.*\n" }, py => { comment => "# ", end => "\n", after => "^#!/.*\n" }, js => { start => "/*\n" , end => " */\n\n" , comment => " * " }, c => { start => "/*\n" , end => " */\n\n" , comment => " * " }, cc => { start => "/*\n" , end => " */\n\n" , comment => " * " }, cpp => { start => "/*\n" , end => " */\n\n" , comment => " * " }, cxx => { start => "/*\n" , end => " */\n\n" , comment => " * " }, h => { start => "/*\n" , end => " */\n\n" , comment => " * " }, hh => { start => "/*\n" , end => " */\n\n" , comment => " * " }, hpp => { start => "/*\n" , end => " */\n\n" , comment => " * " }, l => { start => "/*\n" , end => " */\n\n" , comment => " * " }, 'y' => { start => "/*\n" , end => " */\n\n" , comment => " * " }, 'f' => { comment => "C ", end => "C\n\n" }, # assume f77 'F' => { comment => "C ", end => "C\n\n" }, # assume f77 'for' => { comment => "C ", end => "C\n\n" }, # assume f77 'f77' => { comment => "C ", end => "C\n\n" }, 'f90' => { comment => "! ", end => "!\n\n" }, cmake => { end => "\n", comment => "# " }, css => { start => "/*\n" , end => " */\n\n" , comment => " * " }, sql => { comment => "-- ", end => "\n" }, properties => { comment => "# ", end => "\n" }, def => { comment => "# ", end => "\n" }, ); my %cmdargs = map { $_ => 1 } @ARGV; foreach my $file ( @ARGV ) { next if( $file eq "-u" or $file eq "--update" ); # my $doit=0; my $doit=1; $file =~ /\.(\w+)$/; my $ext = $1; my $c = $COMMENTS{$ext}; unless($c) { print "$file: unsupported extension. File ignored\n"; next; } open(IN,"<$file") or die "$file: $!"; my @text = ; close(IN); if(join("",@text) =~ /icensed under the/gs) { if( exists( $cmdargs{"-u"} ) or exists( $cmdargs{"--update"} ) ) { # lets update the year if needed my $currentyear = (localtime)[5] + 1900; if($doit) { print("$file: updating license year to $currentyear\n"); system("perl -pi -e 's/Copyright ([0-9]{4})-[0-9]{4} ECMWF/Copyright \$1-$currentyear ECMWF/' $file"); } } else { print "$file: License already stated. File ignored\n"; } next; } open(OUT,">$file.tmp") or die "$file.tmp: $!"; if($c->{after}) { my @x; my $re = $c->{after}; loop: while(@text) { if($text[0] =~ m/$re/) { print OUT @x, shift @text; @x = (); last loop; } push @x,shift @text; } @text = (@x,@text); } print OUT $c->{start}; foreach my $line ( split("\n",$LICENSE) ) { print OUT $c->{comment}, $line,"\n"; } print OUT $c->{end}; print OUT @text; close(OUT) or die "$file: $!"; if($doit) { use File::Copy qw(cp); use File::Compare qw(compare_text compare); if(compare_text("$file.tmp",$file)) { print "UPDATING file $file\n"; system("p4 edit $file") unless(-w $file); #s cp($file,"$file.old") or die "cp($file,$file.old): $!"; cp("$file.tmp",$file) or die "cp($file.tmp,$file): $!"; } } else { print "IGNORING file $file\n"; } unlink("$file.tmp"); } ecbuild-3.14.1/tools/git-meld0000775000175000017500000000003015200367620016155 0ustar alastairalastair#!/bin/bash meld $2 $5 ecbuild-3.14.1/tools/git-mproj0000775000175000017500000000230315200367620016370 0ustar alastairalastair#!/bin/bash # # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. # # git-proj: status, branch, checkout # txtbld=$(tput bold) # bold bldblu=${txtbld}$(tput setaf 6) # bold cyan txtrst=$(tput sgr0) # reset dashless=$(basename "$0" | sed -e 's/-/ /') USAGE="$dashless [options...]" SUBDIRECTORY_OK="yes" PATH=$(git --exec-path):$PATH . git-sh-setup require_work_tree_exists # go to top cd_to_toplevel cd .. # check option for number of levels nlevels=$(git config --global --int --get mproj.levels) if [ "$nlevels" != "" ] then nlevels="-maxdepth $nlevels" fi # do it for d in $( find $PWD $nlevels -type d -iname ".git" ) do gdir=$(dirname $d) proj=$(basename $gdir) pushd $gdir > /dev/null branch=$(git symbolic-ref --short HEAD) echo -e "${bldblu}---> $proj ($branch)${txtrst}" git "$@" popd > /dev/null done ecbuild-3.14.1/tools/check_install.sh0000775000175000017500000000340415200367620017677 0ustar alastairalastair#!/bin/bash # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. chksm="md5sum" manifest_file="manifest.txt" install_proc="echo_install" #------------------------------------------------------------------------------ function abspath { if [[ -d "$1" ]] then pushd "$1" >/dev/null pwd popd >/dev/null elif [[ -e $1 ]] then pushd $(dirname $1) >/dev/null echo $(pwd)/$(basename $1) popd >/dev/null else echo "error: path $1 does not exist!" >&2 return 127 fi } function echo_install { echo "$1 -> $2" } #------------------------------------------------------------------------------ if [ -z $2 ] then echo "usage: $0 " exit 1 fi [[ ! -z $3 ]] && install_proc="$3" SRC=$(abspath $1) TGT=$(abspath $2) manifest="$SRC/$manifest_file" #------------------------------------------------------------------------------ [[ ! -f $manifest ]] && echo "error: cannot find manifest.txt in dir $SRC" && exit 1 cd $SRC for f in $(cat $manifest ) do [[ ! -f "$SRC/$f" ]] && echo "error: $SRC/$f does not exist" && exit 1 install="no" if [[ ! -f "$TGT/$f" ]] then install="yes" else srcsum=$( $chksm "$SRC/$f" | cut -d" " -f1 ) tgtsum=$( $chksm "$TGT/$f" | cut -d" " -f1 ) if [ $srcsum != "$tgtsum" ] then install="yes" fi fi if [ $install == "yes" ] then $install_proc $SRC/$f $TGT/$f fi done ecbuild-3.14.1/tools/apply_license.sh0000775000175000017500000000270515200367620017726 0ustar alastairalastair#!/bin/bash # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. if [ -z $1 ] then echo "apply_license.sh" echo "usage: $0 [dir] [dir] ... " echo "dir - directory where to search" exit 1 fi for f in $( find $DIRS $* \( \ -iname "*.java" \ -or -iname "*.xml" \ -or -iname "*.sh" \ -or -iname "*.pl" \ -or -iname "*.pm" \ -or -iname "*.py" \ -or -iname "*.js" \ -or -iname "*.c" \ -or -iname "*.cpp" \ -or -iname "*.cxx" \ -or -iname "*.cc" \ -or -iname "*.h" \ -or -iname "*.hh" \ -or -iname "*.hpp" \ -or -iname "*.l" \ -or -iname "*.y" \ -or -iname "*.f" \ -or -iname "*.F" \ -or -iname "*.for" \ -or -iname "*.f77" \ -or -iname "*.f90" \ -or -iname "*.cmake" \ -or -iname "*.css" \ -or -iname "*.sql" \ -or -iname "*.properties" \ -or -iname "*.def" \ \) -print -follow | grep -v "\.git/" | grep -v "\.svn/" ) do # echo $f license.pl -u $f done #| sed "s/ /\\\ /g" | \ #xargs echo exit ecbuild-3.14.1/tools/CMakeLists.txt0000664000175000017500000000125215200367620017274 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. list( APPEND ecbuild_bin_files ecbuild git-meld git-mproj check_install.sh apply_license.sh license.pl ) add_custom_target( ecbuild_bin SOURCES ${ecbuild_bin_files} ) install( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} ) # install( PROGRAMS ${ecbuild_bin_files} DESTINATION ${INSTALL_BIN_DIR} ) ecbuild-3.14.1/ecbuild.sublime-project0000664000175000017500000000121315200367620020026 0ustar alastairalastair{ "folders": [ { "file_exclude_patterns": [".tags", ".tags_sorted_by_file", ".gemtags","CMakeLists.txt.user*"], "follow_symlinks": true, "path": "." } ], "build_systems": [ { "working_dir": "${project_path}/../../build/ecbuild", "cmd": [ "make" ], "file_regex": "([/\\w\\-\\.]+):(\\d+):(\\d+:)?", "name": "ecbuild" } ], "SublimeLinter": { "linters": { "cpplint": { "filter": "-whitespace/line_length,-whitespace/blank_line,-runtime/references" }, } } } ecbuild-3.14.1/tox.ini0000664000175000017500000000002715200367620014706 0ustar alastairalastair[flake8] ignore = E501 ecbuild-3.14.1/INSTALL.rst0000664000175000017500000000141015200367620015230 0ustar alastairalastair================== Installing ecBuild ================== Bootstrap and install ===================== :: git clone https://github.com/ecmwf/ecbuild cd ecbuild mkdir bootstrap cd bootstrap ../bin/ecbuild --prefix=/path/to/install/ecbuild .. ctest make install Generating documentation ======================== The documentation is generated using Sphinx. Make sure that ``sphinx-build`` can be located using ``PATH`` or ``CMAKE_PREFIX_PATH``. You can either add the ``-DSPHINX_HTML=ON`` option (as well as ``-DCMAKE_PREFIX_PATH=...`` if needed) to the above ``ecbuild`` command, or re-run ecBuild:: cd ecbuild/bootstrap ../bin/ecbuild -DSPHINX_HTML=ON .. make documentation The documentation tree will be available in ``doc/html``. ecbuild-3.14.1/.gitignore0000664000175000017500000000016115200367620015362 0ustar alastairalastair*sublime-workspace CMakeLists.txt.user* *.log *.py[cdo] *.swp *~ doc/contrib doc/find doc/macros build .DS_Store ecbuild-3.14.1/project_summary.cmake0000664000175000017500000000112215200367620017615 0ustar alastairalastairmessage( STATUS "---------------------------------------------------------" ) ecbuild_info( "[Generic]" ) if( PERL_EXECUTABLE ) ecbuild_info( " Perl : [${PERL_EXECUTABLE}] (${PERL_VERSION})" ) endif() if(PYTHONINTERP_FOUND) ecbuild_info( " Python : [${PYTHON_EXECUTABLE}] (${PYTHON_VERSION})" ) endif() if(PYTHONLIBS_FOUND) ecbuild_info( " Python include : [${PYTHON_INCLUDE_DIRS}]" ) ecbuild_info( " libs : [${PYTHON_LIBRARIES}]" ) endif() if( DEFINED FORTRAN_LIBRARIES ) ecbuild_info( "Fortan libs : [${FORTRAN_LIBRARIES}]" ) endif() ecbuild-3.14.1/LICENSE0000664000175000017500000002477715200367620014422 0ustar alastairalastair Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS Copyright 2011- ECMWF Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ecbuild-3.14.1/COPYING0000664000175000017500000002620015200367620014427 0ustar alastairalastair Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2007-2013 European Centre for Medium-Range Weather Forecasts (ECMWF) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ecbuild-3.14.1/.readthedocs.yml0000664000175000017500000000053415200367620016464 0ustar alastairalastair version: 2 # Set the OS, Python version and other tools you might need build: os: ubuntu-22.04 tools: python: "3.12" # Build documentation in the "doc/" directory with Sphinx sphinx: configuration: doc/conf.py # Define the requirements required to build the documentation python: install: - requirements: doc/requirements.txtecbuild-3.14.1/cmake/0000775000175000017500000000000015200367620014454 5ustar alastairalastairecbuild-3.14.1/cmake/ecbuild_enable_fortran.cmake0000664000175000017500000000573515200367620022140 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_enable_fortran # ====================== # # Enable the Fortran language. :: # # ecbuild_enable_fortran( [ MODULE_DIRECTORY ] [ REQUIRED ] ) # # Options # ------- # # MODULE_DIRECTORY : optional, defaults to ``${PROJECT_BINARY_DIR}/module`` # set the CMAKE_Fortran_MODULE_DIRECTORY # # NO_MODULE_DIRECTORY : optional # unset CMAKE_Fortran_MODULE_DIRECTORY # # REQUIRED : optional # fail if no working Fortran compiler was detected # ############################################################################## macro( ecbuild_enable_fortran ) set( options REQUIRED NO_MODULE_DIRECTORY ) set( single_value_args MODULE_DIRECTORY ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_enable_fortran(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT CMAKE_Fortran_COMPILER_LOADED ) enable_language( Fortran ) ecbuild_compiler_flags( Fortran ) endif() if( _PAR_REQUIRED ) if( CMAKE_Fortran_COMPILER_FORCED ) set( CMAKE_Fortran_COMPILER_WORKS 1 ) endif() if( NOT CMAKE_Fortran_COMPILER OR NOT CMAKE_Fortran_COMPILER_WORKS ) ecbuild_critical( "Fortran compiler required by project ${PROJECT_NAME} but does not seem to work" ) endif() endif() if( CMAKE_Fortran_COMPILER_LOADED ) include(CheckFortranFunctionExists) if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE ) include(FortranCInterface) endif() set( EC_HAVE_FORTRAN 1 ) # see issue ECBUILD-298 if( CMAKE_Fortran_COMPILER_ID MATCHES PGI ) unset( CMAKE_Fortran_COMPILE_OPTIONS_PIE ) unset( CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ) endif() endif() if( _PAR_NO_MODULE_DIRECTORY ) unset( CMAKE_Fortran_MODULE_DIRECTORY ) else() if( _PAR_MODULE_DIRECTORY ) set( CMAKE_Fortran_MODULE_DIRECTORY ${_PAR_MODULE_DIRECTORY} ) else() set( CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/module ) endif() file( MAKE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) if( ECBUILD_2_COMPAT ) include_directories( ${CMAKE_Fortran_MODULE_DIRECTORY} ) endif() # We should also not auto-install. Every project is already doing this anyway # install( CODE "EXECUTE_PROCESS (COMMAND \"${CMAKE_COMMAND}\" -E copy_directory \"${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}\" \"${INSTALL_INCLUDE_DIR}\")" ) endif() endmacro( ecbuild_enable_fortran ) ecbuild-3.14.1/cmake/ecbuild_add_c_flags.cmake0000664000175000017500000000265415200367620021362 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_add_c_flags # =================== # # Add C compiler flags to CMAKE_C_FLAGS only if supported by the compiler. :: # # ecbuild_add_c_flags( [ ... ] # [ BUILD ] # [ NAME ] # [ NO_FAIL ] ) # # Options # ------- # # BUILD : optional # add flags to ``CMAKE_C_FLAGS_`` instead of ``CMAKE_C_FLAGS`` # # NAME : optional # name of the check (if omitted, checks are enumerated) # # NO_FAIL : optional # do not fail if the flag cannot be added # ############################################################################## include(ecbuild_add_lang_flags) macro( ecbuild_add_c_flags ) ecbuild_debug("call ecbuild_add_c_flags( ${ARGV} )") ecbuild_add_lang_flags( FLAGS ${ARGV} LANG C ) endmacro() macro( cmake_add_c_flags ) ecbuild_deprecate( " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." ) ecbuild_add_c_flags( ${ARGV} ) endmacro() ecbuild-3.14.1/cmake/VERSION0000664000175000017500000000000715200367620015521 0ustar alastairalastair3.14.1 ecbuild-3.14.1/cmake/ecbuild_get_date.cmake0000664000175000017500000000332715200367620020726 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_get_date # ================ # # Set the CMake variable ``${DATE}`` to the current date in the form # YYYY.mm.DD. :: # # ecbuild_get_date( DATE ) # ############################################################################## macro(ecbuild_get_date RESULT) if(UNIX) execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT}) string(REGEX REPLACE "(..)/(..)/(....).*" "\\3.\\2.\\1" ${RESULT} ${${RESULT}}) else() ecbuild_error("date not implemented") endif() endmacro(ecbuild_get_date) ############################################################################## #.rst: # # ecbuild_get_timestamp # ===================== # # Set the CMake variable ``${TIMESTAMP}`` to the current date and time in the # form YYYYmmDDHHMMSS. :: # # ecbuild_get_timestamp( TIMESTAMP ) # ############################################################################## macro(ecbuild_get_timestamp RESULT) if(UNIX) execute_process(COMMAND "date" "+%Y/%m/%d/%H/%M/%S" OUTPUT_VARIABLE _timestamp) string(REGEX REPLACE "(....)/(..)/(..)/(..)/(..)/(..).*" "\\1\\2\\3\\4\\5\\6" ${RESULT} ${_timestamp}) else() ecbuild_warn("This is NOT UNIX - timestamp not implemented") endif() endmacro(ecbuild_get_timestamp) ecbuild-3.14.1/cmake/project-config.cmake.in0000664000175000017500000000615615200367620021004 0ustar alastairalastair# Config file for the @PROJECT_NAME@ package # Defines the following variables: # # @PROJECT_NAME@_FEATURES - list of enabled features # @PROJECT_NAME@_VERSION - version of the package # @PROJECT_NAME@_GIT_SHA1 - Git revision of the package # @PROJECT_NAME@_GIT_SHA1_SHORT - short Git revision of the package # @PACKAGE_INIT@ ### computed paths set_and_check(@PROJECT_NAME@_CMAKE_DIR "@PACKAGE_CMAKE_DIR@") set_and_check(@PROJECT_NAME@_BASE_DIR "@PACKAGE_BASE_DIR@") if(DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT) set(@PNAME@_CMAKE_DIR ${@PROJECT_NAME@_CMAKE_DIR}) set(@PNAME@_BASE_DIR ${@PROJECT_NAME@_BASE_DIR}) endif() ### export version info set(@PROJECT_NAME@_VERSION "@PACKAGE_VERSION@") set(@PROJECT_NAME@_GIT_SHA1 "@PACKAGE_GIT_SHA1@") set(@PROJECT_NAME@_GIT_SHA1_SHORT "@PACKAGE_GIT_SHA1_SHORT@") if(DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT) set(@PNAME@_VERSION "@PACKAGE_VERSION@" ) set(@PNAME@_GIT_SHA1 "@PACKAGE_GIT_SHA1@" ) set(@PNAME@_GIT_SHA1_SHORT "@PACKAGE_GIT_SHA1_SHORT@" ) endif() ### has this configuration been exported from a build tree? set(@PROJECT_NAME@_IS_BUILD_DIR_EXPORT @_is_build_dir_export@) if(DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT) set(@PNAME@_IS_BUILD_DIR_EXPORT ${@PROJECT_NAME@_IS_BUILD_DIR_EXPORT}) endif() ### include the -import.cmake file if there is one if(EXISTS ${@PROJECT_NAME@_CMAKE_DIR}/@CONF_IMPORT_FILE@) set(@PROJECT_NAME@_IMPORT_FILE "${@PROJECT_NAME@_CMAKE_DIR}/@CONF_IMPORT_FILE@") include(${@PROJECT_NAME@_IMPORT_FILE}) endif() ### insert definitions for IMPORTED targets if(NOT @PROJECT_NAME@_BINARY_DIR) find_file(@PROJECT_NAME@_TARGETS_FILE NAMES @PROJECT_NAME@-targets.cmake HINTS @PACKAGE_TARGETS_DIRS@ NO_DEFAULT_PATH) if(@PROJECT_NAME@_TARGETS_FILE) include(${@PROJECT_NAME@_TARGETS_FILE}) endif() endif() ### include the -post-import.cmake file if there is one if(EXISTS ${@PROJECT_NAME@_CMAKE_DIR}/@CONF_POST_IMPORT_FILE@) set(@PROJECT_NAME@_POST_IMPORT_FILE "${@PROJECT_NAME@_CMAKE_DIR}/@CONF_POST_IMPORT_FILE@") include(${@PROJECT_NAME@_POST_IMPORT_FILE}) endif() ### handle third-party dependencies if(DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT) set(@PNAME@_LIBRARIES "@CONF_LIBRARIES@") set(@PNAME@_TPLS "@CONF_TPLS@" ) include(${CMAKE_CURRENT_LIST_FILE}.tpls OPTIONAL) endif() ### publish this file as imported if( DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT ) set(@PROJECT_NAME@_IMPORT_FILE ${CMAKE_CURRENT_LIST_FILE}) mark_as_advanced(@PROJECT_NAME@_IMPORT_FILE) set(@PNAME@_IMPORT_FILE ${CMAKE_CURRENT_LIST_FILE}) mark_as_advanced(@PNAME@_IMPORT_FILE) endif() ### export features and check requirements set(@PROJECT_NAME@_FEATURES "@CONF_FEATURES@") if(DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT) set(@PNAME@_FEATURES ${@PROJECT_NAME@_FEATURES}) endif() foreach(_f ${@PROJECT_NAME@_FEATURES}) set(@PROJECT_NAME@_${_f}_FOUND 1) set(@PROJECT_NAME@_HAVE_${_f} 1) if(DEFINED ECBUILD_2_COMPAT AND ECBUILD_2_COMPAT) set(@PNAME@_HAVE_${_f} 1) endif() endforeach() check_required_components(@PROJECT_NAME@) ecbuild-3.14.1/cmake/compat/0000775000175000017500000000000015200367620015737 5ustar alastairalastairecbuild-3.14.1/cmake/compat/README.rst0000664000175000017500000000072015200367620017425 0ustar alastairalastair============================= ecbuild 2 compatibility layer ============================= The files in this directory here emulate the behaviour of ecbuild 2.x in order to ensure smooth transition to ecbuild 3. As such, they are deprecated by definition. The compatibility layer is enabled by default. To disable it, set the ``ECBUILD_2_COMPAT`` option to ``OFF``. To output deprecation warnings instead, set the ``ECBUILD_2_COMPAT_DEPRECATE`` option to ``ON``. ecbuild-3.14.1/cmake/compat/ecbuild_compat.cmake0000664000175000017500000000444315200367620021720 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. #################################################################################################### # include our cmake macros, but only do so if this is the top project if(ECBUILD_2_COMPAT AND NOT ECBUILD_SYSTEM_INITIALISED ) if(ECBUILD_2_COMPAT_DEPRECATE) ecbuild_deprecate("The ecbuild 2 compatibility layer is deprecated. " "Please upgrade the build system and unset `ECBUILD_2_COMPAT`.") endif() function( __ecbuild_deprecated_watcher VAR ACCESS) if( ACCESS STREQUAL "READ_ACCESS" AND NOT DISABLE_ECBUILD_DEPRECATION_WARNINGS ) message(DEPRECATION "The Variable '${VAR}' is deprecated! Please use '${ECBUILD_${VAR}_REPLACEMENT}' instead.") endif() endfunction() function(ecbuild_mark_compat OLD_VAR NEW_VAR) if(ECBUILD_2_COMPAT_DEPRECATE) if(NOT OLD_VAR STREQUAL NEW_VAR) set(ECBUILD_${OLD_VAR}_REPLACEMENT "${NEW_VAR}" CACHE INTERNAL "${OLD_VAR} is deprecated and was replaced by ${NEW_VAR}" FORCE) variable_watch(${OLD_VAR} __ecbuild_deprecated_watcher) endif() endif() endfunction() # use macro to acces value of NEW_VAR macro(ecbuild_declare_compat OLD_VAR NEW_VAR) cmake_parse_arguments(_p "PARENT_SCOPE" "" "" ${ARGN}) if(_p_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_declare_compat(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() if(ECBUILD_2_COMPAT_DEPRECATE) ecbuild_mark_compat(${OLD_VAR} ${NEW_VAR}) endif() if(_p_PARENT_SCOPE) set(${OLD_VAR} ${${NEW_VAR}} PARENT_SCOPE) else() set(${OLD_VAR} ${${NEW_VAR}}) endif() endmacro() include(ecbuild_compat_require) include(ecbuild_compat_setversion) include(ecbuild_compat_tplconfig) include(ecbuild_add_cxx11_flags) include(ecbuild_add_extra_search_paths) include(ecbuild_list_extra_search_paths) include(ecbuild_generate_rpc) include(ecbuild_use_package) include(ecmwf_git) include(ecbuild_check_cxx11) endif() ecbuild-3.14.1/cmake/compat/ecbuild_generate_rpc.cmake0000664000175000017500000000752015200367620023072 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_generate_rpc # ==================== # # Process RPC (Remote Procedure Call) Language files using rpcgen. :: # # ecbuild_generate_rpc( SOURCE # [ TARGET_H ] # [ TARGET_C ] # [ DEPENDANT [ ... ] ] ) # # DEPRECATED. # # Options # ------- # # SOURCE : required # RPC source file # # TARGET_H : optional (required if TARGET_C not given) # name of header file to be generated # # TARGET_C : optional (required if TARGET_H not given) # name of source file to be generated # # DEPENDANT : optional # list of files which depend on the generated source and header files # ############################################################################## macro( ecbuild_generate_rpc ) if( ECBUILD_2_COMPAT_DEPRECATE ) ecbuild_deprecate("ecbuild_generate_rpc is deprecated and will be " "removed in a future version.") endif() set( options ) set( single_value_args SOURCE TARGET_H TARGET_C ) set( multi_value_args DEPENDANT ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_generate_rpc(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_SOURCE ) ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the SOURCE file.") endif() # optional # if( NOT _PAR_DEPENDANT ) # ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the DEPENDANT files.") # endif() if( NOT DEFINED _PAR_TARGET_H AND NOT DEFINED _PAR_TARGET_C ) ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the _PAR_TARGET_H or _PAR_TARGET_C files.") endif() if( DEFINED RPCGEN_PATH ) find_program( RPCGEN_EXECUTABLE NAMES rpcgen PATHS ${RPCGEN_PATH} PATH_SUFFIXES bin NO_DEFAULT_PATH ) endif() find_program( RPCGEN_EXECUTABLE NAMES rpcgen ) if( NOT RPCGEN_EXECUTABLE ) ecbuild_critical("Could not find rpcgen. Please provide RPCGEN_PATH.") endif() if( DEFINED _PAR_TARGET_H ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_H} COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_H} COMMAND ${RPCGEN_EXECUTABLE} -h -o ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_H} ${_PAR_SOURCE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_SOURCE} ) if( DEFINED _PAR_DEPENDANT ) foreach( file ${_PAR_DEPENDANT} ) set_source_files_properties( ${file} PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_H}" ) endforeach() endif() endif() if( DEFINED _PAR_TARGET_C ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_C} COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_C} COMMAND ${RPCGEN_EXECUTABLE} -c -o ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_C} ${_PAR_SOURCE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_SOURCE} ) if( DEFINED _PAR_DEPENDANT ) foreach( file ${_PAR_DEPENDANT} ) set_source_files_properties( ${file} PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_PAR_TARGET_C}" ) endforeach() endif() endif() endmacro( ecbuild_generate_rpc ) ecbuild-3.14.1/cmake/compat/ecbuild_add_extra_search_paths.cmake0000664000175000017500000000246615200367620025117 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################### # # macro for adding search paths to CMAKE_PREFIX_PATH # for example the ECMWF /usr/local/apps paths # # usage: ecbuild_add_extra_search_paths( netcdf4 ) function( ecbuild_add_extra_search_paths pkg ) ecbuild_deprecate( " ecbuild_add_extra_search_paths modifies CMAKE_PREFIX_PATH," " which can affect future package discovery if not undone by the caller." " The current CMAKE_PREFIX_PATH is being backed up as _CMAKE_PREFIX_PATH" " so it can later be restored." ) # Back up current CMAKE_PREFIX_PATH so the caller can reset it set( _CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE ) string( TOUPPER ${pkg} _PKG ) ecbuild_list_extra_search_paths( ${pkg} CMAKE_PREFIX_PATH ) set( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE ) # ecbuild_debug_var( CMAKE_PREFIX_PATH ) endfunction() ecbuild-3.14.1/cmake/compat/ecbuild_compat_tplconfig.cmake0000664000175000017500000000672715200367620023774 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_compat_tplconfig # ====================== # # Generate a config file to import the third-party libraries (TPL) automatically :: # # ecbuild_compat_tplconfig( # TPLS tpl1 tpl2 ...) # # Options # ------- # : required # name of the output file # # TPLS : optional # list of third-party dependencies # # Usage # ----- # # This function is intended for use in ecbuild_install_project only. Do NOT use # it in new code. function(ecbuild_compat_tplconfig cfile) set(options) set(single_value_args) set(multi_value_args TPLS) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_compat_tplconfig(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if(_PAR_TPLS) file(REMOVE ${cfile}.in) file(APPEND "${cfile}.in" "include(CMakeFindDependencyMacro)\n") foreach(_tpl ${_PAR_TPLS}) string(TOUPPER ${_tpl} TPL) if(${TPL}_IMPORT_FILE) # ecBuild packages should trigger this if they export themselves ecbuild_debug("Adding find_dependency call for TPL ${_tpl} to ${cfile}.in") get_filename_component(__import_dir "${${TPL}_IMPORT_FILE}" DIRECTORY) file(RELATIVE_PATH __import_dir_rel "${${PROJECT_NAME}_FULL_INSTALL_CMAKE_DIR}" "${__import_dir}") set(__import_dir_rel "\${CMAKE_CURRENT_LIST_DIR}/${__import_dir_rel}") file(APPEND "${cfile}.in" "if(NOT ${TPL}_IMPORT_FILE)\n") file(APPEND "${cfile}.in" " find_dependency(${_tpl} REQUIRED HINTS \"${__import_dir_rel}\" \"${__import_dir}\")\n") file(APPEND "${cfile}.in" "endif()\n") elseif(${_tpl}_CONFIG) # cmake built packages (e.g. CGAL) may have exported their targets ecbuild_debug("Adding TPL ${_tpl} import file to ${cfile}.in") set(__import_file "${${_tpl}_CONFIG}") get_filename_component(__import_dir "${__import_file}" DIRECTORY) file(APPEND "${cfile}.in" "if(NOT ${_tpl}_CONFIG)\n") file(APPEND "${cfile}.in" " find_dependency(${_tpl} REQUIRED HINTS \"${__import_dir}\")\n") file(APPEND "${cfile}.in" " set(${_tpl}_CONFIG \"${__import_file}\")\n") file(APPEND "${cfile}.in" "endif()\n") elseif(${_tpl}_FULL_INSTALL_CMAKE_DIR) # This variable is only available for a ecbuild exported TPL in a bundle. It is therefore safe to use # relative install paths between this project and the TPL ecbuild_debug("Adding find_dependency call for TPL ${_tpl} to ${cfile}.in") file(RELATIVE_PATH __import_dir "${${PROJECT_NAME}_FULL_INSTALL_CMAKE_DIR}" "${${_tpl}_FULL_INSTALL_CMAKE_DIR}") set(__import_dir "\${CMAKE_CURRENT_LIST_DIR}/${__import_dir}") file(APPEND "${cfile}.in" "find_dependency(${_tpl} REQUIRED HINTS \"${__import_dir}\")\n") endif() endforeach() configure_file("${cfile}.in" "${cfile}" @ONLY) install(FILES "${cfile}" DESTINATION "${INSTALL_CMAKE_DIR}") endif() endfunction() ecbuild-3.14.1/cmake/compat/ecmwf_git.cmake0000664000175000017500000000400715200367620020706 0ustar alastairalastair set( ECMWF_USER $ENV{USER} CACHE STRING "ECMWF git user" ) set( ECMWF_GIT SSH CACHE STRING "ECMWF git protocol" ) set( ECMWF_GIT_SSH "ssh://git@git.ecmwf.int" CACHE INTERNAL "ECMWF ssh address" ) set( ECMWF_GIT_HTTPS "https://${ECMWF_USER}@git.ecmwf.int/scm" CACHE INTERNAL "ECMWF https address" ) if( ECMWF_GIT MATCHES "[Ss][Ss][Hh]" ) set( ECMWF_GIT_ADDRESS ${ECMWF_GIT_SSH} CACHE INTERNAL "" ) else() set( ECMWF_GIT_ADDRESS ${ECMWF_GIT_HTTPS} CACHE INTERNAL "" ) endif() ############################################################################## #.rst: # # ecmwf_stash # ============= # # Manages an external Git repository on ECMWF Stash. :: # # ecmwf_stash( PROJECT # DIR # STASH # [ BRANCH | TAG ] # [ UPDATE | NOREMOTE ] ) # [ MANUAL ] ) # # Options # ------- # # PROJECT : required # project name for the Git repository to be managed # # DIR : required # directory to clone the repository into (can be relative) # # STASH : required # Stash repository in the form / # # BRANCH : optional, cannot be combined with TAG # Git branch to check out # # TAG : optional, cannot be combined with BRANCH # Git tag or commit id to check out # # UPDATE : optional, requires BRANCH, cannot be combined with NOREMOTE # Create a CMake target update to fetch changes from the remote repository # # NOREMOTE : optional, cannot be combined with UPDATE # Do not fetch changes from the remote repository # # MANUAL : optional # Do not automatically switch branches or tags # ############################################################################## macro( ecmwf_stash ) set( options ) set( single_value_args STASH ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) ecbuild_git( URL "${ECMWF_GIT_ADDRESS}/${_PAR_STASH}.git" ${_PAR_UNPARSED_ARGUMENTS} ) endmacro() ecbuild-3.14.1/cmake/compat/FindNAG.cmake0000664000175000017500000000302415200367620020146 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. # - Try to find the NAG includes and library # This module defines # # NAG_FOUND - System has NAG # NAG_INCLUDE_DIRS - the NAG include directories # NAG_LIBRARIES - the libraries needed to use NAG # # The following paths will be searched with priority if set in CMake or env # # NAG_DIR - root folder of the NAG installation # NAG_PATH - root folder of the NAG installation find_path( NAG_INCLUDE_DIR nag_precisions.mod PATHS ${NAG_PATH} ENV NAG_PATH ${NAG_DIR} ENV NAG_DIR PATH_SUFFIXES include NO_DEFAULT_PATH ) find_library( NAG_LIBRARY NAMES nag PATHS ${NAG_PATH} ENV NAG_PATH ${NAG_DIR} ENV NAG_DIR PATH_SUFFIXES lib lib64 NO_DEFAULT_PATH ) set( NAG_LIBRARIES ${NAG_LIBRARY} ) set( NAG_INCLUDE_DIRS ${NAG_INCLUDE_DIR} ) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set NAG_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args( NAG DEFAULT_MSG NAG_LIBRARY NAG_INCLUDE_DIR ) mark_as_advanced( NAG_INCLUDE_DIR NAG_LIBRARY ) ecbuild-3.14.1/cmake/compat/netcdf_compat.cmake0000664000175000017500000000626515200367620021560 0ustar alastairalastair# (C) Copyright 2020- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. # Extra exports for FindNetCDF.cmake for backwards compatibility # # This module defines # # - NetCDF_INCLUDE_DIRS - the NetCDF include directories # - NetCDF_LIBRARIES - the libraries needed to use NetCDF # # For each component the following are defined: # # - NetCDF__LIBRARIES - the libraries for the component # - NetCDF__INCLUDE_DIRS - the include directories for specfied component # # Notes: # # - Capitalisation of COMPONENT arguments does not matter: The part of variables will be defined with # * capitalisation as defined above # * Uppercase capitalisation # * capitalisation as used in find_package() arguments # - Each variable is also available in fully uppercased version # - In each variable (not in targets), the "NetCDF" prefix may be interchanged with # * NetCDF4 # * NETCDF # * NETCDF4 # * The part "" in current filename Find.cmake set(__args) foreach( _comp ${_search_components} ) string( TOUPPER "${_comp}" _COMP ) list(APPEND __args ${_arg_${_COMP}} ) endforeach() foreach( _comp ${_search_components} ) if( NetCDF_${_comp}_FOUND ) list( APPEND NetCDF_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR} ) list( APPEND NetCDF_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR} ) list( APPEND NetCDF_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) if( DEFINED NetCDF_${_comp}_EXTRA_LIBRARIES ) list( APPEND NetCDF_${_comp}_LIBRARIES ${NetCDF_${_comp}_EXTRA_LIBRARIES}) endif() list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) endif() endforeach() if( NetCDF_INCLUDE_DIRS ) list( REMOVE_DUPLICATES NetCDF_INCLUDE_DIRS ) endif() foreach( _prefix NetCDF NetCDF4 NETCDF NETCDF4 ${CMAKE_FIND_PACKAGE_NAME} ) set( ${_prefix}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) set( ${_prefix}_LIBRARIES ${NetCDF_LIBRARIES}) set( ${_prefix}_VERSION ${NetCDF_VERSION} ) set( ${_prefix}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_FOUND} ) foreach( _comp ${_search_components} ) string( TOUPPER "${_comp}" _COMP ) set( _arg_comp ${_arg_${_COMP}} ) set( ${_prefix}_${_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) set( ${_prefix}_${_COMP}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) set( ${_prefix}_${_arg_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) set( ${_prefix}_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) set( ${_prefix}_${_COMP}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) set( ${_prefix}_${_arg_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) set( ${_prefix}_${_comp}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) set( ${_prefix}_${_COMP}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) set( ${_prefix}_${_arg_comp}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) endforeach() endforeach() ecbuild-3.14.1/cmake/compat/ecbuild_compat_setversion.cmake0000664000175000017500000000272315200367620024200 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_compat_setversion # ====================== # # Read a VERSION.cmake file and set the project variables. # # ecbuild_compat_setversion() # # Output variables # ---------------- # # * _VERSION_MAJOR # * _VERSION_MINOR # * _VERSION_PATCH # * _VERSION_TWEAK # * _VERSION # * _VERSION_STR # * _VERSION_SUFFIX # ############################################################################## macro(ecbuild_compat_setversion) # read and parse project version file if( EXISTS ${PROJECT_SOURCE_DIR}/VERSION.cmake ) include( ${PROJECT_SOURCE_DIR}/VERSION.cmake ) set( __version ${${PROJECT_NAME}_VERSION_STR} ) else() set( __version "0.0.0" ) endif() ecbuild_parse_version("${__version}" PREFIX ${PROJECT_NAME}) set( ${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "package ${PROJECT_NAME} version" ) set( ${PROJECT_NAME}_VERSION_STR "${${PROJECT_NAME}_VERSION}" CACHE INTERNAL "package ${PROJECT_NAME} version" ) endmacro() ecbuild-3.14.1/cmake/compat/ecbuild_compat_require.cmake0000664000175000017500000001445215200367620023455 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_compat_require # ====================== # # Emulate the behaviour of the REQUIRED_PACKAGES option of ecbuild_add_option :: # # ecbuild_compat_require( # [FEATURE ] # [DESCRIPTION ]) # # Options # ------- # : required # variable to retrieve the name of the package # # : required # string describing the package to be imported # # FEATURE : optional # name of the feature / option requiring the package # # DESCRIPTION : optional # string describing the feature (used if the package has none) # # Usage # ----- # # This function is primarily for use in ecbuild_add_option. Do NOT use it in # new code. The specification should be a string containing valid # arguments to either ecbuild_use_package or find_package. # # Output variables # ---------------- # # * will be set to the required package name , # * _FOUND will be set if the package has been found, # * _HELP_MSG will contain some help if the package has not been found. # ############################################################################## macro(ecbuild_compat_require out_name pkg) set(options NO_TPL) set(single_value_args FEATURE DESCRIPTION) cmake_parse_arguments(_p "${options}" "${single_value_args}" "" ${ARGN}) if( _p_UNPARSED_ARGUMENTS ) ecbuild_critical("Unknown keywords given to ecbuild_compat_require(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() string(REPLACE " " ";" pkglist ${pkg}) # string to list list(GET pkglist 0 pkgname) if(pkgname STREQUAL "PROJECT") # if 1st entry is PROJECT, then we are looking for an ecbuild project set(pkgproject 1) list(GET pkglist 1 pkgname) list(FIND pkglist DESCRIPTION __description) if( __description LESS 0 ) ecbuild_debug("ecbuild_compat_require(${pkgname}): no package description found, using provided description '${_p_DESCRIPTION}'") list(APPEND pkglist DESCRIPTION "${_p_DESCRIPTION}") endif() elseif( pkgname STREQUAL "NAME" ) list(GET pkglist 1 pkgname) else() # else 1st entry is the package name set(pkgproject 0) endif() string(TOUPPER ${pkgname} pkgUPPER) string(TOLOWER ${pkgname} pkgLOWER) # export the package name set(${out_name} ${pkgname}) set(${pkgname}_HELP_MSG "Provide ${pkgname} location with -D${pkgUPPER}_PATH=/...") if(${pkgname}_FOUND OR ${pkgUPPER}_FOUND OR ${pkgLOWER}_FOUND) ecbuild_debug("ecbuild_compat_require(${pkgname}): ${pkgname} has already been found") else() if(pkgproject) ecbuild_debug("ecbuild_compat_require(${pkgname}): calling ecbuild_use_package(${pkglist})") ecbuild_use_package(${pkglist}) else() if(pkgname STREQUAL "LAPACK") ecbuild_debug("ecbuild_compat_require(${pkgname}): searching for LAPACK - ecbuild_find_package(NAME ${pkglist})") ecbuild_find_package(NAME ${pkglist}) if(HAVE_LAPACK AND TARGET lapack) ecbuild_debug("LAPACK found as CMake target lapack") set(LAPACK_LIBRARIES lapack) endif() elseif(pkgname STREQUAL "MPI") set(_find_args ${pkglist}) list(REMOVE_ITEM _find_args "MPI") ecbuild_debug("ecbuild_compat_require(${pkgname}): searching for MPI - ecbuild_find_mpi(${_find_args})") ecbuild_find_mpi(${_find_args}) elseif(pkgname STREQUAL "OMP") set(_find_args ${pkglist}) list(REMOVE_ITEM _find_args "OMP") if(NOT ENABLE_${_p_FEATURE}) list(APPEND _find_args STUBS) endif() ecbuild_debug("ecbuild_compat_require(${pkgname}): searching for OpenMP - ecbuild_find_omp(${_find_args})") ecbuild_find_omp(${_find_args}) elseif(pkgname STREQUAL "Python" OR pkgname STREQUAL "PYTHON") set(_find_args ${pkglist}) list(REMOVE_ITEM _find_args ${pkgname}) ecbuild_debug("ecbuild_compat_require(${pkgname}): searching for Python - ecbuild_find_python(${_find_args})") ecbuild_find_python(${_find_args}) set(${pkgname}_HELP_MSG "Specify the location of the Python interpreter with -DPYTHON_EXECUTABLE=/...") elseif(pkgname STREQUAL "LEXYACC") set(_find_args ${pkglist}) list(REMOVE_ITEM _find_args ${pkgname}) ecbuild_debug("ecbuild_compat_require(${pkgname}): searching for lex-yacc - ecbuild_find_lexyacc(${_find_args})") ecbuild_find_lexyacc(${_find_args}) else() ecbuild_debug("ecbuild_compat_require(${pkgname}): searching for package ${pkgname} - find_package(${pkglist})") list(FIND pkglist "VERSION" _ver_found) if(NOT _ver_found EQUAL -1) # XXX: This is an invalid syntax used in IFS (that gets short-circuited with ecbuild 2.x # because the packages are already found) set(_pkglist_old ${pkglist}) list(REMOVE_ITEM pkglist "VERSION") string(REPLACE ";" " " _pkglist_old "${_pkglist_old}") string(REPLACE ";" " " _pkglist_new "${pkglist}") ecbuild_warn("Removing unexpected VERSION keyword from REQUIRED_PACKAGES: \ either use 'PROJECT ${_pkglist_old}' or '${_pkglist_new}'") endif() list(REMOVE_ITEM pkglist "NAME") find_package(${pkglist}) endif() endif() endif() if(${pkgname}_FOUND OR ${pkgUPPER}_FOUND OR ${pkgLOWER}_FOUND) set(${pkgname}_FOUND 1) # make sure this one is defined for consistency # append to list of third-party libraries (to be forward to other packages ) # unless the NO_TPL option was given if(NOT _p_NO_TPL) string( TOUPPER ${PROJECT_NAME} PROJECT_NAME_CAPS ) ecbuild_debug("ecbuild_compat_require(${pkgname}): appending ${pkgname} to ${PROJECT_NAME_CAPS}_TPLS") list(APPEND ${PROJECT_NAME_CAPS}_TPLS ${pkgname}) list(REMOVE_DUPLICATES ${PROJECT_NAME_CAPS}_TPLS) endif() endif() endmacro() ecbuild-3.14.1/cmake/compat/FindNetCDF3.cmake0000664000175000017500000001066015200367620020673 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. # Try to find NetCDF # # Input: # * NETCDF_PATH - user defined path where to search for the library first # (CMake or environment variable) # * NETCDF_DIR - user defined path where to search for the library first # (CMake or environment variable) # * NETCDF_CXX - search also for netcdf_c++ wrapper library # * NETCDF_Fortran - search also for netcdff wrapper library # # Output: # NETCDF_FOUND - System has NetCDF # NETCDF_INCLUDE_DIRS - The NetCDF include directories # NETCDF_LIBRARIES - The libraries needed to use NetCDF ecbuild_deprecate("The FindNetCDF3.cmake module is deprecated and will be removed from ecbuild") ### TODO: generalize this into a macro for all ecbuild if( DEFINED NETCDF_PATH ) list( APPEND _netcdf_incs ${NETCDF_PATH} ${NETCDF_PATH}/include ) list( APPEND _netcdf_libs ${NETCDF_PATH} ${NETCDF_PATH}/lib ) endif() if( DEFINED NETCDF_DIR ) list( APPEND _netcdf_incs ${NETCDF_DIR} ${NETCDF_DIR}/include ) list( APPEND _netcdf_libs ${NETCDF_DIR} ${NETCDF_DIR}/lib ) endif() # Honour environment variables NETCDF_DIR, NETCDF_PATH list( APPEND _netcdf_incs ENV NETCDF_DIR ENV NETCDF_PATH ) list( APPEND _netcdf_libs ENV NETCDF_DIR ENV NETCDF_PATH ) ### set( _inc_sfx netcdf include ) set( _lib_sfx netcdf lib64 lib ) find_path( NETCDF_INCLUDE_DIR netcdf.h PATHS ${_netcdf_incs} PATH_SUFFIXES ${_inc_sfx} NO_DEFAULT_PATH ) find_path( NETCDF_INCLUDE_DIR netcdf.h PATHS ${_netcdf_incs} PATH_SUFFIXES ${_inc_sfx} ) find_library( NETCDF_LIBRARY netcdf PATHS ${_netcdf_libs} PATH_SUFFIXES ${_lib_sfx} NO_DEFAULT_PATH ) find_library( NETCDF_LIBRARY netcdf PATHS ${_netcdf_libs} PATH_SUFFIXES ${_lib_sfx} ) set( NETCDF_LIBRARIES ${NETCDF_LIBRARY} ) set( NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR} ) mark_as_advanced(NETCDF_INCLUDE_DIR NETCDF_LIBRARY ) list( APPEND NETCDF_REQUIRED_VARS NETCDF_LIBRARY NETCDF_INCLUDE_DIR ) if( NETCDF_CXX ) find_path( NETCDF_CXX_INCLUDE_DIR netcdfcpp.h PATHS ${_netcdf_incs} PATH_SUFFIXES ${_inc_sfx} NO_DEFAULT_PATH) find_path( NETCDF_CXX_INCLUDE_DIR netcdfcpp.h PATHS ${_netcdf_incs} PATH_SUFFIXES ${_inc_sfx} ) set( _ncdf_cxx netcdf_c++ netcdf_c++ netcdf_c++4 ) find_library( NETCDF_CXX_LIBRARY NAMES ${_ncdf_cxx} PATHS ${_netcdf_libs} PATH_SUFFIXES ${_lib_sfx} NO_DEFAULT_PATH ) find_library( NETCDF_CXX_LIBRARY NAMES ${_ncdf_cxx} PATHS ${_netcdf_libs} PATH_SUFFIXES ${_lib_sfx} ) list( APPEND NETCDF_INCLUDE_DIRS ${NETCDF_CXX_INCLUDE_DIR} ) list( APPEND NETCDF_LIBRARIES ${NETCDF_CXX_LIBRARY} ) list( APPEND NETCDF_REQUIRED_VARS NETCDF_CXX_INCLUDE_DIR NETCDF_CXX_LIBRARY ) mark_as_advanced(NETCDF_CXX_INCLUDE_DIR NETCDF_CXX_LIBRARY ) endif() if( NETCDF_Fortran ) find_path( NETCDF_Fortran_INCLUDE_DIR netcdf.mod PATHS ${_netcdf_incs} PATH_SUFFIXES ${_inc_sfx} NO_DEFAULT_PATH) find_path( NETCDF_Fortran_INCLUDE_DIR netcdf.mod PATHS ${_netcdf_incs} PATH_SUFFIXES ${_inc_sfx} ) set( _ncdf_fortran netcdff ) find_library( NETCDF_Fortran_LIBRARY NAMES ${_ncdf_fortran} PATHS ${_netcdf_libs} PATH_SUFFIXES ${_lib_sfx} NO_DEFAULT_PATH ) find_library( NETCDF_Fortran_LIBRARY NAMES ${_ncdf_fortran} PATHS ${_netcdf_libs} PATH_SUFFIXES ${_lib_sfx} ) list( APPEND NETCDF_INCLUDE_DIRS ${NETCDF_Fortran_INCLUDE_DIR} ) list( APPEND NETCDF_LIBRARIES ${NETCDF_Fortran_LIBRARY} ) list( APPEND NETCDF_REQUIRED_VARS NETCDF_Fortran_INCLUDE_DIR NETCDF_Fortran_LIBRARY ) mark_as_advanced(NETCDF_Fortran_INCLUDE_DIR NETCDF_Fortran_LIBRARY ) endif() list( REMOVE_DUPLICATES NETCDF_INCLUDE_DIRS ) include(FindPackageHandleStandardArgs) if( NETCDF_FIND_QUIETLY ) set( NETCDF3_FIND_QUIETLY ${NETCDF_FIND_QUIETLY} ) endif() if( NETCDF_FIND_REQUIRED ) set( NETCDF3_FIND_REQUIRED ${NETCDF_FIND_REQUIRED} ) endif() # Handle the QUIET and REQUIRED arguments and set NETCDF3_FOUND to TRUE # if all listed variables are TRUE # Note: capitalisation of the package name must be the same as in the file name find_package_handle_standard_args( NetCDF3 DEFAULT_MSG ${NETCDF_REQUIRED_VARS} ) set( NETCDF_FOUND ${NETCDF3_FOUND} ) ecbuild-3.14.1/cmake/compat/ecbuild_list_extra_search_paths.cmake0000664000175000017500000000542315200367620025336 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################################ # # macro for adding search paths for a package to a given CMake variable # # usage: ecbuild_list_extra_search_paths( netcdf4 VARIABLE ) function( ecbuild_list_extra_search_paths pkg var ) ecbuild_deprecate( " ecbuild_list_extra_search_paths should no longer be" " used and is going to be removed in a future version of ecBuild." ) # ecbuild_debug_var( pkg ) # ecbuild_debug_var( var ) string( TOUPPER ${pkg} _PKG ) # PKG_PATH (upper case) if( DEFINED ${_PKG}_PATH AND EXISTS ${${_PKG}_PATH} ) ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): appending ${_PKG}_PATH = ${${_PKG}_PATH} to ${var}") list( APPEND ${var} ${${_PKG}_PATH} ) endif() # ENV PKG_PATH (upper case) if( DEFINED ENV{${_PKG}_PATH} AND EXISTS $ENV{${_PKG}_PATH} ) ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): appending \$${_PKG}_PATH = $ENV{${_PKG}_PATH} to ${var}") list( APPEND ${var} $ENV{${_PKG}_PATH} ) endif() # pkg_PATH (lower case) if( DEFINED ${pkg}_PATH AND EXISTS ${${pkg}_PATH} ) ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): appending ${pkg}_PATH = ${${pkg}_PATH} to ${var}") list( APPEND ${var} ${${pkg}_PATH} ) endif() # ENV pkg_PATH (lower case) if( DEFINED ${pkg}_PATH AND EXISTS $ENV{${pkg}_PATH} ) ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): appending \$${pkg}_PATH = $ENV{${pkg}_PATH} to ${var}") list( APPEND ${var} $ENV{${pkg}_PATH} ) endif() # ENV PKG_DIR (upper case) if( DEFINED ENV{${_PKG}_DIR} AND EXISTS $ENV{${_PKG}_DIR} ) ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): appending \$${_PKG}_DIR = $ENV{${_PKG}_DIR} to ${var}") list( APPEND ${var} $ENV{${_PKG}_DIR} ) endif() # ENV pkg_DIR (lower case) if( DEFINED ENV{${pkg}_DIR} AND EXISTS $ENV{${pkg}_DIR} ) ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): appending \$${pkg}_DIR = $ENV{${pkg}_DIR} to ${var}") list( APPEND ${var} $ENV{${pkg}_DIR} ) endif() # sanitize the list if( ${var} ) list( REMOVE_DUPLICATES ${var} ) endif() # define it out of the function ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): setting ${var} to ${${var}}") set( ${var} ${${var}} PARENT_SCOPE ) # ecbuild_debug_var( ${var} ) endfunction() ecbuild-3.14.1/cmake/compat/ecbuild_use_package.cmake0000664000175000017500000003202115200367620022675 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_use_package # =================== # # Add a project from a source directory, a subdirectory or search for it. :: # # ecbuild_use_package( PROJECT # [ VERSION [ EXACT ] ] # [ COMPONENTS [ ... ] ] # [ URL ] # [ DESCRIPTION ] # [ TYPE ] # [ PURPOSE ] # [ FAILURE_MSG ] # [ REQUIRED ] # [ QUIET ] ) # # Options # ------- # # NAME : required # package name (used as ``Find.cmake`` and ``-config.cmake``) # # VERSION : optional # minimum required package version # # COMPONENTS : optional # list of package components to find (behaviour depends on the package) # # EXACT : optional, requires VERSION # require the exact version rather than a minimum version # # URL : optional # homepage of the package (shown in summary and stored in the cache) # # DESCRIPTION : optional # string describing the package (shown in summary and stored in the cache) # # TYPE : optional, one of RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED # type of dependency of the project on this package (defaults to OPTIONAL) # # PURPOSE : optional # string describing which functionality this package enables in the project # # FAILURE_MSG : optional # string to be appended to the failure message if the package is not found # # REQUIRED : optional # fail if package cannot be found # # QUIET : optional # do not output package information if found # # Input variables # --------------- # # The following CMake variables influence the behaviour if set (```` # is the package name as given, ```` is the capitalised version): # # :_SOURCE: path to source directory for package # :SUBPROJECT_DIRS: list of additional paths to search for package source # # See also ``ecbuild_find_package`` for additional CMake variables relevant # when search for the package (step 6 below). # # Usage # ----- # # Use another CMake project as a dependency by either building it from source # i.e. adding its source directory as a subdirectory or searching for it. This # transparently deals with the case where the project has already been included # e.g. because multiple projects with shared dependencies are built together. # # The search proceeds as follows: # # 1. If ``SUBPROJECT_DIRS`` is set, each directory in the list is searched # for a subdirectory and ``_SOURCE`` is set to the first one # found (if any). # # 2. If ``_SOURCE`` is set, check if this directory is a CMake project # (contains ``CMakeLists.txt`` and fail if not. # # 3. Otherwise, check if the current directory has a ```` subdirectory. # # 4. If the project has not been previously marked as found or added as a # subdirectory and a project source directory has been found in steps 1-3 # add this subdirectory. # # 5. If the project has been marked as found, check the version. # # 6. Otherwise, search for the project using ``ecbuild_find_package``. # ############################################################################## macro( ecbuild_use_package ) set( options REQUIRED QUIET EXACT ) set( single_value_args PROJECT VERSION URL DESCRIPTION TYPE PURPOSE FAILURE_MSG ) set( multi_value_args COMPONENTS ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_p_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_use_package(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() if( NOT _p_PROJECT ) ecbuild_critical("The call to ecbuild_use_package() doesn't specify the PROJECT.") endif() if( _p_EXACT AND NOT _p_VERSION ) ecbuild_critical("Call to ecbuild_use_package() requests EXACT but doesn't specify VERSION.") endif() # If the package is required, set TYPE to REQUIRED # Due to shortcomings in CMake's argument parser, passing TYPE REQUIRED has no effect if( _p_REQUIRED ) set( _p_TYPE REQUIRED ) endif() if(ECBUILD_2_COMPAT_DEPRECATE) ecbuild_deprecate("ecbuild_use_package is deprecated, please use add_subdirectory or ecbuild_find_package instead.") endif() # try to find the package as a subproject and build it string( TOUPPER ${_p_PROJECT} pkgUPPER ) # user defined dir with subprojects if(ECBUILD_2_COMPAT AND DEFINED ${pkgUPPER}_SOURCE AND NOT pkgUPPER STREQUAL _p_PROJECT ) if(ECBUILD_2_COMPAT_DEPRECATE) ecbuild_deprecate("${pkgUPPER}_SOURCE is deprecated, please use ${_p_PROJECT}_SOURCE instead") endif() set(${_p_PROJECT}_SOURCE ${${pkgUPPER}_SOURCE}) endif() if( NOT DEFINED ${_p_PROJECT}_SOURCE AND DEFINED SUBPROJECT_DIRS ) ecbuild_warn("ecbuild_use_package(): setting SUBPROJECT_DIRS is deprecated") ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): scanning subproject directories ${SUBPROJECT_DIRS}") foreach( dir ${SUBPROJECT_DIRS} ) if( EXISTS ${dir}/${_p_PROJECT} AND EXISTS ${dir}/${_p_PROJECT}/CMakeLists.txt ) ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): setting ${_p_PROJECT}_SOURCE to ${dir}/${_p_PROJECT}") set( ${_p_PROJECT}_SOURCE "${dir}/${_p_PROJECT}" ) endif() endforeach() endif() # user defined path to subproject if( DEFINED ${_p_PROJECT}_SOURCE ) if( NOT EXISTS ${${_p_PROJECT}_SOURCE} OR NOT EXISTS ${${_p_PROJECT}_SOURCE}/CMakeLists.txt ) ecbuild_critical("User defined source directory '${${_p_PROJECT}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file.") endif() set( ${_p_PROJECT}_subproj_dir_ "${${_p_PROJECT}_SOURCE}" ) else() # default is 'dropped in' subdirectory named as project if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT} AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}/CMakeLists.txt ) ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): found ${_p_PROJECT} in subdirectory ${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}") set( ${_p_PROJECT}_subproj_dir_ "${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}" ) endif() endif() # check if was already added as subproject ... set( _do_compat_check 0 ) set( _source_description "" ) list( FIND ECBUILD_PROJECTS ${_p_PROJECT} _ecbuild_project_${_p_PROJECT} ) if( NOT _ecbuild_project_${_p_PROJECT} EQUAL "-1" ) ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} was previously added as a subproject") else() ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} was not previously added as a subproject") endif() if( ECBUILD_2_COMPAT ) # Disable deprecation warnings until ecbuild_mark_compat, because "_FOUND" may already have been # marked with "ecbuild_mark_compat()" in a bundle. set( DISABLE_ECBUILD_DEPRECATION_WARNINGS_orig ${DISABLE_ECBUILD_DEPRECATION_WARNINGS} ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS ON ) endif() # solve capitalization issues if( ${_p_PROJECT}_FOUND AND NOT ${pkgUPPER}_FOUND ) set( ${pkgUPPER}_FOUND 1 ) endif() if( ${pkgUPPER}_FOUND AND NOT ${_p_PROJECT}_FOUND ) set( ${_p_PROJECT}_FOUND 1 ) endif() if( ECBUILD_2_COMPAT ) ecbuild_mark_compat(${pkgUPPER}_FOUND ${_p_PROJECT}_FOUND) endif() if( ECBUILD_2_COMPAT ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS ${DISABLE_ECBUILD_DEPRECATION_WARNINGS_orig} ) endif() # Case 1) project exists as subproject if( DEFINED ${_p_PROJECT}_subproj_dir_ ) # check version and components are acceptable set( _do_compat_check 1 ) # Case 1a) project was already found if( ${_p_PROJECT}_FOUND ) ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 1a) project was already added as subproject, check version is acceptable") set( _source_description "already existing sub-project ${_p_PROJECT} (sources)" ) # Case 1b) project was not already found else() ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 1b) project is NOT already FOUND and exists as subproject") set( _source_description "sub-project ${_p_PROJECT} (sources)" ) # add as a subproject set( ECBUILD_PROJECTS ${ECBUILD_PROJECTS} ${_p_PROJECT} CACHE INTERNAL "" ) ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} found in subdirectory ${${_p_PROJECT}_subproj_dir_}") add_subdirectory( ${${_p_PROJECT}_subproj_dir_} ${_p_PROJECT} ) endif() endif() # Case 2) project does NOT exist as subproject, but is FOUND # it was previously found as a binary ( either build or install tree ) if( ${_p_PROJECT}_FOUND AND NOT ${_p_PROJECT}_subproj_dir_ ) ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 2) project does NOT exist as subproject, but is FOUND") # check version and components are acceptable set( _do_compat_check 1 ) set( _source_description "previously found package ${_p_PROJECT} (binaries)" ) endif() # test version for Cases 1,2,3 # ecbuild_debug_var( _p_PROJECT ) # ecbuild_debug_var( _p_VERSION ) # ecbuild_debug_var( ${_p_PROJECT}_VERSION ) # ecbuild_debug_var( ${_p_PROJECT}_VERSION ) # ecbuild_debug_var( _do_compat_check ) # ecbuild_debug_var( _source_description ) # ecbuild_debug_var( ${_p_PROJECT}_FOUND ) # ecbuild_debug_var( ${_p_PROJECT}_previous_subproj_ ) if( _p_VERSION AND _do_compat_check ) if( _p_EXACT ) if( NOT ${_p_PROJECT}_VERSION VERSION_EQUAL _p_VERSION ) ecbuild_critical( "${PROJECT_NAME} requires (exactly) ${_p_PROJECT} = ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" ) endif() else() if( _p_VERSION VERSION_LESS ${_p_PROJECT}_VERSION OR _p_VERSION VERSION_EQUAL ${_p_PROJECT}_VERSION ) ecbuild_info( "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" ) else() ecbuild_critical( "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected only ${_source_description} ${${_p_PROJECT}_VERSION}" ) endif() endif() endif() if( _p_COMPONENTS AND _do_compat_check ) foreach( comp ${_p_COMPONENTS} ) if( NOT ${_p_PROJECT}_${comp}_FOUND ) ecbuild_critical( "${PROJECT_NAME} requires component ${comp} of ${_p_PROJECT} -- not found" ) endif() endforeach() endif() # Case 3) is NOT FOUND so far, NOT as sub-project (now or before), and NOT as binary neither # so try to find precompiled binaries or a build tree if( ${_p_PROJECT}_FOUND ) # Only set package properties if ecbuild_find_package, which itself calls # set_package_properties, is not subsequently called since doing so would # duplicate the purpose set_package_properties( ${_p_PROJECT} PROPERTIES URL "${_p_URL}" DESCRIPTION "${_p_DESCRIPTION}" TYPE "${_p_TYPE}" PURPOSE "${_p_PURPOSE}" ) else() ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 3) project does NOT exist as subproject and is NOT already FOUND") set( _opts ) if( _p_VERSION ) list( APPEND _opts VERSION ${_p_VERSION} ) endif() if( _p_COMPONENTS ) list( APPEND _opts COMPONENTS ${_p_COMPONENTS} ) endif() if( _p_EXACT ) list( APPEND _opts EXACT ) endif() if( _p_REQUIRED ) list( APPEND _opts REQUIRED ) endif() if( _p_URL ) list( APPEND _opts URL ${_p_URL} ) endif() if( _p_DESCRIPTION ) list( APPEND _opts DESCRIPTION "${_p_DESCRIPTION}" ) endif() if( _p_TYPE ) list( APPEND _opts TYPE ${_p_TYPE} ) endif() if( _p_PURPOSE ) list( APPEND _opts PURPOSE "${_p_PURPOSE}" ) endif() if( _p_FAILURE_MSG ) ecbuild_debug_var( _p_FAILURE_MSG ) list( APPEND _opts FAILURE_MSG "${_p_FAILURE_MSG}" ) endif() if (_p_QUIET) list( APPEND _opts QUIET) endif() ecbuild_find_package( NAME ${_p_PROJECT} ${_opts} ) if( ${_p_PROJECT}_FOUND ) set( ${pkgUPPER}_FOUND ${${_p_PROJECT}_FOUND} ) endif() endif() if( ECBUILD_2_COMPAT AND ${_p_PROJECT}_FOUND ) ecbuild_declare_compat(${pkgUPPER}_FOUND ${_p_PROJECT}_FOUND) string( TOUPPER ${PROJECT_NAME} PROJECT_NAME_CAPS ) list( APPEND ${PROJECT_NAME_CAPS}_TPLS ${_p_PROJECT} ) list( REMOVE_DUPLICATES ${PROJECT_NAME_CAPS}_TPLS ) endif() ### for when we change this macro to a function() # set_parent_scope( ${_p_PROJECT}_FOUND ) # set_parent_scope( ${_p_PROJECT}_FOUND ) # set_parent_scope( ${_p_PROJECT}_VERSION ) # set_parent_scope( ${_p_PROJECT}_VERSION ) # set_parent_scope( ${_p_PROJECT}_BINARY_DIR ) endmacro() ecbuild-3.14.1/cmake/compat/ecbuild_check_cxx11.cmake0000664000175000017500000000150015200367620022525 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_check_cxx11 # =================== # # REMOVED ############################################################################## function(ecbuild_check_cxx11) if(ECBUILD_COMPAT_DEPRECATE) ecbuild_deprecate("The ecbuild_check_cxx11 has been removed. Please use " "CMake facilities for C++11 features") endif() endfunction(ecbuild_check_cxx11) ecbuild-3.14.1/cmake/compat/ecbuild_add_cxx11_flags.cmake0000664000175000017500000000235115200367620023361 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_add_cxx11_flags # ======================= # # Add cxx11 flags to CXX compilation flags. :: # # ecbuild_add_cxx11_flags() # # DEPRECATED. Please set CMAKE_CXX_STANDARD or use target_compile_features # instead. # ############################################################################## macro( ecbuild_add_cxx11_flags ) if( ECBUILD_2_COMPAT_DEPRECATE ) ecbuild_deprecate("ecbuild_add_cxx11_flags is deprecated and will be " "removed in a future version. Please set CMAKE_CXX_STANDARD or use " "target_compile_features instead.") endif() if( NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 11 ) set( CMAKE_CXX_STANDARD 11 ) set( CMAKE_CXX_STANDARD_REQUIRED ON ) endif() endmacro( ecbuild_add_cxx11_flags ) ecbuild-3.14.1/cmake/ecbuild_target_flags.cmake0000664000175000017500000001127415200367620021614 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_target_flags # ==================== # # Override compiler flags for a given target. :: # # ecbuild_target_flags( ) # # Required arguments: # # :target: Target name # :c_flags: Target specific C flags (can be empty) # :cxx_flags: Target specific CXX flags (can be empty) # :fortran_flags: Target specific Fortran flags (can be empty) # # There are 3 cases, only the first applicable case takes effect: # # 1. Use custom rules from user specified ``ECBUILD_COMPILE_FLAGS`` file and # append target specific flags. # # 2. Use JSON rules from user specified ``ECBUILD_SOURCE_FLAGS`` file and # append target specific flags. # # 3. Only the target specific flags are applied to all matching source files. # ############################################################################## function( ecbuild_target_flags target c_flags cxx_flags fortran_flags ) get_property( languages GLOBAL PROPERTY ENABLED_LANGUAGES ) foreach( lang ${languages} ) string( TOLOWER ${lang} l ) if( ${target}_${l}_srcs ) # 1) Override compile flags from user specified CMake file if( ECBUILD_COMPILE_FLAGS ) # Project specific flags for current language and optionally build type set( pflags "${${PNAME}_${lang}_FLAGS} ${${PNAME}_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" ) foreach( src ${${target}_${l}_srcs} ) get_property( oflags SOURCE ${src} PROPERTY OVERRIDE_COMPILE_FLAGS ) get_property( oflags_btype SOURCE ${src} PROPERTY OVERRIDE_COMPILE_FLAGS_${CMAKE_BUILD_TYPE_CAPS} ) # Override compile flags for source file? if( oflags OR oflags_btype ) set_source_files_properties( ${src} PROPERTIES COMPILE_FLAGS "${oflags} ${oflags_btype}" ) ecbuild_debug( "ecbuild_target_flags(${target}): overriding flags for ${src} with '${oflags} ${oflags_btype}'" ) # Otherwise append source file specific flags to project specific and target specific flags else() get_property( flags SOURCE ${src} PROPERTY COMPILE_FLAGS ) get_property( flags_btype SOURCE ${src} PROPERTY COMPILE_FLAGS_${CMAKE_BUILD_TYPE_CAPS} ) # Has this file already been processed in another target? get_property( has_flags SOURCE ${src} PROPERTY CUSTOM_FLAGS ) if ( has_flags ) # Avoid applying duplicate flags to a source we've already processed # Don't add the project-level custom flags (${pflags}) again. # Does not protect against misuse of ${l}_flags from multiple targets. set_source_files_properties( ${src} PROPERTIES COMPILE_FLAGS "${${l}_flags} ${flags} ${flags_btype}" ) ecbuild_debug( "ecbuild_target_flags(${target}): setting flags for ${src} to '${${l}_flags} ${flags} ${flags_btype}'" ) else() # First time processing this file; add everything set_source_files_properties( ${src} PROPERTIES COMPILE_FLAGS "${pflags} ${${l}_flags} ${flags} ${flags_btype}" ) ecbuild_debug( "ecbuild_target_flags(${target}): setting flags for ${src} to '${pflags} ${${l}_flags} ${flags} ${flags_btype}'" ) # Mark source file as already processed. set_property( SOURCE ${src} PROPERTY CUSTOM_FLAGS TRUE ) endif() endif() endforeach() # 2) Override compile flags from user specified JSON file elseif( ECBUILD_SOURCE_FLAGS ) ecbuild_source_flags( ${target}_${lang}_SOURCE_FLAGS ${target}_${l} "${${l}_flags}" "${${target}_${l}_srcs}" ) ecbuild_debug("ecbuild_target_flags(${target}): setting source file ${lang} flags from ${${target}_${lang}_SOURCE_FLAGS}") include( ${${target}_${lang}_SOURCE_FLAGS} ) # 3) Use target specific compile flags elseif( ${l}_flags ) set_source_files_properties( ${${target}_${l}_srcs} PROPERTIES COMPILE_FLAGS "${${l}_flags}" ) ecbuild_debug("ecbuild_target_flags(${target}): setting flags for '${${target}_${l}_srcs}' to '${${l}_flags}'") endif() endif() endforeach() endfunction() ecbuild-3.14.1/cmake/ecbuild_add_executable.cmake0000664000175000017500000003232115200367620022077 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_add_executable # ====================== # # Add an executable with a given list of source files. :: # # ecbuild_add_executable( TARGET # SOURCES [ ...] # [ SOURCES_GLOB [ ...] ] # [ SOURCES_EXCLUDE_REGEX [ ...] ] # [ OBJECTS [ ...] ] # [ TEMPLATES [ ...] ] # [ LIBS [ ...] ] # [ NO_AS_NEEDED ] # [ INCLUDES [ ...] ] # [ DEFINITIONS [ ...] ] # [ PERSISTENT [ ...] ] # [ GENERATED [ ...] ] # [ DEPENDS [ ...] ] # [ CONDITION ] # [ PROPERTIES [ ...] ] # [ NOINSTALL ] # [ VERSION | AUTO_VERSION ] # [ CFLAGS [ ...] ] # [ CXXFLAGS [ ...] ] # [ FFLAGS [ ...] ] # [ LINKER_LANGUAGE ] # [ OUTPUT_NAME ] ) # # Options # ------- # # TARGET : required # target name # # SOURCES : required # list of source files # # SOURCES_GLOB : optional # search pattern to find source files to compile (note: not recommend according to CMake guidelines) # it is usually better to explicitly list the source files in the CMakeList.txt # # SOURCES_EXCLUDE_REGEX : optional # search pattern to exclude source files from compilation, applies o the results of SOURCES_GLOB # # OBJECTS : optional # list of object libraries to add to this target # # TEMPLATES : optional # list of files specified as SOURCES which are not to be compiled separately # (these are commonly template implementation files included in a header) # # LIBS : optional # list of libraries to link against (CMake targets or external libraries) # # NO_AS_NEEDED: optional # add --no-as-needed linker flag, to prevent stripping libraries that looks like are not used # # INCLUDES : optional # list of paths to add to include directories # # DEFINITIONS : optional # list of definitions to add to preprocessor defines # # PERSISTENT : optional # list of persistent layer object files # # GENERATED : optional # list of files to mark as generated (sets GENERATED source file property) # # DEPENDS : optional # list of targets to be built before this target # # CONDITION : optional # conditional expression which must evaluate to true for this target to be # built (must be valid in a CMake ``if`` statement) # # PROPERTIES : optional # custom properties to set on the target # # NOINSTALL : optional # do not install the executable # # VERSION : optional, AUTO_VERSION or LIBS_VERSION is used if not specified # version to use as executable version # # AUTO_VERSION : optional, ignored if VERSION is specified # automatically version the executable with the package version # # CFLAGS : optional # list of C compiler flags to use for all C source files # # See usage note below. # # CXXFLAGS : optional # list of C++ compiler flags to use for all C++ source files # # See usage note below. # # FFLAGS : optional # list of Fortran compiler flags to use for all Fortran source files # # See usage note below. # # LINKER_LANGUAGE : optional # sets the LINKER_LANGUAGE property on the target # # OUTPUT_NAME : optional # sets the OUTPUT_NAME property on the target # # Usage # ----- # # The ``CFLAGS``, ``CXXFLAGS`` and ``FFLAGS`` options apply the given compiler # flags to all C, C++ and Fortran sources passed to this command, respectively. # If any two ``ecbuild_add_executable``, ``ecbuild_add_library`` or # ``ecbuild_add_test`` commands are passed the *same* source file and each sets # a different value for the compiler flags to be applied to that file (including # when one command adds flags and another adds none), then the two commands # will be in conflict and the result may not be as expected. # # For this reason it is recommended not to use the ``*FLAGS`` options when # multiple targets share the same source files, unless the exact same flags are # applied to those sources by each relevant command. # # Care should also be taken to ensure that these commands are not passed source # files which are not required to build the target, if those sources are also # passed to other commands which set different compiler flags. # ############################################################################## function( ecbuild_add_executable ) set( options NOINSTALL AUTO_VERSION NO_AS_NEEDED ) set( single_value_args TARGET COMPONENT LINKER_LANGUAGE VERSION OUTPUT_NAME ) set( multi_value_args SOURCES SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION PROPERTIES ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_TARGET ) ecbuild_critical("The call to ecbuild_add_executable() doesn't specify the TARGET.") endif() if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB ) ecbuild_critical("The call to ecbuild_add_executable() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB.") endif() ### conditional build ecbuild_evaluate_dynamic_condition( _PAR_CONDITION _${_PAR_TARGET}_condition ) if( _${_PAR_TARGET}_condition ) # insert already compiled objects (from OBJECT libraries) unset( _all_objects ) foreach( _obj ${_PAR_OBJECTS} ) list( APPEND _all_objects $ ) endforeach() # glob sources unset( _glob_srcs ) foreach( pattern ${_PAR_SOURCES_GLOB} ) ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" ) endforeach() foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} ) ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" ) endforeach() list( APPEND _PAR_SOURCES ${_glob_srcs} ) if( ECBUILD_LIST_SOURCES ) ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}") endif() # add persistent layer files ecbuild_add_persistent( SRC_LIST _PAR_SOURCES FILES ${_PAR_PERSISTENT} NAMESPACE "${PERSISTENT_NAMESPACE}" ) # remove templates from compilation sources if( DEFINED _PAR_TEMPLATES ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): removing ${_PAR_TEMPLATES} from sources") list( REMOVE_ITEM _PAR_SOURCES ${_PAR_TEMPLATES} ) add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} ) endif() # Separate sources if( _PAR_SOURCES ) ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} ) endif() if( ${_PAR_TARGET}_cuda_srcs AND CUDA_FOUND ) cuda_add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} ) else() add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} ) endif() # Set custom properties if( ${_PAR_PROPERTIES} ) set_target_properties( ${_PAR_TARGET} PROPERTIES ${_PAR_PROPERTIES} ) endif() # ecbuild_echo_target( ${_PAR_TARGET} ) # add include dirs if defined if( DEFINED _PAR_INCLUDES ) ecbuild_filter_list(INCLUDES LIST ${_PAR_INCLUDES} LIST_INCLUDE path LIST_EXCLUDE skipped_path) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): add [${path}] to include_directories") target_include_directories( ${_PAR_TARGET} PRIVATE ${path} ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): [${skipped_path}] not found - not adding to include_directories") endif() # set OUTPUT_NAME if( DEFINED _PAR_OUTPUT_NAME ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): set OUTPUT_NAME to ${_PAR_OUTPUT_NAME}") set_target_properties( ${_PAR_TARGET} PROPERTIES OUTPUT_NAME ${_PAR_OUTPUT_NAME} ) endif() # add extra dependencies if( DEFINED _PAR_DEPENDS) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): add dependency on ${_PAR_DEPENDS}") add_dependencies( ${_PAR_TARGET} ${_PAR_DEPENDS} ) endif() # add the link libraries if( DEFINED _PAR_LIBS ) list(REMOVE_ITEM _PAR_LIBS debug) list(REMOVE_ITEM _PAR_LIBS optimized) ecbuild_filter_list(LIBS LIST ${_PAR_LIBS} LIST_INCLUDE lib LIST_EXCLUDE skipped_lib) if ( _PAR_NO_AS_NEEDED AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) target_link_libraries( ${_PAR_TARGET} -Wl,--no-as-needed ${lib} ) else() target_link_libraries( ${_PAR_TARGET} ${lib} ) endif() ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): linking with [${lib}]") ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): [${skipped_lib}] not found - not linking") endif() # Override compilation flags on a per source file basis ecbuild_target_flags( ${_PAR_TARGET} "${_PAR_CFLAGS}" "${_PAR_CXXFLAGS}" "${_PAR_FFLAGS}" ) # define VERSION if requested if( DEFINED _PAR_VERSION ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): set version to ${_PAR_VERSION}") set_target_properties( ${_PAR_TARGET} PROPERTIES VERSION "${_PAR_VERSION}" ) else() if( _PAR_AUTO_VERSION ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): set version to ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}") set_target_properties( ${_PAR_TARGET} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}" ) endif() endif() # installation if( NOT _PAR_NOINSTALL ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): installing to ${INSTALL_BIN_DIR}") # add installation paths and associate with defined component # if( DEFINED _PAR_COMPONENT ) # set( COMPONENT_DIRECTIVE "${_PAR_COMPONENT}" ) # else() # set( COMPONENT_DIRECTIVE "${PROJECT_NAME}" ) # endif() install( TARGETS ${_PAR_TARGET} EXPORT ${PROJECT_NAME}-targets RUNTIME DESTINATION ${INSTALL_BIN_DIR} LIBRARY DESTINATION ${INSTALL_LIB_DIR} ARCHIVE DESTINATION ${INSTALL_LIB_DIR} ) # COMPONENT ${COMPONENT_DIRECTIVE} ) # set build location set_target_properties( ${_PAR_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) # export location of target to other projects -- must be exactly after setting the build location (see previous command) export( TARGETS ${_PAR_TARGET} APPEND FILE "${PROJECT_TARGETS_FILE}" ) else() ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): not installing") # NOINSTALL targets are always built the build_rpath, not the install_rpath set_target_properties( ${_PAR_TARGET} PROPERTIES SKIP_BUILD_RPATH FALSE ) set_target_properties( ${_PAR_TARGET} PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE ) endif() # add definitions to compilation if( DEFINED _PAR_DEFINITIONS ) target_compile_definitions(${_PAR_TARGET} PRIVATE ${_PAR_DEFINITIONS}) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): adding definitions ${_PAR_DEFINITIONS}") endif() # set linker language if( DEFINED _PAR_LINKER_LANGUAGE ) ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): using linker language ${_PAR_LINKER_LANGUAGE}") set_target_properties( ${_PAR_TARGET} PROPERTIES LINKER_LANGUAGE ${_PAR_LINKER_LANGUAGE} ) if( ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES ) target_link_libraries( ${_PAR_TARGET} ${ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES} ) endif() endif() if( ECBUILD_IMPLICIT_LINK_LIBRARIES ) target_link_libraries( ${_PAR_TARGET} ${ECBUILD_IMPLICIT_LINK_LIBRARIES} ) endif() # make sure target is removed before - some problems with AIX add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $ ) # append to the list of this project targets set( ${PROJECT_NAME}_ALL_EXES ${${PROJECT_NAME}_ALL_EXES} ${_PAR_TARGET} CACHE INTERNAL "" ) endif() # mark source files as used ecbuild_declare_project_files( ${_PAR_SOURCES} ) if( DEFINED _PAR_TEMPLATES ) ecbuild_declare_project_files( ${_PAR_TEMPLATES} ) endif() endfunction( ecbuild_add_executable ) ecbuild-3.14.1/cmake/ecbuild_add_persistent.cmake0000664000175000017500000000614515200367620022163 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_add_persistent # ====================== # # Add persistent layer object classes. :: # # ecbuild_add_persistent( SRC_LIST # FILES [ ...] ] # [ NAMESPACE ] ) # # Options # ------- # # SRC_LIST : required # CMake variable to append the generated persistent layer objects to # # FILES : required # list of base names of files to build persistent class information for # # The source file is expected to have a .h extension, the generated file # gets a .b extension. # # NAMESPACE : optional # C++ namespace to place the persistent class information in # ############################################################################## # define the script to build the persistent class information set( sg_perl "${CMAKE_CURRENT_LIST_DIR}/sg.pl" CACHE INTERNAL "perl script to generate persistent objects" ) function( ecbuild_add_persistent ) ecbuild_find_perl( REQUIRED ) set( options ) set( single_value_args SRC_LIST NAMESPACE ) set( multi_value_args FILES ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_add_persistent(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_SRC_LIST ) ecbuild_critical("The call to ecbuild_add_persistent() doesn't specify the SRC_LIST.") endif() ecbuild_debug( "ecbuild_add_persistent: adding persistent layer for [${_PAR_FILES}]" ) set(_SOURCES ${${_PAR_SRC_LIST}}) foreach( file ${_PAR_FILES} ) get_filename_component( _file_dir ${file} PATH ) get_filename_component( _file_we ${file} NAME_WE ) set( file ${_file_we} ) if( _file_dir ) file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_file_dir} ) set( file ${_file_dir}/${_file_we} ) endif() ecbuild_debug( "ecbuild_add_persistent: adding persistent layer for ${file}.b with namespace '${_PAR_NAMESPACE}' from ${file}.h in ${CMAKE_CURRENT_BINARY_DIR}/${_file_dir}" ) add_custom_command( OUTPUT ${file}.b COMMAND ${PERL_EXECUTABLE} ${sg_perl} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.h ${CMAKE_CURRENT_BINARY_DIR}/${_file_dir} ${_PAR_NAMESPACE} DEPENDS ${sg_perl} ${file}.h ) set_source_files_properties( ${file}.h PROPERTIES OBJECT_DEPENDS "${file}.b" ) list( APPEND _SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${file}.b ) endforeach() if( _SOURCES ) list(REMOVE_DUPLICATES _SOURCES) endif() set(${_PAR_SRC_LIST} ${_SOURCES} PARENT_SCOPE) endfunction( ecbuild_add_persistent ) ecbuild-3.14.1/cmake/ecbuild_generate_fortran_interfaces.cmake0000664000175000017500000002150515200367620024700 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_generate_fortran_interfaces # =================================== # # Generates interfaces from Fortran source files. :: # # ecbuild_generate_fortran_interfaces( TARGET # DESTINATION # { DIRECTORIES [ ...] | FILES [ ...] } # [ PARALLEL ] # [ INCLUDE_DIRS ] # [ GENERATED ] # [ SOURCE_DIR ] # [ SUFFIX ] # [ FCM_CONFIG_FILE ] # ) # # Options # ------- # # TARGET : required # target name # # DESTINATION : required # sub-directory of ``CMAKE_CURRENT_BINARY_DIR`` to install target to # # DIRECTORIES | FILES : required # | list of directories in ``SOURCE_DIR`` in which to search for Fortran files to be processed, *or* # | list of Fortran files in ``SOURCE_DIR`` to be processed # # PARALLEL : optional, defaults to 1 # number of processes to use (always 1 on Darwin systems) # # INCLUDE_DIRS : optional # name of CMake variable to store the path to the include directory containing the resulting interfaces # # GENERATED : optional # name of CMake variable to store the list of generated interface files, including the full path to each # # SOURCE_DIR : optional, defaults to ``CMAKE_CURRENT_SOURCE_DIR`` # directory in which to look for the sub-directories or source files given as arguments to ``DIRECTORIES`` or ``FILES`` # # SUFFIX : optional, defaults to ".intfb.h" # suffix to apply to name of each interface file # # FCM_CONFIG_FILE : optional, defaults to the ``fcm-make-interfaces.cfg`` file in the ecbuild project # FCM configuration file to be used to generate interfaces # # Usage # _____ # # Given a list of directories, they will be recursively searched for Fortran # files of the form ``.[fF]``, ``.[fF]90``, ``.[fF]03`` or # ``.[fF]08``. Given a list of files, these must be an exact match and # contained within ``SOURCE_DIR``. Either ``DIRECTORIES`` or ``FILES`` (or # both) must be provided. For each matching file, a file ```` # will be created containing the interface blocks for all external subprograms # within it, where ```` is the value given to the ``SUFFIX`` option. If # a file contains no such subprograms, no interface file will be generated for # it. # ############################################################################## function( ecbuild_generate_fortran_interfaces ) find_program( FCM_EXECUTABLE fcm DOC "Fortran interface generator" HINTS ${CMAKE_SOURCE_DIR}/fcm ${CMAKE_BINARY_DIR}/fcm ${fcm_ROOT} ENV fcm_ROOT PATH_SUFFIXES bin ) if (NOT FCM_EXECUTABLE) include(FetchContent) set(ECBUILD_FCM_VERSION "2019.09.0" CACHE STRING "FCM version used to generate Fortran interfaces") FetchContent_Populate( fcm URL "https://github.com/metomi/fcm/archive/refs/tags/${ECBUILD_FCM_VERSION}.tar.gz" SOURCE_DIR ${CMAKE_BINARY_DIR}/fcm BINARY_DIR ${CMAKE_BINARY_DIR}/_deps/fcm-build SUBBUILD_DIR ${CMAKE_BINARY_DIR}/_deps/fcm-subbuild ) set( FCM_EXECUTABLE ${CMAKE_BINARY_DIR}/fcm/bin/fcm ) endif() if( NOT FCM_EXECUTABLE ) ecbuild_error( "ecbuild_generate_fortran_interfaces: fcm executable not found." ) endif() set( options ) set( single_value_args TARGET DESTINATION PARALLEL INCLUDE_DIRS GENERATED SOURCE_DIR SUFFIX FCM_CONFIG_FILE ) set( multi_value_args DIRECTORIES FILES ) cmake_parse_arguments( P "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if( NOT DEFINED P_TARGET ) ecbuild_error( "ecbuild_generate_fortran_interfaces: TARGET argument missing" ) endif() if( NOT DEFINED P_DESTINATION ) ecbuild_error( "ecbuild_generate_fortran_interfaces: DESTINATION argument missing" ) endif() if( NOT DEFINED P_DIRECTORIES AND NOT DEFINED P_FILES ) ecbuild_error( "ecbuild_generate_fortran_interfaces: Neither DIRECTORIES nor FILES argument provided" ) endif() if( NOT DEFINED P_PARALLEL OR (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ) set( P_PARALLEL 1 ) endif() ecbuild_debug_var( P_PARALLEL ) if( NOT DEFINED P_SOURCE_DIR ) set( P_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ) endif() if( NOT DEFINED P_SUFFIX ) set( P_SUFFIX ".intfb.h" ) endif() if( DEFINED P_FCM_CONFIG_FILE ) set( FCM_CONFIG_FILE ${P_FCM_CONFIG_FILE} ) endif() if( NOT FCM_CONFIG_FILE ) set( PROJECT_FCM_CONFIG_FILE "${PROJECT_SOURCE_DIR}/cmake/fcm-make-interfaces.cfg" ) if( EXISTS ${PROJECT_FCM_CONFIG_FILE} ) set( FCM_CONFIG_FILE ${PROJECT_FCM_CONFIG_FILE} ) ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration found in ${PROJECT_FCM_CONFIG_FILE}" ) else() ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration not found in ${PROJECT_FCM_CONFIG_FILE}" ) endif() endif() if( NOT FCM_CONFIG_FILE ) set( FCM_CONFIG_FILE "${ECBUILD_MACROS_DIR}/fcm-make-interfaces.cfg" ) set( FCM_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/fcm-make-interfaces.${P_TARGET}.cfg" ) configure_file( "${ECBUILD_MACROS_DIR}/fcm-make-interfaces.cfg.in" "${FCM_CONFIG_FILE}" @ONLY ) endif() ecbuild_debug_var( FCM_CONFIG_FILE ) if( NOT EXISTS ${FCM_CONFIG_FILE} ) ecbuild_error( "ecbuild_generate_fortran_interfaces: needs fcm configuration in ${FCM_CONFIG_FILE}" ) endif() if( DEFINED P_DIRECTORIES ) foreach( _srcdir ${P_DIRECTORIES} ) if( _srcdir MATCHES "/$" ) ecbuild_critical("ecbuild_generate_fortran_interfaces: directory ${_srcdir} must not end with /") endif() ecbuild_list_add_pattern( LIST fortran_files SOURCE_DIR ${P_SOURCE_DIR} GLOB ${_srcdir}/*.[fF] ${_srcdir}/*.[fF]90 ${_srcdir}/*.[fF]03 ${_srcdir}/*.[fF]08 QUIET ) endforeach() string( REPLACE ";" " " _srcdirs "${P_DIRECTORIES}" ) endif() if( DEFINED P_FILES ) foreach( _srcfile ${P_FILES} ) ecbuild_list_add_pattern( LIST fortran_files SOURCE_DIR ${P_SOURCE_DIR} GLOB ${_srcfile} QUIET ) endforeach() string( REPLACE ";" " " _srcfiles "${P_FILES}" ) endif() string(JOIN " " _srcs "${_srcdirs}" "${_srcfiles}") set( _cnt 0 ) set( interface_files "" ) foreach( fortran_file ${fortran_files} ) #list( APPEND fullpath_fortran_files ${CMAKE_CURRENT_SOURCE_DIR}/${fortran_file} ) get_filename_component(base ${fortran_file} NAME_WE) set( interface_file "${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/interfaces/include/${base}${P_SUFFIX}" ) list( APPEND interface_files ${interface_file} ) set_source_files_properties( ${interface_file} PROPERTIES GENERATED TRUE ) math(EXPR _cnt "${_cnt}+1") endforeach() ecbuild_info("Target ${P_TARGET} will generate ${_cnt} interface files using FCM") if( DEFINED P_GENERATED ) set( ${P_GENERATED} ${interface_files} PARENT_SCOPE ) endif() set( include_dir ${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/interfaces/include ) set( ${P_INCLUDE_DIRS} ${include_dir} PARENT_SCOPE ) execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${include_dir} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) set( _fcm_lock ${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/fcm-make.lock ) set( _timestamp ${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/generated.timestamp ) add_custom_command( OUTPUT ${_timestamp} COMMAND ${CMAKE_COMMAND} -E remove_directory ${_fcm_lock} COMMAND ${FCM_EXECUTABLE} make -j ${P_PARALLEL} --config-file=${FCM_CONFIG_FILE} interfaces.ns-incl=${_srcs} interfaces.source=${P_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E touch ${_timestamp} DEPENDS ${fortran_files} COMMENT "[fcm] Generating ${_cnt} Fortran interface files for target ${P_TARGET} in ${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/interfaces/include" WORKING_DIRECTORY ${P_DESTINATION} VERBATIM ) add_custom_target(${P_TARGET}_gen DEPENDS ${_timestamp} ) ecbuild_add_library(TARGET ${P_TARGET} TYPE INTERFACE DEPENDS ${P_TARGET}_gen) target_include_directories(${P_TARGET} INTERFACE $) endfunction( ecbuild_generate_fortran_interfaces ) ecbuild-3.14.1/cmake/ecbuild_define_options.cmake0000664000175000017500000000352415200367620022156 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. # general options option( BUILD_SHARED_LIBS "build shared libraries when possible" ON ) option( ENABLE_RPATHS "when installing insert RPATHS into binaries" ON ) mark_as_advanced( ENABLE_RPATHS ) option( ENABLE_RELATIVE_RPATHS "try to use relative RPATHS, including build dir" ON ) mark_as_advanced( ENABLE_RELATIVE_RPATHS ) option( ENABLE_LARGE_FILE_SUPPORT "build with large file support" ON ) mark_as_advanced( ENABLE_LARGE_FILE_SUPPORT ) option( ENABLE_PROFILING "build with profiling support" OFF ) mark_as_advanced( ENABLE_PROFILING ) option( ENABLE_FORTRAN_C_INTERFACE "Enable Fortran/C Interface" OFF ) mark_as_advanced( ENABLE_FORTRAN_C_INTERFACE ) option( CHECK_UNUSED_FILES "check for unused project files (slow)" OFF ) mark_as_advanced( CHECK_UNUSED_FILES ) option( ECBUILD_INSTALL_LIBRARY_HEADERS "Will install library headers" ON ) mark_as_advanced( ECBUILD_INSTALL_LIBRARY_HEADERS ) option( ECBUILD_INSTALL_FORTRAN_MODULES "Will install Fortran modules" ON ) mark_as_advanced( ECBUILD_INSTALL_FORTRAN_MODULES ) option( ECBUILD_RECORD_GIT_COMMIT_SHA1 "When building ecbuild projects that are Git repos, create variables recording the full and short Git revision" ON ) mark_as_advanced( ECBUILD_RECORD_GIT_COMMIT_SHA1 ) include( CMakeDependentOption ) # make options depend on one another # hide some CMake options from CMake UI mark_as_advanced( CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT ) ecbuild-3.14.1/cmake/sha1.in0000664000175000017500000000002515200367620015635 0ustar alastairalastair@_p_SHA1@ @_p_NAME@ ecbuild-3.14.1/cmake/ecbuild_find_package.cmake0000664000175000017500000003307415200367620021547 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_find_package # ==================== # # Find a package and import its configuration. :: # # ecbuild_find_package( [ NAME ] # [ [ VERSION ] [ EXACT ] ] # [ COMPONENTS [ ... ] ] # [ URL ] # [ DESCRIPTION ] # [ TYPE ] # [ PURPOSE ] # [ FAILURE_MSG ] # [ REQUIRED ] # [ QUIET ] ) # # Options # ------- # # NAME : required # package name (used as ``Find.cmake`` and ``-config.cmake``) # # VERSION : optional # minimum required package version # # COMPONENTS : optional # list of package components to find (behaviour depends on the package) # # EXACT : optional, requires VERSION # require the exact version rather than a minimum version # # URL : optional # homepage of the package (shown in summary and stored in the cache) # # DESCRIPTION : optional # literal string or name of CMake variable describing the package # # TYPE : optional, one of RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED # type of dependency of the project on this package (defaults to OPTIONAL) # # PURPOSE : optional # literal string or name of CMake variable describing which functionality # this package enables in the project # # FAILURE_MSG : optional # literal string or name of CMake variable containing a message to be # appended to the failure message if the package is not found # # REQUIRED : optional (equivalent to TYPE REQUIRED, and overrides TYPE argument) # fail if package cannot be found # # QUIET : optional # do not output package information if found # # Input variables # --------------- # # The following CMake variables influence the behaviour if set (```` is # the package name as given, ```` is the capitalised version): # # :_ROOT: install prefix path of the package # :_PATH: install prefix path of the package, prefer _ROOT # :_PATH: install prefix path of the package, prefer _ROOT # :_DIR: directory containing the ``-config.cmake`` file # (usually ``/lib/cmake/``), prefer _ROOT # :CMAKE_PREFIX_PATH: Specify this when most packages are installed in same prefix # # The environment variables ``_ROOT``, ``_PATH``, ``_PATH``, ``_DIR`` # are taken into account only if the corresponding CMake variables are unset. # # Note, some packages are found via ``Find.cmake`` and may have their own mechanism of # finding paths with other variables, e.g. ``_HOME``. See the corresponing # ``Find.cmake`` file for datails, or use `cmake --help-module Find` if it is a # standard CMake-recognized module. # # Usage # ----- # # The search proceeds as follows: # # 1. If is a subproject of the top-level project, search for # ``-config.cmake`` in ``_BINARY_DIR``. # # 2. If ``Find.cmake`` exists in ``CMAKE_MODULE_PATH``, search using it. # # 3. If any paths have been specified by the user via CMake or environment # variables as given above: # # * search for ``-config.cmake`` in those paths only # * fail if the package was not found in any of those paths # * Search paths are in order from high to low priority: # - ``_DIR`` # - ``_ROOT`` # - ``_PATH`` # - ``_PATH`` # - ``ENV{_ROOT}`` # - ``ENV{_PATH}`` # - ``ENV{_PATH}`` # - ``CMAKE_PREFIX_PATH`` # - ``ENV{_DIR}`` # - ``ENV{CMAKE_PREFIX_PATH}`` # - ``system paths`` # # See CMake documentation of ``find_package()`` for details. # # 4. Fail if the package was not found and is REQUIRED. # ############################################################################## macro( ecbuild_find_package ) set( options REQUIRED RECOMMENDED QUIET EXACT ) set( single_value_args NAME VERSION URL DESCRIPTION TYPE PURPOSE FAILURE_MSG ) set( multi_value_args COMPONENTS ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) if( NOT _PAR_NAME ) set( _PAR_NAME ${ARGV0} ) list( REMOVE_ITEM _PAR_UNPARSED_ARGUMENTS ${ARGV0} ) if( NOT _PAR_VERSION AND "${ARGV1}" MATCHES "^[0-9]+(\\.[0-9]+)*$" ) set( _PAR_VERSION ${ARGV1} ) list( REMOVE_ITEM _PAR_UNPARSED_ARGUMENTS ${ARGV1} ) endif() endif() endif() if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_find_package(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_NAME ) ecbuild_critical("The call to ecbuild_find_package() doesn't specify the NAME.") endif() if( _PAR_EXACT AND NOT _PAR_VERSION ) ecbuild_critical("Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.") endif() if( _PAR_QUIET ) set( _${_PAR_NAME}_find_quiet QUIET ) endif() # If the package is required, set TYPE to REQUIRED # Due to shortcomings in CMake's argument parser, passing TYPE REQUIRED has no effect if( _PAR_REQUIRED ) set( _PAR_TYPE REQUIRED ) endif() # As mentioned in documentation above, the default TYPE is OPTIONAL if( NOT _PAR_TYPE ) set( _PAR_TYPE OPTIONAL ) endif() set( _${_PAR_NAME}_version "" ) if( _PAR_VERSION ) set( _${_PAR_NAME}_version ${_PAR_VERSION} ) if( _PAR_EXACT ) set( _${_PAR_NAME}_version ${_PAR_VERSION} EXACT ) endif() endif() set( _${_PAR_NAME}_components "" ) if( DEFINED _PAR_COMPONENTS ) set( _${_PAR_NAME}_components COMPONENTS ${_PAR_COMPONENTS} ) endif() if( ECBUILD_2_COMPAT ) # Disable deprecation warnings until ecbuild_mark_compat, because "_FOUND" may already have been # marked with "ecbuild_mark_compat()" in a bundle. set( DISABLE_ECBUILD_DEPRECATION_WARNINGS_orig ${DISABLE_ECBUILD_DEPRECATION_WARNINGS} ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS ON ) endif() # cancel the effect of ecbuild_install_project setting _FOUND in # compat mode (otherwise this means the -config.cmake file may not # always be loaded, see ECBUILD-401) if( ECBUILD_2_COMPAT ) unset( ${_PAR_NAME}_FOUND ) endif() # if a project with the same name has been defined, try to use it if( ${_PAR_NAME}_BINARY_DIR ) # 1) search using CONFIG mode -- try to locate a configuration file provided by the package (package-config.cmake) # _BINARY_DIR is defined by CMake when using project() if( NOT ${_PAR_NAME}_FOUND ) ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): find_package( ${_PAR_NAME} ${_${_PAR_NAME}_version} ${_${_PAR_NAME}_components} ${_${_PAR_NAME}_find_quiet} )\n" " using hints ${_PAR_NAME}_BINARY_DIR=${${_PAR_NAME}_BINARY_DIR}" ) find_package( ${_PAR_NAME} ${_${_PAR_NAME}_version} ${_${_PAR_NAME}_components} ${_${_PAR_NAME}_find_quiet} NO_MODULE HINTS ${${_PAR_NAME}_BINARY_DIR} NO_DEFAULT_PATH ) endif() if( NOT ${_PAR_NAME}_FOUND ) if( ${_PAR_NAME}_CONSIDERED_VERSIONS ) ecbuild_critical( "${_PAR_NAME} was found in the source tree but no suitable version (or component set) was found at '${${_PAR_NAME}_BINARY_DIR}'" ) else() ecbuild_critical( "${_PAR_NAME} was found in the source tree but could not be loaded from '${${_PAR_NAME}_BINARY_DIR}'" ) endif() endif() else() # If a Find.cmake module is found, use MODULE keyword, otherwise, use CONFIG. # This makes the find_package error message much more consise. find_file( ${_PAR_NAME}_FindModule Find${_PAR_NAME}.cmake PATHS ${CMAKE_MODULE_PATH} ${CMAKE_ROOT}/Modules NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) find_file( ${_PAR_NAME}_FindModule Find${_PAR_NAME}.cmake PATHS ${CMAKE_MODULE_PATH} ${CMAKE_ROOT}/Modules ) if( ${_PAR_NAME}_FindModule ) set( _${_PAR_NAME}_mode MODULE ) else() set( _${_PAR_NAME}_mode CONFIG ) endif() # Read variables like _PATH and _PATH, # and make older versions (CMake < 3.12) forward compatible with _ROOT ecbuild_find_package_search_hints( NAME ${_PAR_NAME} ) # Disable search in package registry, and save to be restored after find_package() set( CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY_orig ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY} ) set( CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON ) # The actual find_package() ecbuild_debug ( "ecbuild_find_package(${_PAR_NAME}): find_package( ${_PAR_NAME} ${_${_PAR_NAME}_version} ${_${_PAR_NAME}_find_quiet} ${_${_PAR_NAME}_components} ${_${_PAR_NAME}_mode} )") find_package( ${_PAR_NAME} ${_${_PAR_NAME}_version} ${_${_PAR_NAME}_find_quiet} ${_${_PAR_NAME}_components} ${_${_PAR_NAME}_mode} ) # Restore setting set( CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY_orig} ) endif() string( TOUPPER ${_PAR_NAME} pkgUPPER ) if(ECBUILD_2_COMPAT) ecbuild_declare_compat(${pkgUPPER}_FOUND ${_PAR_NAME}_FOUND) endif() if( ECBUILD_2_COMPAT ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS ${DISABLE_ECBUILD_DEPRECATION_WARNINGS_orig} ) endif() ### final messages if( ${_PAR_NAME}_FOUND ) if( NOT _PAR_QUIET ) if( ${_PAR_NAME}_DIR ) # Defined by find_package if found via CONFIG option ecbuild_info( "${PROJECT_NAME} FOUND ${_PAR_NAME}: ${${_PAR_NAME}_DIR} (found version \"${${_PAR_NAME}_VERSION}\")" ) else() if( ${_PAR_NAME}_VERSION ) ecbuild_info( "${PROJECT_NAME} FOUND ${_PAR_NAME} (found version \"${${_PAR_NAME}_VERSION}\")" ) else() ecbuild_info( "${PROJECT_NAME} FOUND ${_PAR_NAME}" ) endif() endif() foreach( var IN ITEMS INCLUDE_DIRS INCLUDE_DIR ) if( ${_PAR_NAME}_${var} ) ecbuild_info( " ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" ) break() endif() if( ${pkgUPPER}_${var} ) ecbuild_info( " ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" ) break() endif() endforeach() foreach( var IN ITEMS LIBRARIES LIBRARY ) if( ${pkgUPPER}_${var} ) ecbuild_info( " ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" ) break() endif() if( ${_PAR_NAME}_${var} ) ecbuild_info( " ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" ) break() endif() endforeach() foreach( var IN ITEMS DEFINITIONS ) if( ${pkgUPPER}_${var} ) ecbuild_info( " ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" ) break() endif() if( ${_PAR_NAME}_${var} ) ecbuild_info( " ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" ) break() endif() endforeach() endif() if( DEFINED ${_PAR_DESCRIPTION} ) set( _PAR_DESCRIPTION ${${_PAR_DESCRIPTION}} ) endif() if( DEFINED ${_PAR_PURPOSE} ) set( _PAR_PURPOSE ${${_PAR_PURPOSE}} ) endif() set_package_properties( ${_PAR_NAME} PROPERTIES URL "${_PAR_URL}" DESCRIPTION "${_PAR_DESCRIPTION}" TYPE "${_PAR_TYPE}" PURPOSE "${_PAR_PURPOSE}" ) else() set( _failed_message ${_PAR_FAILURE_MSG} ) if( DEFINED ${_PAR_FAILURE_MSG} ) set( _failed_message "${${_PAR_FAILURE_MSG}}" ) endif() # Quite verbose message, only to be printed when package is REQUIRED, or ECBUILD_LOG_LEVEL <= DEBUG # When TYPE is RECOMMENDED, we will issue with ecbuild_warn, otherwise ecbuild_info set( _default_failed_message "${PROJECT_NAME} FAILED to find ${_PAR_TYPE} package ${_PAR_NAME}" ) if( ${_PAR_NAME}_FindModule ) set( _failed_help "find_package(${_PAR_NAME}) used a Find${_PAR_NAME} module to find ${_PAR_NAME}\n" " Please check file `${${_PAR_NAME}_FindModule}` for help on setting variables to find this package." ) else() set( _failed_help "find_package(${_PAR_NAME}) assumed ${_PAR_NAME} is a CMake project.\n" " Recommended variables that can help detection:\n" " - ${_PAR_NAME}_ROOT : the install prefix (as in /bin /lib /include)\n" " - CMAKE_PREFIX_PATH : the install prefix (as ${_PAR_NAME}_ROOT, or its parent directory as in /${_PAR_NAME})" ) endif() if( NOT _failed_message ) if(_PAR_TYPE MATCHES "(RECOMMENDED|REQUIRED)" ) set( _failed_message "${_default_failed_message}\n${_failed_help}" ) else() set( _failed_message ${_default_failed_message} ) endif() endif() if( _PAR_REQUIRED ) ecbuild_critical( "${_failed_message}" ) endif() if( NOT _PAR_QUIET ) if( _PAR_TYPE MATCHES "RECOMMENDED" ) ecbuild_warn( "${_failed_message}" ) else() ecbuild_info( "${_failed_message}" ) endif() if( ECBUILD_LOG_LEVEL LESS_EQUAL ${ECBUILD_DEBUG} ) ecbuild_debug( "${_failed_help}" ) endif() else() ecbuild_debug( "${_failed_message}" ) endif() endif() endmacro() ecbuild-3.14.1/cmake/determine-nec.F900000664000175000017500000000012615200367620017452 0ustar alastairalastair#ifndef __NEC__ #error Not the NEC compiler #endif program determine_nec end program ecbuild-3.14.1/cmake/ecbuild_add_option.cmake0000664000175000017500000003643415200367620021277 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_add_option # ================== # # Add a CMake configuration option, which may depend on a list of packages. :: # # ecbuild_add_option( FEATURE # [ DEFAULT ON|OFF ] # [ DESCRIPTION ] # [ REQUIRED_PACKAGES [ ...] ] # [ CONDITION ] # [ ADVANCED ] [ NO_TPL ] ) # # Options # ------- # # FEATURE : required # name of the feature / option # # DEFAULT : optional, defaults to ON # if set to ON, the feature is enabled even if not explicitly requested # # DESCRIPTION : optional # string describing the feature (shown in summary and stored in the cache) # # REQUIRED_PACKAGES : optional # list of packages required to be found for this feature to be enabled # # Every item in the list should be a valid argument list for # ``ecbuild_find_package``, e.g.:: # # "NAME [VERSION ] [...]" # # .. note:: # # Arguments inside the package string that require quoting need to use the # `bracket argument syntax`_ introduced in CMake 3.0 since # regular quotes even when escaped are swallowed by the CMake parser. # # Alternatively, the name of a CMake variable containing the string can be # passed, which will be expanded by ``ecbuild_find_package``: :: # # set( ECCODES_FAIL_MSG # "grib_api can be used instead (select with -DENABLE_ECCODES=OFF)" ) # ecbuild_add_option( FEATURE ECCODES # DESCRIPTION "Use eccodes instead of grib_api" # REQUIRED_PACKAGES "NAME eccodes REQUIRED FAILURE_MSG ECCODES_FAIL_MSG" # DEFAULT ON ) # # CONDITION : optional # conditional expression which must evaluate to true for this option to be # enabled (must be valid in a CMake ``if`` statement) # # ADVANCED : optional # mark the feature as advanced # # NO_TPL : optional # do not add any ``REQUIRED_PACKAGES`` to the list of third party libraries # # Usage # ----- # # Features with ``DEFAULT OFF`` need to be explcitly enabled by the user with # ``-DENABLE_=ON``. If a feature is enabled, all ``REQUIRED_PACKAGES`` # are found and ``CONDITION`` is met, ecBuild sets the variable # ``HAVE_`` to ``ON``. This is the variable to use to check for the # availability of the feature. # # If a feature is explicitly enabled but the required packages are not found, # configuration fails. This only applies when configuring from *clean cache*. # With an already populated cache, use ``-DENABLE_=REQUIRE`` to make # the feature a required feature (this cannot be done via the CMake GUI). # # .. _bracket argument syntax: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-argument # ############################################################################## macro( ecbuild_add_option ) set( options ADVANCED NO_TPL ) set( single_value_args FEATURE DEFAULT DESCRIPTION TYPE PURPOSE ) set( multi_value_args REQUIRED_PACKAGES CONDITION ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) # # Policy CMP0077 set to NEW, to avoid warning and allow disregarding # the cache variable ENABLE_ if it is not set by the user # cmake_policy(SET CMP0077 NEW) if( _p_UNPARSED_ARGUMENTS ) ecbuild_critical("Unknown keywords given to ecbuild_add_option(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() # check FEATURE parameter if( NOT _p_FEATURE ) ecbuild_critical("The call to ecbuild_add_option() doesn't specify the FEATURE.") endif() # check DEFAULT parameter if( NOT DEFINED _p_DEFAULT ) set( _p_DEFAULT ON ) else() if( NOT _p_DEFAULT MATCHES "[Oo][Nn]" AND NOT _p_DEFAULT MATCHES "[Oo][Ff][Ff]" ) ecbuild_critical("In macro ecbuild_add_option(), DEFAULT must be either ON or OFF, but found: \"${_p_DEFAULT}\"") endif() endif() ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defaults to ${_p_DEFAULT}") if( _p_PURPOSE ) ecbuild_deprecate( "ecbuild_add_option: argument PURPOSE is ignored and will be removed in a future release." ) endif() if( _p_TYPE ) ecbuild_deprecate( "ecbuild_add_option: argument TYPE is ignored and will be removed in a future release." ) endif() # check CONDITION parameter ecbuild_evaluate_dynamic_condition( _p_CONDITION _${_p_FEATURE}_condition ) # Disable deprecation warnings until end of macro, because "ENABLE_" may already have been # marked with "ecbuild_mark_compat()" in a bundle. if( ECBUILD_2_COMPAT ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS_orig ${DISABLE_ECBUILD_DEPRECATION_WARNINGS} ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS ON ) endif() # Check if user explicitly enabled/disabled the feature in cache get_property( _in_cache CACHE ENABLE_${_p_FEATURE} PROPERTY VALUE SET ) # ***Important*** # # In order to support options in multi-project scenarios, and allow the user to # reconfigure the project with a different set of options, we need to precompute # and store the value of the user provided option. # # This is done by creating a new variable _ENABLE__defined_value. # This variable is used to store the value of ENABLE_ when the user provides it. # This is done to avoid overwriting the cache value of ENABLE_ when the user # provides a different value for the same option in a different project. # if ( NOT DEFINED ${PROJECT_NAME}_ENABLE_${_p_FEATURE}_defined_value ) if ( DEFINED ENABLE_${_p_FEATURE} ) # When the user provides a value for ENABLE_, we cache it # in a new variable _ENABLE__defined_value set ( ${PROJECT_NAME}_ENABLE_${_p_FEATURE}_defined_value ${ENABLE_${_p_FEATURE}} CACHE INTERNAL "" FORCE ) else() # When the user does not provide a value for ENABLE_, # we set the default value of ENABLE_ to the default value # of the feature. set ( ${PROJECT_NAME}_ENABLE_${_p_FEATURE}_defined_value ${_p_DEFAULT} CACHE INTERNAL "" FORCE ) endif() else() if ( DEFINED ENABLE_${_p_FEATURE} ) # When the user provides a value for ENABLE_, we cache it # in a new variable _ENABLE__defined_value. set ( ${PROJECT_NAME}_ENABLE_${_p_FEATURE}_defined_value ${ENABLE_${_p_FEATURE}} CACHE INTERNAL "" FORCE ) endif() endif() # The project/user-provided specific of the feature value is used to set the value of # ENABLE_ in the current project. set ( ENABLE_${_p_FEATURE} ${${PROJECT_NAME}_ENABLE_${_p_FEATURE}_defined_value} ) if( ENABLE_${_p_FEATURE} MATCHES "REQUIRE" ) # # User explicitly marked the feature as REQUIREd # ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} was required") set( ENABLE_${_p_FEATURE} ON CACHE BOOL "" FORCE ) set( ${_p_FEATURE}_user_provided_input 1 CACHE INTERNAL "" FORCE ) elseif( NOT ENABLE_${_p_FEATURE} STREQUAL "" AND _in_cache ) # # User explicitly defined the value of the feature # The user can set feature to either ON or OFF; and this is cached so it doesn't revert back to the default # ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} was found in cache, updating to ENABLE_${_p_FEATURE}=${ENABLE_${_p_FEATURE}}") set( ENABLE_${_p_FEATURE} ${ENABLE_${_p_FEATURE}} CACHE BOOL "" FORCE ) set( ${_p_FEATURE}_user_provided_input 1 CACHE INTERNAL "" FORCE ) else() # # No user explicit value provided; the default value is used # ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} not found in cache") set( ${_p_FEATURE}_user_provided_input 0 CACHE INTERNAL "" ) endif() # define the option -- for cmake GUI option( ENABLE_${_p_FEATURE} "${_p_DESCRIPTION}" ${ENABLE_${_p_FEATURE}} ) ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defining option ENABLE_${_p_FEATURE} '${_p_DESCRIPTION}' ${_p_DEFAULT}") ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE}=${ENABLE_${_p_FEATURE}}") # Allow override of ENABLE_ with _ENABLE_ (see ECBUILD-486) if( DEFINED ${PNAME}_ENABLE_${_p_FEATURE} ) ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): found ${PNAME}_ENABLE_${_p_FEATURE}=${${PNAME}_ENABLE_${_p_FEATURE}}") # Cache it for future reconfiguration set( ${PNAME}_ENABLE_${_p_FEATURE} ${${PNAME}_ENABLE_${_p_FEATURE}} CACHE BOOL "Override for ENABLE_${_p_FEATURE}" ) # Warn when user provides both ENABLE_ and _ENABLE_, and explain precedence if( ${_p_FEATURE}_user_provided_input ) ecbuild_warn( "Both ENABLE_${_p_FEATURE} and ${PNAME}_ENABLE_${_p_FEATURE} are set for feature ${_p_FEATURE}." "Using ${PNAME}_ENABLE_${_p_FEATURE}=${${PNAME}_ENABLE_${_p_FEATURE}}" ) endif() # Non-cache (hard) override of ENABLE_ within this project scope only set( ENABLE_${_p_FEATURE} ${${PNAME}_ENABLE_${_p_FEATURE}} ) ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): set ENABLE_${_p_FEATURE} from ${PNAME}_ENABLE_${_p_FEATURE}") ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE}=${ENABLE_${_p_FEATURE}}") endif() ## Update the description of the feature summary # Choose the correct tick if (ENABLE_${_p_FEATURE}) set ( _tick "ON") else() set ( _tick "OFF") endif() set(_enabled "${ENABLE_${_p_FEATURE}}") get_property( _enabled_features GLOBAL PROPERTY ENABLED_FEATURES ) if( "${_p_FEATURE}" IN_LIST _enabled_features ) set(_enabled ON) endif() set( ${PROJECT_NAME}_HAVE_${_p_FEATURE} 0 ) if( ENABLE_${_p_FEATURE} ) ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): feature requested to be enabled") set( ${PROJECT_NAME}_HAVE_${_p_FEATURE} 1 ) if( _${_p_FEATURE}_condition ) ### search for dependent packages set( _failed_to_find_packages ) # clear variable foreach( pkg ${_p_REQUIRED_PACKAGES} ) ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for dependent package ${pkg}") string(REPLACE " " ";" pkglist ${pkg}) # string to list list(GET pkglist 0 pkgfirst) if( ECBUILD_2_COMPAT ) if( pkgfirst STREQUAL "PROJECT" ) if( ECBUILD_2_COMPAT_DEPRECATE ) ecbuild_deprecate("Arguments to ecbuild_add_option(REQUIRED_PACKAGES) " "should be valid arguments for ecbuild_find_package") endif() list(GET pkglist 1 pkgname) elseif( pkgfirst STREQUAL "NAME" ) list(GET pkglist 1 pkgname) else() set(pkgname ${pkgfirst}) endif() if(${_p_NO_TPL}) set(_no_tpl NO_TPL) else() set(_no_tpl) endif() ecbuild_compat_require(pkgname ${pkg} ${_no_tpl} FEATURE "${_p_FEATURE}" DESCRIPTION "${_p_DESCRIPTION}") elseif( pkgfirst STREQUAL "NAME" ) list(GET pkglist 1 pkgname) ecbuild_find_package(${pkglist}) else() set(pkgname ${pkgfirst}) ecbuild_find_package(${pkglist}) endif() # we have feature if all required packages were FOUND if( ${pkgname}_FOUND ) ecbuild_info( "Found package ${pkgname} required for feature ${_p_FEATURE}" ) else() ecbuild_info( "Could NOT find package ${pkgname} required for feature ${_p_FEATURE} -- ${${pkgname}_HELP_MSG}" ) set( ${PROJECT_NAME}_HAVE_${_p_FEATURE} 0 ) list( APPEND _failed_to_find_packages ${pkgname} ) endif() endforeach() else( _${_p_FEATURE}_condition ) set( ${PROJECT_NAME}_HAVE_${_p_FEATURE} 0 ) endif( _${_p_FEATURE}_condition ) # FINAL CHECK if( ${PROJECT_NAME}_HAVE_${_p_FEATURE} ) ecbuild_enable_feature( ${_p_FEATURE} ) ecbuild_info( "Feature ${_p_FEATURE} enabled" ) else() # if user provided input and we cannot satisfy FAIL otherwise WARN ecbuild_disable_unused_feature( ${_p_FEATURE} ) # Determine if a project-specific feature was requested set ( _project_specific_feature_requested OFF ) if (DEFINED ${PNAME}_ENABLE_${_p_FEATURE} AND ${PNAME}_ENABLE_${_p_FEATURE} MATCHES "[Oo][Nn]") set ( _project_specific_feature_requested ON ) endif() if( ${_p_FEATURE}_user_provided_input OR _project_specific_feature_requested ) if( NOT _${_p_FEATURE}_condition ) string(REPLACE ";" " " _condition_msg "${_p_CONDITION}") ecbuild_critical( "Feature ${_p_FEATURE} cannot be enabled -- following condition was not met: ${_condition_msg}" ) set ( _tick "OFF") else() ecbuild_critical( "Feature ${_p_FEATURE} cannot be enabled -- following required packages weren't found: ${_failed_to_find_packages}" ) set ( _tick "OFF") endif() else() if( NOT _${_p_FEATURE}_condition ) string(REPLACE ";" " " _condition_msg "${_p_CONDITION}") ecbuild_info( "Feature ${_p_FEATURE} was not enabled (also not requested) -- following condition was not met: ${_condition_msg}" ) set ( _tick "OFF") else() ecbuild_info( "Feature ${_p_FEATURE} was not enabled (also not requested) -- following required packages weren't found: ${_failed_to_find_packages}" ) set ( _tick "OFF") endif() set( ENABLE_${_p_FEATURE} OFF ) ecbuild_disable_unused_feature( ${_p_FEATURE} ) endif() endif() else() ecbuild_info( "Feature ${_p_FEATURE} disabled" ) set( ${PROJECT_NAME}_HAVE_${_p_FEATURE} 0 ) ecbuild_disable_unused_feature( ${_p_FEATURE} ) endif() # Retrieve any existing description (n.b. occurs when the same feature is added at multiple projects) set(_enabled "${ENABLE_${_p_FEATURE}}") get_property( _feature_desc GLOBAL PROPERTY _CMAKE_${_p_FEATURE}_DESCRIPTION ) # Append the new description if( _feature_desc ) add_feature_info( ${_p_FEATURE} ${_enabled} "${_feature_desc}, ${PROJECT_NAME}(${_tick}): '${_p_DESCRIPTION}'" ) else() add_feature_info( ${_p_FEATURE} ${_enabled} "${PROJECT_NAME}(${_tick}): '${_p_DESCRIPTION}'" ) endif() if( ${_p_ADVANCED} ) mark_as_advanced( ENABLE_${_p_FEATURE} ) endif() set( HAVE_${_p_FEATURE} ${${PROJECT_NAME}_HAVE_${_p_FEATURE}} ) if(ECBUILD_2_COMPAT) set(ENABLE_${_p_FEATURE} ${ENABLE_${_p_FEATURE}}) ecbuild_mark_compat(ENABLE_${_p_FEATURE} "HAVE_${_p_FEATURE} or ${PROJECT_NAME}_HAVE_${_p_FEATURE}") string( TOUPPER ${PROJECT_NAME} PROJECT_NAME_CAPS ) if (NOT "${PROJECT_NAME_CAPS}" STREQUAL "${PROJECT_NAME}") ecbuild_declare_compat( ${PROJECT_NAME_CAPS}_HAVE_${_p_FEATURE} ${PROJECT_NAME}_HAVE_${_p_FEATURE}) endif() endif() if( ECBUILD_2_COMPAT ) set( DISABLE_ECBUILD_DEPRECATION_WARNINGS ${DISABLE_ECBUILD_DEPRECATION_WARNINGS_orig} ) endif() endmacro( ecbuild_add_option ) ecbuild-3.14.1/cmake/ecbuild_git.cmake0000664000175000017500000002222215200367620017730 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. set( ECBUILD_GIT ON CACHE BOOL "Turn on/off ecbuild_git() function" ) mark_as_advanced(ECBUILD_GIT) if( ECBUILD_GIT ) find_package(Git) endif() ############################################################################## #.rst: # # ecbuild_git # =========== # # Manages an external Git repository. :: # # ecbuild_git( PROJECT # DIR # URL # [ BRANCH | TAG ] # [ UPDATE | NOREMOTE ] # [ MANUAL ] # [ RECURSIVE ] ) # # Options # ------- # # PROJECT : required # project name for the Git repository to be managed # # DIR : required # directory to clone the repository into (can be relative) # # URL : required # Git URL of the remote repository to clone (see ``git help clone``) # # BRANCH : optional, cannot be combined with TAG # Git branch to check out # # TAG : optional, cannot be combined with BRANCH # Git tag or commit id to check out # # UPDATE : optional, requires BRANCH, cannot be combined with NOREMOTE # Create a CMake target update to fetch changes from the remote repository # # NOREMOTE : optional, cannot be combined with UPDATE # Do not fetch changes from the remote repository # # MANUAL : optional # Do not automatically switch branches or tags # # RECURSIVE : optional # Do a recursive fetch or update # ############################################################################## function( ecbuild_git ) set( options UPDATE NOREMOTE MANUAL RECURSIVE ) set( single_value_args PROJECT DIR URL TAG BRANCH ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if( DEFINED _PAR_BRANCH AND DEFINED _PAR_TAG ) ecbuild_critical( "Cannot defined both BRANCH and TAG in macro ecbuild_git" ) endif() if( _PAR_UPDATE AND _PAR_NOREMOTE ) ecbuild_critical( "Cannot pass both NOREMOTE and UPDATE in macro ecbuild_git" ) endif() if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_git(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( ECBUILD_GIT ) set( _needs_switch 0 ) get_filename_component( ABS_PAR_DIR "${_PAR_DIR}" ABSOLUTE ) get_filename_component( PARENT_DIR "${_PAR_DIR}/.." ABSOLUTE ) ### skip if direcory exists but is not a git repo if( EXISTS "${_PAR_DIR}" AND IS_DIRECTORY "${_PAR_DIR}" AND NOT IS_DIRECTORY "${_PAR_DIR}/.git" ) ecbuild_info("Found source directory ${_PAR_DIR}. Not a GIT repo -- skipping git operations") return() endif() ### clone if no directory if( NOT EXISTS "${_PAR_DIR}" ) ecbuild_info( "Cloning ${_PAR_PROJECT} from ${_PAR_URL} into ${_PAR_DIR}...") execute_process( COMMAND ${GIT_EXECUTABLE} "clone" ${_PAR_URL} ${clone_args} ${_PAR_DIR} "-q" RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${PARENT_DIR}") if(nok) ecbuild_critical("${_PAR_DIR} git clone failed:\n ${GIT_EXECUTABLE} clone ${_PAR_URL} ${clone_args} ${_PAR_DIR} -q\n ${error}\n") endif() ecbuild_info( "${_PAR_DIR} retrieved.") set( _needs_switch 1 ) endif() ### check current tag and sha1 if( IS_DIRECTORY "${_PAR_DIR}/.git" ) execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse HEAD OUTPUT_VARIABLE _sha1 RESULT_VARIABLE nok ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${ABS_PAR_DIR}" ) if(nok) ecbuild_info("git rev-parse HEAD on ${_PAR_DIR} failed:\n ${error}") endif() execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE _current_branch RESULT_VARIABLE nok ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${ABS_PAR_DIR}" ) if( nok OR _current_branch STREQUAL "" ) ecbuild_info("git rev-parse --abbrev-ref HEAD on ${_PAR_DIR} failed:\n ${error}") endif() execute_process( COMMAND ${GIT_EXECUTABLE} describe --exact-match --abbrev=0 OUTPUT_VARIABLE _current_tag RESULT_VARIABLE nok ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${ABS_PAR_DIR}" ) if( error MATCHES "no tag exactly matches" OR error MATCHES "No names found" ) unset( _current_tag ) else() if( nok ) ecbuild_info("git describe --exact-match --abbrev=0 on ${_PAR_DIR} failed:\n ${error}") endif() endif() if( NOT _current_tag ) # try nother method execute_process( COMMAND ${GIT_EXECUTABLE} name-rev --tags --name-only ${_sha1} OUTPUT_VARIABLE _current_tag RESULT_VARIABLE nok ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${ABS_PAR_DIR}" ) if( nok OR _current_tag STREQUAL "" ) ecbuild_info("git name-rev --tags --name-only on ${_PAR_DIR} failed:\n ${error}") endif() endif() endif() if( NOT _PAR_MANUAL AND DEFINED _PAR_BRANCH AND NOT "${_current_branch}" STREQUAL "${_PAR_BRANCH}" ) set( _needs_switch 1 ) endif() if( NOT _PAR_MANUAL AND DEFINED _PAR_TAG AND NOT "${_current_tag}" STREQUAL "${_PAR_TAG}" ) set( _needs_switch 1 ) endif() if( DEFINED _PAR_BRANCH AND _PAR_UPDATE AND NOT _PAR_NOREMOTE ) add_custom_target( git_update_${_PAR_PROJECT} COMMAND "${GIT_EXECUTABLE}" pull -q WORKING_DIRECTORY "${ABS_PAR_DIR}" COMMENT "git pull of branch ${_PAR_BRANCH} on ${_PAR_DIR}" ) set( git_update_targets "git_update_${_PAR_PROJECT};${git_update_targets}" PARENT_SCOPE ) endif() ### updates if( _needs_switch AND IS_DIRECTORY "${_PAR_DIR}/.git" ) if( DEFINED _PAR_BRANCH ) set ( _gitref ${_PAR_BRANCH} ) ecbuild_info("Updating ${_PAR_PROJECT} to head of BRANCH ${_PAR_BRANCH}...") else() ecbuild_info("Updating ${_PAR_PROJECT} to TAG ${_PAR_TAG}...") set ( _gitref ${_PAR_TAG} ) endif() # fetching latest tags and branches if( NOT _PAR_NOREMOTE ) ecbuild_info("git fetch --all @ ${ABS_PAR_DIR}") execute_process( COMMAND "${GIT_EXECUTABLE}" fetch --all -q RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${ABS_PAR_DIR}") if(nok) ecbuild_warn("git fetch --all in ${_PAR_DIR} failed:\n ${error}") endif() ecbuild_info("git fetch --all --tags @ ${ABS_PAR_DIR}") execute_process( COMMAND "${GIT_EXECUTABLE}" fetch --all --tags -q RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${ABS_PAR_DIR}") if(nok) ecbuild_warn("git fetch --all --tags in ${_PAR_DIR} failed:\n ${error}") endif() else() ecbuild_info("${_PAR_DIR} marked NOREMOTE : Skipping git fetch") endif() # checking out gitref ecbuild_info("git checkout ${_gitref} @ ${ABS_PAR_DIR}") execute_process( COMMAND "${GIT_EXECUTABLE}" checkout -q "${_gitref}" RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${ABS_PAR_DIR}") if(nok) ecbuild_critical("git checkout ${_gitref} on ${_PAR_DIR} failed:\n ${GIT_EXECUTABLE} checkout -q ${_gitref}\n ${error}") endif() if( DEFINED _PAR_BRANCH AND _PAR_UPDATE ) ############################################################################# # Use git pull --ff-only, we WANT this to fail on upstream rebase and # we DON'T want merge commits here! execute_process( COMMAND "${GIT_EXECUTABLE}" pull -q --ff-only RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${ABS_PAR_DIR}") if(nok) ecbuild_critical("git pull of branch ${_PAR_BRANCH} on ${_PAR_DIR} failed:\n ${error}") endif() endif() #################################################################################### if( _PAR_RECURSIVE ) ecbuild_info("git submodule --quiet update --init --recursive @ ${ABS_PAR_DIR}") execute_process( COMMAND "${GIT_EXECUTABLE}" submodule --quiet update --init --recursive RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${ABS_PAR_DIR}") if(nok) ecbuild_critical("git submodule update --init --recursive in ${_PAR_DIR} failed:\n ${error}") endif() endif() endif( _needs_switch AND IS_DIRECTORY "${_PAR_DIR}/.git" ) endif( ECBUILD_GIT ) endfunction() ecbuild-3.14.1/cmake/ecbuild_log.cmake0000664000175000017500000002370215200367620017732 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## #.rst: # # Logging # ======= # # ecBuild provides functions for logging based on a log level set by the user, # similar to the Python logging module: # # :ecbuild_debug: logs a ``STATUS`` message if log level <= ``DEBUG`` # :ecbuild_info: logs a ``STATUS`` message if log level <= ``INFO`` # :ecbuild_warn: logs a ``WARNING`` message if log level <= ``WARN`` # :ecbuild_error: logs a ``SEND_ERROR`` message if log level <= ``ERROR`` # :ecbuild_critical: logs a ``FATAL_ERROR`` message if log level <= ``CRITICAL`` # :ecbuild_deprecate: logs a ``DEPRECATION`` message as a warning # enable CMAKE_ERROR_DEPRECATED to raise an error instead # disable CMAKE_WARN_DEPRECATED to hide deprecations # # Furthermore there are auxilliary functions for outputting CMake variables, # CMake lists and environment variables if the log level is ``DEBUG``: # # :ecbuild_debug_var: logs given CMake variables if log level <= ``DEBUG`` # :ecbuild_debug_list: logs given CMake lists if log level <= ``DEBUG`` # :ecbuild_debug_env_var: logs given environment variables if log level <= ``DEBUG`` # :ecbuild_debug_property: logs given global CMake property if log level <= ``DEBUG`` # :ecbuild_warn_var: logs given CMake variables if log level <= ``WARN`` # :ecbuild_warn_list: logs given CMake lists if log level <= ``WARN`` # :ecbuild_warn_env_var: logs given environment variables if log level <= ``WARN`` # :ecbuild_warn_property: logs given global CMake property if log level <= ``WARN`` # # To log a message to the ecBuild log file only at a given log level, use :: # # ecbuild_log( ) # # Input variables # --------------- # # CMake variables controlling logging behaviour: # # ECBUILD_LOG_FILE : path # set the log file, defaults to ``${CMAKE_BINARY_DIR}/ecbuild.log`` # # All ecBuild log functions write their messages to this log file with a time # stamp. Messages emitted by CMake directly cannot be logged to file. # # ECBUILD_LOG_LEVEL : string, one of DEBUG, INFO, WARN, ERROR, CRITICAL, OFF # desired log level, defaults to ``INFO``, ``OFF`` to disable logging # # ECBUILD_NO_COLOUR : bool # if set, does not colour log output (by default log output is coloured) # # Usage # ----- # # The functions ``ecbuild_debug`` and ``ecbuild_info`` can be used to output # messages which are not printed by default. Many ecBuild macros use this # facility to log debugging hints. When debugging a CMake run, users can use # ``-DECBUILD_LOG_LEVEL=DEBUG`` to get detailed diagnostics. # ############################################################################## if( NOT ECBUILD_LOG_INCLUDED ) set( ECBUILD_LOG_INCLUDED TRUE ) # Define colour escape sequences (not available on Windows) if(NOT (WIN32 OR EC_OS_NAME MATCHES "windows" OR ECBUILD_NO_COLOUR OR DEFINED ENV{ECBUILD_NO_COLOUR})) string(ASCII 27 Esc) set(ColourReset "${Esc}[m") set(ColourBold "${Esc}[1m") set(Red "${Esc}[31m") set(Green "${Esc}[32m") set(Yellow "${Esc}[33m") set(Blue "${Esc}[34m") set(Magenta "${Esc}[35m") set(Cyan "${Esc}[36m") set(White "${Esc}[37m") set(BoldRed "${Esc}[1;31m") set(BoldGreen "${Esc}[1;32m") set(BoldYellow "${Esc}[1;33m") set(BoldBlue "${Esc}[1;34m") set(BoldMagenta "${Esc}[1;35m") set(BoldCyan "${Esc}[1;36m") set(BoldWhite "${Esc}[1;37m") endif() set(ECBUILD_DEBUG 10) set(ECBUILD_INFO 20) set(ECBUILD_WARN 30) set(ECBUILD_ERROR 40) set(ECBUILD_CRITICAL 50) if( NOT DEFINED ECBUILD_LOG_LEVEL ) set(ECBUILD_LOG_LEVEL ${ECBUILD_INFO}) elseif( NOT ECBUILD_LOG_LEVEL ) set(ECBUILD_LOG_LEVEL 60) elseif( ECBUILD_LOG_LEVEL STREQUAL "DEBUG" ) set(ECBUILD_LOG_LEVEL ${ECBUILD_DEBUG}) elseif( ECBUILD_LOG_LEVEL STREQUAL "INFO" ) set(ECBUILD_LOG_LEVEL ${ECBUILD_INFO}) elseif( ECBUILD_LOG_LEVEL STREQUAL "WARN" ) set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN}) elseif( ECBUILD_LOG_LEVEL STREQUAL "ERROR" ) set(ECBUILD_LOG_LEVEL ${ECBUILD_ERROR}) elseif( ECBUILD_LOG_LEVEL STREQUAL "CRITICAL" ) set(ECBUILD_LOG_LEVEL ${ECBUILD_CRITICAL}) else() message(WARNING "Unknown log level ${ECBUILD_LOG_LEVEL} (valid are DEBUG, INFO, WARN, ERROR, CRITICAL) - using WARN") set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN}) endif() if(DEFINED ENV{ECBUILD_DEBUG}) # environment variable overrides set(ECBUILD_LOG_LEVEL ${ECBUILD_DEBUG}) endif() if( NOT DEFINED ECBUILD_LOG_FILE ) set( ECBUILD_LOG_FILE ${CMAKE_BINARY_DIR}/ecbuild.log ) endif() ############################################################################## function( ecbuild_log LEVEL ) string( REPLACE ";" " " MSG "${ARGN}" ) string( TIMESTAMP _time ) file( APPEND ${ECBUILD_LOG_FILE} "${_time} - ${PROJECT_NAME} - ${LEVEL} - ${MSG}\n" ) endfunction( ecbuild_log ) ############################################################################## function( ecbuild_debug ) string( REPLACE ";" " " MSG "${ARGV}" ) ecbuild_log(DEBUG "${MSG}") if( ECBUILD_LOG_LEVEL LESS 11) message(STATUS "${Blue}DEBUG - ${MSG}${ColourReset}") endif() endfunction( ecbuild_debug ) ############################################################################## function( ecbuild_info ) string( REPLACE ";" " " MSG "${ARGV}" ) ecbuild_log(INFO "${MSG}") if( ECBUILD_LOG_LEVEL LESS 21) message(STATUS "${MSG}") endif() endfunction( ecbuild_info ) ############################################################################## function( ecbuild_warn ) string( REPLACE ";" " " MSG "${ARGV}" ) ecbuild_log(WARNING "${MSG}") if( ECBUILD_LOG_LEVEL LESS 31) message(WARNING "${Yellow}WARN - ${MSG}${ColourReset}") endif() endfunction( ecbuild_warn ) ############################################################################## function( ecbuild_error ) string( REPLACE ";" " " MSG "${ARGV}" ) ecbuild_log(ERROR "${MSG}") if( ECBUILD_LOG_LEVEL LESS 41) message(SEND_ERROR "${BoldRed}ERROR - ${MSG}${ColourReset}") endif() endfunction( ecbuild_error ) ############################################################################## function( ecbuild_deprecate ) string(REPLACE ";" " " MSG ${ARGV}) ecbuild_log(DEPRECATION "${MSG}") message(DEPRECATION "${BoldRed}${MSG}${ColourReset}") endfunction( ecbuild_deprecate ) ############################################################################## function( ecbuild_critical ) string(REPLACE ";" " " MSG ${ARGV}) ecbuild_log(FATAL_ERROR "${MSG}") if( ECBUILD_LOG_LEVEL LESS 51) message(FATAL_ERROR "${BoldMagenta}CRITICAL - ${MSG}${ColourReset}") endif() endfunction( ecbuild_critical ) ############################################################################## # functions for debugging CMake variables function( ecbuild_debug_var ) foreach( VAR ${ARGV} ) ecbuild_log(DEBUG "${VAR} : ${${VAR}}") if( ECBUILD_LOG_LEVEL LESS 11) message(STATUS "${Blue}DEBUG - ${VAR} : ${${VAR}}${ColourReset}") endif() endforeach() endfunction() function( ecbuild_warn_var ) foreach( VAR ${ARGV} ) ecbuild_log(WARNING "${VAR} : ${${VAR}}") if( ECBUILD_LOG_LEVEL LESS 31) message(WARNING "${Yellow}WARN - ${VAR} : ${${VAR}}${ColourReset}") endif() endforeach() endfunction() ############################################################################## # function for debugging CMake lists function( ecbuild_debug_list ) foreach( VAR ${ARGV} ) ecbuild_log(DEBUG "${VAR} : ${${VAR}}") foreach( _elem ${${VAR}} ) ecbuild_log( DEBUG " ${_elem}" ) endforeach() if( ECBUILD_LOG_LEVEL LESS 11) message( STATUS "${Blue}DEBUG - ${VAR}" ) foreach( _elem ${${VAR}} ) message( STATUS " ${_elem}" ) endforeach() message(STATUS "${ColourReset}") endif() endforeach() endfunction() function( ecbuild_warn_list ) foreach( VAR ${ARGV} ) ecbuild_log(WARNING "${VAR} : ${${VAR}}") foreach( _elem ${${VAR}} ) ecbuild_log( WARNING " ${_elem}" ) endforeach() if( ECBUILD_LOG_LEVEL LESS 31) message( STATUS "${Yellow}WARN - ${VAR}" ) foreach( _elem ${${VAR}} ) message( STATUS " ${_elem}" ) endforeach() message(WARNING "${ColourReset}") endif() endforeach() endfunction() ############################################################################## # functions for debugging environment variables function( ecbuild_debug_env_var ) foreach( VAR ${ARGV} ) ecbuild_log(DEBUG "ENV ${VAR} : $ENV{${VAR}}") if( ECBUILD_LOG_LEVEL LESS 11) message(STATUS "${Blue}DEBUG - ENV ${VAR} [$ENV{${VAR}}]${ColourReset}") endif() endforeach() endfunction() function( ecbuild_warn_env_var ) foreach( VAR ${ARGV} ) ecbuild_log(WARNING "ENV ${VAR} : $ENV{${VAR}}") if( ECBUILD_LOG_LEVEL LESS 31) message(WARNING "${Yellow}WARN - ENV ${VAR} [$ENV{${VAR}}]${ColourReset}") endif() endforeach() endfunction() ############################################################################## # functions for debugging a CMake global property function( ecbuild_debug_property ) foreach( VAR ${ARGV} ) get_property( __prop GLOBAL PROPERTY ${VAR} ) ecbuild_log(DEBUG "PROPERTY ${VAR} : ${__prop}") if( ECBUILD_LOG_LEVEL LESS 11) message(STATUS "${Blue}DEBUG - PROPERTY ${VAR} [${__prop}]${ColourReset}") endif() endforeach() endfunction() function( ecbuild_warn_property ) foreach( VAR ${ARGV} ) get_property( __prop GLOBAL PROPERTY ${VAR} ) ecbuild_log(WARN "PROPERTY ${VAR} : ${__prop}") if( ECBUILD_LOG_LEVEL LESS 31) message(WARNING "${Yellow}WARN - PROPERTY ${VAR} [${__prop}]${ColourReset}") endif() endforeach() endfunction() endif() ecbuild-3.14.1/cmake/Findecbuild.cmake0000664000175000017500000000246715200367620017677 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. find_path(ecbuild_MACROS_DIR ecbuild.cmake HINTS ${CMAKE_CURRENT_LIST_DIR} PATH_SUFFIXES cmake share/cmake share/ecbuild/cmake NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) if(ecbuild_MACROS_DIR) include(${ecbuild_MACROS_DIR}/ecbuild_parse_version.cmake) ecbuild_parse_version_file(${ecbuild_MACROS_DIR}/VERSION PREFIX ecbuild) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ecbuild REQUIRED_VARS ecbuild_MACROS_DIR VERSION_VAR ecbuild_VERSION) if(ecbuild_FOUND) include(ecbuild) find_path(ecbuild_DIR ecbuild-config.cmake HINTS ${CMAKE_CURRENT_LIST_DIR}/../ ${CMAKE_CURRENT_LIST_DIR}/../../../ PATH_SUFFIXES lib/cmake/ecbuild lib64/cmake/ecbuild lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/ecbuild NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) endif() ecbuild-3.14.1/cmake/ecbuild_get_resources.cmake0000664000175000017500000000315615200367620022023 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## # macro for adding a test ############################################################################## macro( ecbuild_get_resources ) set( options ) set( single_value_args TO_DIR ) set( multi_value_args LIST ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_get_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_LIST ) ecbuild_critical( "Missing parameter LIST of resources in macro ecbuild_get_resources()" ) endif() if( NOT _PAR_TO_DIR ) set( _PAR_TO_DIR ${CMAKE_CURRENT_BINARY_DIR} ) endif() list( LENGTH _PAR_LIST _rsize ) math( EXPR _max "${_rsize}-1" ) foreach( i RANGE 0 ${_max} 2 ) math( EXPR in "${i}+1" ) list( GET _PAR_LIST ${i} r ) list( GET _PAR_LIST ${in} rh ) # ecbuild_debug_var( r ) # ecbuild_debug_var( rh ) get_filename_component( rf ${r} NAME ) file( DOWNLOAD ${r} ${_PAR_TO_DIR}/${rf} EXPECTED_HASH SHA1=${rh} ) endforeach() endmacro() ecbuild-3.14.1/cmake/ecbuild_find_fortranlibs.cmake0000664000175000017500000001107215200367620022473 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_find_fortranlibs # ======================== # # Find the Fortran (static) link libraries. :: # # ecbuild_find_fortranlibs( [ COMPILER gfortran|pgi|xlf|intel ] # [ REQUIRED ] ) # # Options # ------- # # COMPILER : optional, defaults to gfortran # request a given Fortran compiler (``gfortran``, ``pgi``, ``xlf``, ``intel``) # # REQUIRED : optional # fail if Fortran libraries were not found # ############################################################################## macro( ecbuild_find_fortranlibs ) ecbuild_deprecate( "ecbuild_find_fortranlibs is deprecated and will be removed in an upcoming ecBuild release" ) # parse parameters set( options REQUIRED ) set( single_value_args COMPILER ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_find_fortranlibs(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT FORTRANLIBS_FOUND ) # don't repeat search if( _PAR_COMPILER ) set( __known_fcomp 0 ) endif() if( _PAR_COMPILER MATCHES "gfortran" ) set( WITH_LIBGFORTRAN 1 ) set( __known_fcomp 1 ) endif() if( _PAR_COMPILER MATCHES "pgi" ) set( WITH_PGI_FORTRAN 1 ) set( __known_fcomp 1 ) endif() if( _PAR_COMPILER MATCHES "xlf" ) set( WITH_XL_FORTRAN 1 ) set( __known_fcomp 1 ) endif() if( _PAR_COMPILER MATCHES "intel" ) set( WITH_INTEL_FORTRAN 1 ) set( __known_fcomp 1 ) endif() if( _PAR_COMPILER AND NOT __known_fcomp ) ecbuild_critical( "unknown fortran compiler ${_PAR_COMPILER}" ) endif() ### set path from environment variables foreach( _fortran_lib PGI XLF LIBGFORTRAN INTEL ) if( NOT ${_fortran_lib}_PATH AND NOT "$ENV{${_fortran_lib}_PATH}" STREQUAL "" ) set( ${_fortran_lib}_PATH "$ENV{${_fortran_lib}_PATH}" ) endif() endforeach() set( _flibs_found 0 ) ### default is to search for gfortran if( NOT (WITH_PGI_FORTRAN OR WITH_LIBGFORTRAN OR WITH_XL_FORTRAN OR WITH_INTEL_FORTRAN) AND NOT (DEFINED PGI_PATH OR DEFINED LIBGFORTRAN_PATH OR DEFINED XLF_PATH OR DEFINED INTEL_PATH) ) ecbuild_warn( "Finding fortran libs for unspecified Fortran compiler: default search [ gfortran ]" ) set( WITH_LIBGFORTRAN 1 ) endif() ### actual search ... if( WITH_PGI_FORTRAN OR DEFINED PGI_PATH ) find_package(PGIFortran) if( LIBPGIFORTRAN_FOUND ) set( FORTRAN_LIBRARIES ${PGIFORTRAN_LIBRARIES} ) set( _flibs_found 1 ) set( _flibs_txt "PGI" ) endif() endif() if( WITH_LIBGFORTRAN OR DEFINED LIBGFORTRAN_PATH ) find_package(LibGFortran) if( LIBGFORTRAN_FOUND ) set( FORTRAN_LIBRARIES ${GFORTRAN_LIBRARIES} ) set( _flibs_found 1 ) set( _flibs_txt "gfortran" ) endif() endif() if( WITH_XL_FORTRAN OR DEFINED XLF_PATH ) find_package(XLFortranLibs) if( LIBXLFORTRAN_FOUND ) set( FORTRAN_LIBRARIES ${XLFORTRAN_LIBRARIES} ) set( _flibs_found 1 ) set( _flibs_txt "XLF" ) endif() endif() if( WITH_INTEL_FORTRAN OR DEFINED INTEL_PATH ) find_package(LibIFort) if( LIBIFORT_FOUND ) set( FORTRAN_LIBRARIES ${IFORT_LIBRARIES} ) set( _flibs_found 1 ) set( _flibs_txt "Intel" ) endif() endif() ### set found if( _flibs_found ) set( FORTRANLIBS_FOUND 1 CACHE INTERNAL "Fortran libraries found" ) set( FORTRANLIBS_NAME ${_flibs_txt} CACHE INTERNAL "Fortran library name" ) set( FORTRAN_LIBRARIES ${FORTRAN_LIBRARIES} CACHE INTERNAL "Fortran libraries" ) ecbuild_info( "Found Fortran libraries: ${_flibs_txt}" ) else() set( FORTRANLIBS_FOUND 0 ) if( _PAR_REQUIRED ) ecbuild_critical( "Failed to find Fortran libraries" ) else() ecbuild_warn( "Failed to find Fortran libraries" ) endif() endif() endif( NOT FORTRANLIBS_FOUND ) endmacro( ecbuild_find_fortranlibs ) ecbuild-3.14.1/cmake/ecbuild_parse_version.cmake0000664000175000017500000001131015200367620022020 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_parse_version # ===================== # # Parse version string of the form "[.[.[.]]][]" :: # # ecbuild_parse_version( [ PREFIX ] ) # # Options # ------- # # PREFIX : optional # string to be prefixed to all defined variables. If not given, # the value "_" will be used. # # Notes # ----- # # Following variables if possible: # # _VERSION_STR = [.[.[.]]][] # _VERSION = [.[.[.]]] # _VERSION_MAJOR = # _VERSION_MINOR = # _VERSION_PATCH = # _VERSION_TWEAK = # _VERSION_SUFFIX = # function( ecbuild_parse_version version_str ) set( options ) set( single_value_args PREFIX ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN} ) if( NOT _PAR_PREFIX ) set( prefix "_" ) else() set( prefix ${_PAR_PREFIX} ) endif() ## Parse version_str set( ${prefix}_VERSION_STR "${version_str}" ) string( REGEX REPLACE "^((([0-9]+)\\.)+([0-9]+)).*" "\\1" ${prefix}_VERSION "${version_str}" ) string( LENGTH "${${prefix}_VERSION}" ver_len ) string( SUBSTRING "${version_str}" ${ver_len} -1 ${prefix}_VERSION_SUFFIX ) string( REPLACE "." " " _version_list ${${prefix}_VERSION} ) # dots to spaces separate_arguments( _version_list ) list (LENGTH _version_list _len) if( ${_len} GREATER 0 ) list( GET _version_list 0 ${prefix}_VERSION_MAJOR ) endif() if( ${_len} GREATER 1 ) list( GET _version_list 1 ${prefix}_VERSION_MINOR ) endif() if( ${_len} GREATER 2 ) list( GET _version_list 2 ${prefix}_VERSION_PATCH ) endif() if( ${_len} GREATER 3 ) list( GET _version_list 3 ${prefix}_VERSION_TWEAK ) endif() ## Export variables to parent scope list( APPEND export_variables_parent_scope ${prefix}_VERSION_STR ${prefix}_VERSION ${prefix}_VERSION_MAJOR ${prefix}_VERSION_MINOR ${prefix}_VERSION_PATCH ${prefix}_VERSION_TWEAK ${prefix}_VERSION_SUFFIX ) foreach( _var ${export_variables_parent_scope} ) if( DEFINED ${_var} ) set( ${_var} ${${_var}} PARENT_SCOPE ) endif() endforeach() endfunction() ############################################################################## #.rst: # # ecbuild_parse_version_file # ========================== # # Parse version string of the form "[.[.[.]]][]" # contained in a file :: # # ecbuild_parse_version_file( [ PREFIX ] ) # # Options # ------- # # PREFIX : optional # string to be prefixed to all defined variables. If not given, # the value "_" will be used. # # Notes # ----- # # Following variables if possible: # # _VERSION_STR = [.[.[.]]][] # _VERSION = [.[.[.]]] # _VERSION_MAJOR = # _VERSION_MINOR = # _VERSION_PATCH = # _VERSION_TWEAK = # _VERSION_SUFFIX = # function( ecbuild_parse_version_file file ) set( options ) set( single_value_args PREFIX ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN} ) if( NOT _PAR_PREFIX ) set( prefix "_" ) else() set( prefix ${_PAR_PREFIX} ) endif() if( NOT ( EXISTS ${file} OR EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) ) message( FATAL_ERROR "ecbuild_parse_version_file: Cannot parse file ${file} as it does not exist") endif() ## Read _version_str from file file( STRINGS ${file} _version_str ) ## Parse _version_str ecbuild_parse_version( ${_version_str} PREFIX ${prefix} ) ## Export variables to parent scope list( APPEND export_variables_parent_scope ${prefix}_VERSION_STR ${prefix}_VERSION ${prefix}_VERSION_MAJOR ${prefix}_VERSION_MINOR ${prefix}_VERSION_PATCH ${prefix}_VERSION_TWEAK ${prefix}_VERSION_SUFFIX ) foreach( _var ${export_variables_parent_scope} ) if( ${_var} ) set( ${_var} ${${_var}} PARENT_SCOPE ) endif() endforeach() endfunction() ecbuild-3.14.1/cmake/ecbuild_install_dependency_with_soversion.cmake0000664000175000017500000000453715200367620026164 0ustar alastairalastair# (C) Copyright 2025- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_install_dependency_with_soversion # ========================================= # # Installs a third-party dependency that has been found with find_package. :: # # ecbuild_install_dependency_with_soversion( TARGET ) # # ``TARGET`` is a cmake target with an IMPORTED_LOCATION property # # Use this function to install dependencies that use shared object versioning, # i.e. install as libxx.so -> libxx.so.1 -> libxx.so.1.2.3. In this case we # need to collect soft-links and final shared object. # # If your dependency does NOT use shared object versioning, i.e. only installs # a specific libxx.so, you must use plain CMake to install, e.g. # # Example for non-versioned shared objects:: # # install(FILES $ TYPE LIB) # # Be aware that this only installs the dependency itself, no resolution of # transitive dependencies is applied. Transitive dependencies need to be # installed explicitly wither with ecbuild_install_dependency_with_soversion() # or install(...) # # Typical usage example:: # # if(ENABLE_INSTALL_DEPENDENCIES) # ecbuild_install_dependency_with_soversion(libaec::aec) # endif() # ############################################################################## function(ecbuild_install_dependency_with_soversion _target) get_target_property(_loc ${_target} LOCATION) if(NOT _loc) message(FATAL_ERROR "Could not find LOCATION for target ${_target}") endif() get_filename_component(_dir ${_loc} DIRECTORY) get_filename_component(_name ${_loc} NAME) string(REGEX REPLACE "\\..*$" "" _base_name "${_name}") # Glob for shared libraries with version suffixes file(GLOB _files "${_dir}/${_base_name}*${CMAKE_SHARED_LIBRARY_SUFFIX}*" ) if(_files) install(FILES ${_files} TYPE LIB) else() message(FATAL_ERROR "No shared libraries found to install for target ${_target}") endif() endfunction() ecbuild-3.14.1/cmake/ecbuild_add_large_file_support.cmake0000664000175000017500000000271415200367620023646 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################################ # ensure we use 64bit access to files even on 32bit OS's -- aka Large File Support # by making off_t 64 bit and stat behave as stat64 macro(ecbuild_add_large_file_support) check_type_size( off_t EC_SIZEOF_OFF_T ) if( EC_SIZEOF_OFF_T LESS "8" ) if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "GNU" ) add_definitions( -D_FILE_OFFSET_BITS=64 ) elseif( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" ) add_definitions( -D_LARGE_FILES=64 ) else() ecbuild_warn("ENABLE_LARGE_FILE_SUPPORT active, sizeof off_t is ${EC_SIZEOF_OFF_T} < 8 " "but ecbuild does not know how to enable large files in this operating system") endif() get_directory_property( __compile_defs COMPILE_DEFINITIONS ) if( __compile_defs ) foreach( def ${__compile_defs} ) list( APPEND CMAKE_REQUIRED_DEFINITIONS -D${def} ) endforeach() endif() endif() endmacro(ecbuild_add_large_file_support) ecbuild-3.14.1/cmake/FindJemalloc.cmake0000664000175000017500000000300315200367620020001 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # FindJemalloc # ============ # # Find the Jemalloc library. :: # # find_package( Jemalloc [REQUIRED] [QUIET] ) # # Output variables # ---------------- # # The following CMake variables are set on completion: # # :Jemalloc_FOUND: true if Jemalloc is found on the system # :JEMALLOC_LIBRARIES: full paths to requested Jemalloc libraries # :JEMALLOC_INCLUDE_DIRS: Jemalloc include directory # # Input variables # --------------- # # The following CMake and environment variables are considered: # # :Jemalloc_ROOT: # ############################################################################## find_library( JEMALLOC_LIBRARIES NAMES jemalloc ) find_path( JEMALLOC_INCLUDE_DIRS NAMES jemalloc/jemalloc.h ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIRS ) if( JEMALLOC_LIBRARIES ) get_filename_component( JEMALLOC_LIBRARY_DIR ${JEMALLOC_LIBRARIES} DIRECTORY ) endif() mark_as_advanced( JEMALLOC_INCLUDE_DIRS JEMALLOC_LIBRARIES JEMALLOC_LIBRARY_DIR ) ecbuild-3.14.1/cmake/ecbuild_check_urls.cmake0000664000175000017500000000747415200367620021303 0ustar alastairalastair# (C) Copyright 2020- JCSDA. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. ############################################################################## #.rst: # # ecbuild_check_urls # ====================== # # Check multiple URL validity. :: # # ecbuild_check_urls( NAMES [ ... ] # RESULT ) # # curl or wget is required (curl is preferred if available). # # Options # ------- # # NAMES : required # list of names of the files to check, including the directory structure # on the server hosting test files (if available) # # RESULT : required # check result (0 if all URLs exist, more if not) # # Usage # ----- # # Check whether files exist on ``/`` # for each name given in the list of ``NAMES``. # ``RESULT`` is set to the number of missing files. # # If the ``ECBUILD_DOWNLOAD_BASE_URL`` variable is not set, the default URL # ``https://sites.ecmwf.int/repository`` is used. # # Examples # -------- # # Check file ... existence: :: # # ecbuild_check_urls( NAMES test/data/dir/msl1.grib test/data/dir/msl2.grib # RESULT FILES_EXIST ) # ############################################################################## function(ecbuild_check_urls) set( single_value_args RESULT ) set( multi_value_args NAMES ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_p_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_check_url(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() ### check parameters if( NOT _p_NAMES ) ecbuild_critical("ecbuild_get_test_data() expects a NAMES") endif() # Allow the user to override the download URL (ECBUILD-447) if( NOT DEFINED ECBUILD_DOWNLOAD_BASE_URL ) set( ECBUILD_DOWNLOAD_BASE_URL https://sites.ecmwf.int/repository ) endif() # Do not retry downloads by default (ECBUILD-307) if( NOT DEFINED ECBUILD_DOWNLOAD_RETRIES ) set( ECBUILD_DOWNLOAD_RETRIES 0 ) endif() # Use default timeout of 30s if not specified (ECBUILD-307) if( NOT DEFINED ECBUILD_DOWNLOAD_TIMEOUT ) set( ECBUILD_DOWNLOAD_TIMEOUT 30 ) endif() # Initialise CODE_SUM set( CODE_SUM 0 ) find_program( CURL_PROGRAM curl ) if ( NOT CURL_PROGRAM ) find_program( WGET_PROGRAM wget ) if ( NOT WGET_PROGRAM ) set( CODE 1 ) if( NOT WARNING_CANNOT_DOWNLOAD_TEST_DATA ) ecbuild_warn( "Couldn't find curl neither wget -- cannot check URL, set result to 0." ) set( WARNING_CANNOT_DOWNLOAD_TEST_DATA 1 CACHE INTERNAL "Couldn't find curl neither wget -- cannot check URL, set result to 0" ) mark_as_advanced( WARNING_CANNOT_DOWNLOAD_TEST_DATA ) endif() endif() endif() foreach( NAME ${_p_NAMES} ) if ( CURL_PROGRAM ) execute_process( COMMAND ${CURL_PROGRAM} --silent --head --fail --output /dev/null --retry ${ECBUILD_DOWNLOAD_RETRIES} --connect-timeout ${ECBUILD_DOWNLOAD_TIMEOUT} ${ECBUILD_DOWNLOAD_BASE_URL}/${NAME} RESULT_VARIABLE CODE ) else() math( EXPR ECBUILD_DOWNLOAD_RETRIES "${ECBUILD_DOWNLOAD_RETRIES} + 1" ) execute_process( COMMAND ${WGET_PROGRAM} -O/dev/null -q -t ${ECBUILD_DOWNLOAD_RETRIES} -T ${ECBUILD_DOWNLOAD_TIMEOUT} ${ECBUILD_DOWNLOAD_BASE_URL}/${NAME} RESULT_VARIABLE CODE ) endif() # Add to CODE_SUM if( CODE GREATER 0) math( EXPR CODE_SUM "${CODE_SUM} + 1" ) endif() endforeach() # Set result set( ${_p_RESULT} ${CODE_SUM} PARENT_SCOPE ) endfunction(ecbuild_check_urls) ecbuild-3.14.1/cmake/ecbuild_define_properties.cmake0000664000175000017500000000173115200367620022655 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################################ # define custom properties ############################################################################################ # source properties: # Custom property to determine if compiler flags have been applied yet: define_property( SOURCE PROPERTY CUSTOM_FLAGS BRIEF_DOCS "Custom compiler flags have been applied to source file" FULL_DOCS "Compiler flags have been applied to the source file, using custom CMake rules. Assists processing of sources that are used by multiple targets. Treated as Boolean." ) ecbuild-3.14.1/cmake/ecbuild_find_package_search_hints.cmake0000664000175000017500000001442715200367620024302 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_find_package_search_hints # ================================= # # Detect more search hints and possibly add to _ROOT :: # # ecbuild_find_package_search_hints( NAME ) # # This is called within ecbuild_find_package(). # Alternatively it can be called anywhere before a standard find_package() # # Motivation # ---------- # # Since CMake 3.12 the recommended approach to find_package is via _ROOT # which can be set both as variable or in the environment. # Many environments still need to be adapted to this, as they are set up with the # ecbuild 2 convention _PATH or _PATH. Furthermore this allows compatibility # with _ROOT for CMake versions < 3.12 # # Procedure # --------- # # 1) If neither _ROOT nor _DIR are set in scope: # Try setting _ROOT variable to first valid in list [ _PATH ; _PATH ] # # 2) If 1) was not succesfull and neither _ROOT nor _DIR are set in environment: # Try setting _ROOT variable to first valid in list [ ENV{_PATH} ; ENV{_PATH} ] # # 3) Overcome CMake versions < 3.12 that do not yet recognize _ROOT in scope or environment # If CMake version < 3.12: # If _DIR not defined in scope or environment, but _ROOT IS defined in scope or environment # Try setting _DIR to a valid cmake-dir deduced from _ROOT. # # Warning: Deduction is not feature-complete (it could be improved, but should now cover 99% of cases) # It is advised to use CMake 3.12 instead. # ############################################################################## function( ecbuild_find_package_search_hints ) set( options ) set( single_value_args NAME ) set( multi_value_args ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if( NOT DEFINED _PAR_NAME ) ecbuild_critical( "ecbuild_find_package_search_hints(): NAME argument is missing" ) endif() string( TOUPPER ${_PAR_NAME} pkgUPPER ) unset( _outvar ) unset( _names ) # Diagnose what is there for debugging list( APPEND _names ${_PAR_NAME} ) if( NOT ${pkgUPPER} STREQUAL ${_PAR_NAME} ) list( APPEND _names ${pkgUPPER} ) endif() foreach( _suffix DIR ROOT HOME PATH ROOT_DIR ) foreach( _name ${_names}) if( DEFINED ${_name}_${_suffix} ) list( APPEND _outvar "${_name}_${_suffix}: ${${_name}_${_suffix}}") endif() if( DEFINED ENV{${_name}_${_suffix}} ) list( APPEND _outvar "ENV{${_name}_${_suffix}}: $ENV{${_name}_${_suffix}}") endif() endforeach() endforeach() if( DEFINED CMAKE_PREFIX_PATH ) list( APPEND _outvar "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") endif() if( DEFINED ENV{CMAKE_PREFIX_PATH} ) list( APPEND _outvar "ENV{CMAKE_PREFIX_PATH}: $ENV{CMAKE_PREFIX_PATH}") endif() if( _outvar ) string( REPLACE ";" "\n - " print_this "${_outvar}" ) ecbuild_debug( "ecbuild_find_package_search_hints(${_PAR_NAME}): Detected variables that could influence find_package() :\n - ${print_this}" ) endif() # Only look at older variables _PATH and _PATH if _ROOT and _DIR are not defined in scope if( NOT DEFINED ${_PAR_NAME}_ROOT AND NOT DEFINED ${_PAR_NAME}_DIR ) if( NOT DEFINED ${_PAR_NAME}_ROOT AND DEFINED ${_PAR_NAME}_PATH ) ecbuild_debug("ecbuild_find_package_search_hints(${_PAR_NAME}): Setting ${_PAR_NAME}_ROOT to ${_PAR_NAME}_PATH: ${${_PAR_NAME}_PATH}") set( ${_PAR_NAME}_ROOT ${${_PAR_NAME}_PATH} ) endif() if( NOT DEFINED ${_PAR_NAME}_ROOT AND DEFINED ${pkgUPPER}_PATH ) ecbuild_debug("ecbuild_find_package_search_hints(${_PAR_NAME}): Setting ${_PAR_NAME}_ROOT to ${pkgUPPER}_PATH: ${${pkgUPPER}_PATH}") set( ${_PAR_NAME}_ROOT ${${pkgUPPER}_PATH} ) endif() if( DEFINED ${_PAR_NAME}_ROOT ) set( ${_PAR_NAME}_ROOT ${${_PAR_NAME}_ROOT} PARENT_SCOPE ) endif() endif() # Only look at older variables ENV{_PATH} and ENV{_PATH} if _ROOT and _DIR are not defined in scope or in environment if( NOT DEFINED ${_PAR_NAME}_ROOT AND NOT DEFINED ENV{${_PAR_NAME}_ROOT} AND NOT DEFINED ${_PAR_NAME}_DIR AND NOT DEFINED ENV{${_PAR_NAME}_DIR} ) if( NOT DEFINED ${_PAR_NAME}_ROOT AND DEFINED ENV{${_PAR_NAME}_PATH} ) ecbuild_debug("ecbuild_find_package_search_hints(${_PAR_NAME}): Setting ${_PAR_NAME}_ROOT to ENV{${_PAR_NAME}_PATH}: $ENV{${_PAR_NAME}_PATH}") set( ${_PAR_NAME}_ROOT $ENV{${_PAR_NAME}_PATH} ) endif() if( NOT DEFINED ${_PAR_NAME}_ROOT AND DEFINED ENV{${pkgUPPER}_PATH} ) ecbuild_debug("ecbuild_find_package_search_hints(${_PAR_NAME}): Setting ${_PAR_NAME}_ROOT to ENV{${pkgUPPER}_PATH}: $ENV{${pkgUPPER}_PATH}") set( ${_PAR_NAME}_ROOT $ENV{${pkgUPPER}_PATH} ) endif() if( DEFINED ${_PAR_NAME}_ROOT ) set( ${_PAR_NAME}_ROOT ${${_PAR_NAME}_ROOT} PARENT_SCOPE ) endif() endif() #### Overcome CMake 3.11 to 3.12 transition with _ROOT # warning! this is not fully foolproof! if( CMAKE_VERSION VERSION_LESS 3.12 ) if( ( NOT DEFINED ${_PAR_NAME}_DIR AND NOT DEFINED ENV{${_PAR_NAME}_DIR} ) AND ( DEFINED ${_PAR_NAME}_ROOT OR DEFINED ENV{${_PAR_NAME}_ROOT}} ) ) if( DEFINED ${_PAR_NAME}_ROOT ) set( _root ${_PAR_NAME}_ROOT ) else() set( _root $ENV{${_PAR_NAME}_ROOT} ) endif() foreach( _path_suffix lib/cmake/${_PAR_NAME} share/${_PAR_NAME}/cmake ) if( EXISTS ${_root}/${_path_suffix} ) ecbuild_debug("ecbuild_find_package_search_hints(${_PAR_NAME}): Setting ${_PAR_NAME}_DIR to ${_root}/${_path_suffix}") set( ${_PAR_NAME}_DIR ${_root}/${_path_suffix} PARENT_SCOPE ) break() endif() endforeach() endif() endif() endfunction() ecbuild-3.14.1/cmake/ecbuild_filter_list.cmake0000664000175000017500000000453115200367620021470 0ustar alastairalastair# (C) Copyright 2018- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_filter_list # =================== # # Filters a list for NOTFOUND entries and non existing TARGETS. :: # # ecbuild_filter_list( [INCLUDES] [LIBS] # LIST # [LIST_INCLUDE ] # [LIST_EXCLUDE ]) # # Options # ------- # # INCLUDES : optional # Consider existing dirs as valid # # LIBS : optional # Consider existing targets, files and compile flags as valid # # LIST : required # a list # # LIST_INCLUDE : optional # The output list with all valid entries of LIST # # LIST_EXCLUDE : optional # The output list with all invalid entries of LIST # function(ecbuild_filter_list) set(options INCLUDES LIBS) set(single_value_args LIST_INCLUDE LIST_EXCLUDE) set(multi_value_args LIST) cmake_parse_arguments(_PAR "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN}) set(__listIn ${_PAR_LIST}) set(__listOut) set(__listOutSkip) if(NOT DEFINED ECBUILD_NO_FILTER_DEPS) list(REMOVE_DUPLICATES __listIn) foreach(lib ${__listIn}) if(_PAR_INCLUDES AND IS_DIRECTORY "${lib}") list(APPEND __listOut ${lib}) elseif(_PAR_LIBS AND TARGET "${lib}") list(APPEND __listOut ${lib}) elseif(_PAR_LIBS AND "${lib}" MATCHES "^-") list(APPEND __listOut ${lib}) elseif(_PAR_LIBS AND EXISTS "${lib}") list(APPEND __listOut ${lib}) elseif(lib) list(APPEND __listOut ${lib}) else() list(APPEND __listOutSkip ${lib}) endif() endforeach() else() set(__listOut ${__listIn}) endif() if(_PAR_LIST_INCLUDE) set(${_PAR_LIST_INCLUDE} ${__listOut} PARENT_SCOPE) endif() if(_PAR_LIST_EXCLUDE) set(${_PAR_LIST_EXCLUDE} ${__listOutSkip} PARENT_SCOPE) endif() endfunction() ecbuild-3.14.1/cmake/FindNVPL.cmake0000664000175000017500000000511715200367620017042 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. # - Try to find NVPL # Once done this will define # # NVPL_FOUND - system has Nvidia Performance Libraries # NVPL_INCLUDE_DIRS - the NVPL include directories # NVPL_LIBRARIES - link these to use NVPL # # The following paths will be searched with priority if set in CMake or env # # NVPLROOT - root directory of the NVPL installation # NVPL_PATH - root directory of the NVPL installation # NVPL_ROOT - root directory of the NVPL installation option( NVPL_PARALLEL "if nvpl shoudl be parallel" OFF ) if( NVPL_PARALLEL ) set( __nvpl_lib_suffix "_gomp" ) find_package(Threads) else() set( __nvpl_lib_suffix "_seq" ) endif() # Search with priority for NVPLROOT, NVPL_PATH and NVPL_ROOT if set in CMake or env find_path(NVPL_INCLUDE_DIR nvpl_blas.h PATHS ${NVPLROOT} ${NVPL_PATH} ${NVPL_ROOT} $ENV{NVPLROOT} $ENV{NVPL_PATH} $ENV{NVPL_ROOT} PATH_SUFFIXES include NO_DEFAULT_PATH) find_path(NVPL_INCLUDE_DIR_FFTW fftw3.h PATH_SUFFIXES include/nvpl_fftw) if( NVPL_INCLUDE_DIR ) # use include dir to find libs set( NVPL_INCLUDE_DIRS ${NVPL_INCLUDE_DIR} ${NVPL_INCLUDE_DIR_FFTW} ) # set(CMAKE_FIND_DEBUG_MODE TRUE) find_library( NVPL_LIB_BLAS_CORE PATHS ${NVPLROOT} ${NVPL_PATH} ${NVPL_ROOT} $ENV{NVPLROOT} $ENV{NVPL_PATH} $ENV{NVPL_ROOT} PATH_SUFFIXES "lib" NAMES nvpl_blas_core ) find_library( NVPL_LIB_BLAS PATHS ${NVPLROOT} ${NVPL_PATH} ${NVPL_ROOT} $ENV{NVPLROOT} $ENV{NVPL_PATH} $ENV{NVPL_ROOT} PATH_SUFFIXES "lib" NAMES nvpl_blas_lp64${__nvpl_lib_suffix} ) find_library( NVPL_LIB_FFTW PATHS ${NVPLROOT} ${NVPL_PATH} ${NVPL_ROOT} $ENV{NVPLROOT} $ENV{NVPL_PATH} $ENV{NVPL_ROOT} PATH_SUFFIXES "lib" NAMES nvpl_fftw ) # set(CMAKE_FIND_DEBUG_MODE FALSE) if( NVPL_LIB_BLAS_CORE AND NVPL_LIB_BLAS AND NVPL_LIB_FFTW ) set( NVPL_LIBRARIES ${NVPL_LIB_BLAS_CORE} ${NVPL_LIB_BLAS} ${NVPL_LIB_FFTW} ) endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args( NVPL DEFAULT_MSG NVPL_LIBRARIES NVPL_INCLUDE_DIRS ) mark_as_advanced( NVPL_INCLUDE_DIR NVPL_LIB_BLAS NVPL_LIB_FFTW ) ecbuild-3.14.1/cmake/ecbuild_test_endiness.cmake0000664000175000017500000000160015200367620022011 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################################ # check endiness function(ecbuild_test_endiness) test_big_endian( _BIG_ENDIAN ) if( _BIG_ENDIAN ) set( EC_BIG_ENDIAN 1 ) set( EC_LITTLE_ENDIAN 0 ) else() set( EC_BIG_ENDIAN 0 ) set( EC_LITTLE_ENDIAN 1 ) endif() set( EC_BIG_ENDIAN ${EC_BIG_ENDIAN} PARENT_SCOPE ) set( EC_LITTLE_ENDIAN ${EC_LITTLE_ENDIAN} PARENT_SCOPE ) endfunction(ecbuild_test_endiness) ecbuild-3.14.1/cmake/ecbuild_append_to_rpath.cmake0000664000175000017500000000706015200367620022317 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_append_to_rpath # ======================= # # Append paths to the rpath. :: # # ecbuild_append_to_rpath( RPATH_DIRS ) # # ``RPATH_DIRS`` is a list of directories to append to ``CMAKE_INSTALL_RPATH``. # # * If a directory is absolute, simply append it. # * If a directory is relative, build a platform-dependent relative path # (using ``@loader_path`` on Mac OSX, ``$ORIGIN`` on Linux and Solaris) # or fall back to making it absolute by prepending the install prefix. # ############################################################################## function( ecbuild_path_append var path ) list( FIND ${var} ${path} _found ) if( _found EQUAL "-1" ) list( APPEND ${var} ${path}) endif() set( ${var} "${${var}}" PARENT_SCOPE ) # endfunction() function( _make_relative_rpath_entry entry var ) if( EC_OS_NAME STREQUAL "macosx" ) set( ${var} "@loader_path/${entry}" PARENT_SCOPE ) elseif( EC_OS_NAME STREQUAL "freebsd" ) set( ${var} "$ORIGIN/${entry}" PARENT_SCOPE ) elseif( EC_OS_NAME STREQUAL "linux" ) set( ${var} "$ORIGIN/${entry}" PARENT_SCOPE ) elseif( EC_OS_NAME STREQUAL "solaris" ) set( ${var} "$ORIGIN/${entry}" PARENT_SCOPE ) elseif( EC_OS_NAME STREQUAL "aix" ) # always relative to executable path set( ${var} "${entry}" PARENT_SCOPE ) elseif( EC_OS_NAME STREQUAL "hurd" ) set( ${var} "$ORIGIN/${entry}" PARENT_SCOPE ) else() set( ${var} "${CMAKE_INSTALL_PREFIX}/${entry}" PARENT_SCOPE ) endif() endfunction() macro( ecbuild_append_to_rpath RPATH_DIRS ) if( NOT ${ARGC} EQUAL 1 ) ecbuild_error( "ecbuild_append_to_rpath takes 1 argument") endif() foreach( RPATH_DIR ${RPATH_DIRS} ) if( NOT ${RPATH_DIR} STREQUAL "" ) file( TO_CMAKE_PATH ${RPATH_DIR} RPATH_DIR ) # sanitize the path if( IS_ABSOLUTE ${RPATH_DIR} ) ecbuild_path_append( CMAKE_INSTALL_RPATH "${RPATH_DIR}" ) else() _make_relative_rpath_entry( "${RPATH_DIR}" rpath_dir_rel ) ecbuild_path_append( CMAKE_INSTALL_RPATH ${rpath_dir_rel} ) endif() endif() endforeach() endmacro( ecbuild_append_to_rpath ) macro( ecbuild_target_rpath target mode ) if( "${mode}" STREQUAL REPLACE ) set( _target_rpath "" ) elseif( "${mode}" STREQUAL APPEND ) get_target_property( _target_rpath ${target} INSTALL_RPATH ) else() ecbuild_critical( "ecbuild_target_rpath arg 2 should be either APPEND \ or REPLACE" ) endif() foreach( rpath_dir ${ARGN} ) if( NOT ${rpath_dir} STREQUAL "" ) file( TO_CMAKE_PATH ${rpath_dir} rpath_dir ) # sanitise the path if( IS_ABSOLUTE ${rpath_dir} ) ecbuild_path_append( _target_rpath "${rpath_dir}" ) else() _make_relative_rpath_entry( "${rpath_dir}" rpath_dir_rel ) ecbuild_path_append( _target_rpath ${rpath_dir_rel} ) endif() endif() endforeach() set_target_properties( ${target} PROPERTIES INSTALL_RPATH "${_target_rpath}" ) endmacro() ecbuild-3.14.1/cmake/ecbuild_features.cmake0000664000175000017500000000442715200367620020772 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. # Internal macros to handle CMake features include( FeatureSummary ) # Write list of enabled features to CMake variable ${OUT} macro( ecbuild_enabled_features OUT ) get_property( ${OUT} GLOBAL PROPERTY ENABLED_FEATURES ) endmacro() # Write list of disabled features to CMake variable ${OUT} macro( ecbuild_disabled_features OUT ) get_property( ${OUT} GLOBAL PROPERTY DISABLED_FEATURES ) endmacro() # Enable the feature ${_name} (add to enabled features, remove from disabled) function( ecbuild_enable_feature _name ) get_property( _enabled_features GLOBAL PROPERTY ENABLED_FEATURES ) get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES ) if( _disabled_features ) list( REMOVE_ITEM _disabled_features ${_name} ) endif() list( APPEND _enabled_features ${_name} ) list( REMOVE_DUPLICATES _enabled_features ) set_property(GLOBAL PROPERTY ENABLED_FEATURES "${_enabled_features}" ) set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" ) endfunction() # Disable the feature ${_name} (add to disabled features, remove from enabled) function( ecbuild_disable_feature _name ) get_property( _enabled_features GLOBAL PROPERTY ENABLED_FEATURES ) get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES ) if( _enabled_features ) list( REMOVE_ITEM _enabled_features ${_name} ) endif() list( APPEND _disabled_features ${_name} ) list( REMOVE_DUPLICATES _disabled_features ) set_property(GLOBAL PROPERTY ENABLED_FEATURES "${_enabled_features}" ) set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" ) endfunction() # Disable the feature ${_name} globally (if it has not been enabled in any subproject) function( ecbuild_disable_unused_feature _name ) get_property( _enabled GLOBAL PROPERTY ENABLED_FEATURES ) if ( _name IN_LIST _enabled ) # if not already disabled ecbuild_disable_feature( ${_name} ) endif() endfunction() ecbuild-3.14.1/cmake/ecbuild_try_run.cmake0000664000175000017500000001767015200367620020662 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_try_run # =============== # # Try compiling and then running some code. :: # # ecbuild_try_run( # # [ CMAKE_FLAGS [ ... ] ] # [ COMPILE_DEFINITIONS [ ... ] ] # [ LINK_LIBRARIES [ ... ] ] # [ COMPILE_OUTPUT_VARIABLE ] # [ RUN_OUTPUT_VARIABLE ] # [ OUTPUT_VARIABLE ] # [ ARGS [ ... ] ] ) # # Try compiling a ````. Returns ``TRUE`` or ``FALSE`` for success # or failure in ````. If the compile succeeded, runs the # executable and returns its exit code in ````. If the # executable was built, but failed to run, then ```` will be # set to ``FAILED_TO_RUN``. See the CMake ``try_compile`` command for # information on how the test project is constructed to build the source file. # # Options # ------- # # CMAKE_FLAGS : optional # Specify flags of the form ``-DVAR:TYPE=VALUE`` to be passed to # the ``cmake`` command-line used to drive the test build. # # The example in CMake's ``try_compile`` shows how values for variables # ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``, and ``LINK_LIBRARIES`` # are used. # # COMPILE_DEFINITIONS : optional # Specify ``-Ddefinition`` arguments to pass to ``add_definitions`` # in the generated test project. # # COMPILE_OUTPUT_VARIABLE : optional # Report the compile step build output in a given variable. # # LINK_LIBRARIES : optional # Specify libraries to be linked in the generated project. # The list of libraries may refer to system libraries and to # Imported Targets from the calling project. # # If this option is specified, any ``-DLINK_LIBRARIES=...`` value # given to the ``CMAKE_FLAGS`` option will be ignored. # # OUTPUT_VARIABLE : optional # Report the compile build output and the output from running the executable # in the given variable. This option exists for legacy reasons. Prefer # ``COMPILE_OUTPUT_VARIABLE`` and ``RUN_OUTPUT_VARIABLE`` instead. # # RUN_OUTPUT_VARIABLE : optional # Report the output from running the executable in a given variable. # # Other Behavior Settings # ----------------------- # # Set the ``CMAKE_TRY_COMPILE_CONFIGURATION`` variable to choose # a build configuration. # # Behavior when Cross Compiling # ----------------------------- # # When cross compiling, the executable compiled in the first step # usually cannot be run on the build host. The ``try_run`` command checks # the ``CMAKE_CROSSCOMPILING`` variable to detect whether CMake is in # cross-compiling mode. If that is the case, it will still try to compile # the executable, but it will not try to run the executable unless the # ``CMAKE_CROSSCOMPILING_EMULATOR`` variable is set. Instead it will create # cache variables which must be filled by the user or by presetting them in # some CMake script file to the values the executable would have produced if # it had been run on its actual target platform. These cache entries are: # # ```` # Exit code if the executable were to be run on the target platform. # # ``__TRYRUN_OUTPUT`` # Output from stdout and stderr if the executable were to be run on # the target platform. This is created only if the # ``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` option was used. # # In order to make cross compiling your project easier, use ``try_run`` # only if really required. If you use ``try_run``, use the # ``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` options only if really # required. Using them will require that when cross-compiling, the cache # variables will have to be set manually to the output of the executable. # You can also "guard" the calls to ``try_run`` with an ``if`` block checking # the ``CMAKE_CROSSCOMPILING`` variable and provide an easy-to-preset # alternative for this case. # ############################################################################## # This is an API compatible version of try_run which ignores output on stderr function( ecbuild_try_run RUN_RESULT_VAR COMPILE_RESULT_VAR BINDIR SRCFILE ) set( options ) set( single_value_args COMPILE_OUTPUT_VARIABLE RUN_OUTPUT_VARIABLE OUTPUT_VARIABLE ) set( multi_value_args CMAKE_FLAGS COMPILE_DEFINITIONS LINK_LIBRARIES ARGS ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if( _p_UNPARSED_ARGUMENTS ) ecbuild_critical("Unknown keywords given to ecbuild_try_run(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() if( CMAKE_EXE_LINKER_FLAGS ) set( _p_LINK_LIBRARIES "${_p_LINK_LIBRARIES} ${CMAKE_EXE_LINKER_FLAGS}" ) endif() # Build argument list for try_compile set( _opts "" ) foreach( _opt CMAKE_FLAGS COMPILE_DEFINITIONS LINK_LIBRARIES ) if( _p_${_opt} ) list( APPEND _opts ${_opt} "${_p_${_opt}}" ) endif() endforeach() ecbuild_debug( "ecbuild_try_run: Compiling ${SRCFILE} in ${BINDIR}" ) try_compile( _compile_res ${BINDIR} ${SRCFILE} OUTPUT_VARIABLE _compile_out COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SRCFILE}.bin COPY_FILE_ERROR _compile_err ${_opts} ) if( _compile_out ) ecbuild_debug( "ecbuild_try_run: compilation output" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "\n${_compile_out}" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ) endif() if( _compile_err ) ecbuild_debug( "ecbuild_try_run: compilation errors" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "\n${_compile_err}" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ) endif() # FIXME: how do we handle cross compilation mode? (CMAKE_CROSSCOMPILING) if( _compile_res ) ecbuild_debug( "ecbuild_try_run: Running ${CMAKE_CURRENT_BINARY_DIR}/${SRCFILE}.bin in ${BINDIR}" ) execute_process( COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${SRCFILE}.bin WORKING_DIRECTORY ${BINDIR} RESULT_VARIABLE _run_res OUTPUT_VARIABLE _run_out ERROR_VARIABLE _run_err ) if( _p_RUN_OUTPUT_VARIABLE ) set( ${_p_RUN_OUTPUT_VARIABLE} ${_run_out} ) endif() if( _run_out ) ecbuild_debug( "ecbuild_try_run: run output" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "\n${_run_out}" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ) endif() if( _run_err ) ecbuild_debug( "ecbuild_try_run: run errors" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "\n${_run_err}" "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ) endif() else() set( ${RUN_RESULT_VAR} "FAILED_TO_RUN" PARENT_SCOPE ) ecbuild_debug( "ecbuild_try_run: Compilation of ${SRCFILE} in ${BINDIR} failed!" ) endif() set( ${COMPILE_RESULT_VAR} ${_compile_res} PARENT_SCOPE ) set( ${RUN_RESULT_VAR} ${_run_res} PARENT_SCOPE ) if( _p_COMPILE_OUTPUT_VARIABLE ) set( ${_p_COMPILE_OUTPUT_VARIABLE} ${_compile_out} PARENT_SCOPE ) endif() if( _p_RUN_OUTPUT_VARIABLE ) set( ${_p_RUN_OUTPUT_VARIABLE} ${_run_out} PARENT_SCOPE ) endif() if( _p_OUTPUT_VARIABLE ) set( ${_p_OUTPUT_VARIABLE} "${_compile_out}\n${_run_out}" PARENT_SCOPE ) endif() endfunction() ecbuild-3.14.1/cmake/FindYACC.cmake0000664000175000017500000001553515200367620017007 0ustar alastairalastair# - Find yacc executable and provides macros to generate custom build rules # The module defines the following variables: # # YACC_EXECUTABLE - path to the yacc program # YACC_FOUND - true if the program was found # # The minimum required version of yacc can be specified using the # standard CMake syntax, e.g. find_package(YACC 2.1.3) # # If yacc is found, the module defines the macros: # YACC_TARGET( [VERBOSE ] # [COMPILE_FLAGS ]) # which will create a custom rule to generate a parser. is # the path to a yacc file. is the name of the source file # generated by yacc. A header file is also be generated, and contains # the token list. If COMPILE_FLAGS option is specified, the next # parameter is added in the yacc command line. if VERBOSE option is # specified, is created and contains verbose descriptions of the # grammar and parser. The macro defines a set of variables: # YACC_${Name}_DEFINED - true is the macro ran successfully # YACC_${Name}_INPUT - The input source file, an alias for # YACC_${Name}_OUTPUT_SOURCE - The source file generated by yacc # YACC_${Name}_OUTPUT_HEADER - The header file generated by yacc # YACC_${Name}_OUTPUTS - The sources files generated by yacc # YACC_${Name}_COMPILE_FLAGS - Options used in the yacc command line # # ==================================================================== #============================================================================= # Copyright 2009 Kitware, Inc. # Copyright 2006 Tristan Carel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # This file is based on the FindFLEX CMake macro, and adapted by ECMWF #============================================================================= # (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. FIND_PROGRAM(YACC_EXECUTABLE yacc DOC "path to the yacc/yacc executable") MARK_AS_ADVANCED(YACC_EXECUTABLE) IF(YACC_EXECUTABLE) # the yacc commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated SET(_Yacc_SAVED_LC_ALL "$ENV{LC_ALL}") SET(ENV{LC_ALL} C) SET(ENV{LC_ALL} ${_Yacc_SAVED_LC_ALL}) # internal macro MACRO(YACC_TARGET_option_verbose Name YaccOutput filename) LIST(APPEND YACC_TARGET_cmdopt "--verbose") GET_FILENAME_COMPONENT(YACC_TARGET_output_path "${YaccOutput}" PATH) GET_FILENAME_COMPONENT(YACC_TARGET_output_name "${YaccOutput}" NAME_WE) ADD_CUSTOM_COMMAND(OUTPUT ${filename} COMMAND ${CMAKE_COMMAND} ARGS -E copy "${YACC_TARGET_output_path}/${YACC_TARGET_output_name}.output" "${filename}" DEPENDS "${YACC_TARGET_output_path}/${YACC_TARGET_output_name}.output" COMMENT "[YACC][${Name}] Copying yacc verbose table to ${filename}" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) SET(YACC_${Name}_VERBOSE_FILE ${filename}) LIST(APPEND YACC_TARGET_extraoutputs "${YACC_TARGET_output_path}/${YACC_TARGET_output_name}.output") ENDMACRO(YACC_TARGET_option_verbose) # internal macro MACRO(YACC_TARGET_option_extraopts Options) SET(YACC_TARGET_extraopts "${Options}") SEPARATE_ARGUMENTS(YACC_TARGET_extraopts) LIST(APPEND YACC_TARGET_cmdopt ${YACC_TARGET_extraopts}) ENDMACRO(YACC_TARGET_option_extraopts) #============================================================ # YACC_TARGET (public macro) #============================================================ # MACRO(YACC_TARGET Name YaccInput YaccOutput) SET(YACC_TARGET_output_header "") SET(YACC_TARGET_cmdopt "") SET(YACC_TARGET_outputs "${YaccOutput}") IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) MESSAGE(SEND_ERROR "Usage") ELSE() # Parsing parameters IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) IF("${ARGV3}" STREQUAL "VERBOSE") YACC_TARGET_option_verbose(${Name} ${YaccOutput} "${ARGV4}") ENDIF() IF("${ARGV3}" STREQUAL "COMPILE_FLAGS") YACC_TARGET_option_extraopts("${ARGV4}") ENDIF() ENDIF() IF(${ARGC} EQUAL 7) IF("${ARGV5}" STREQUAL "VERBOSE") YACC_TARGET_option_verbose(${Name} ${YaccOutput} "${ARGV6}") ENDIF() IF("${ARGV5}" STREQUAL "COMPILE_FLAGS") YACC_TARGET_option_extraopts("${ARGV6}") ENDIF() ENDIF() # Header's name generated by yacc (see option -d) LIST(APPEND YACC_TARGET_cmdopt "-d") STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") STRING(REPLACE "c" "h" _fileext ${_fileext}) STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" YACC_${Name}_OUTPUT_HEADER "${ARGV2}") LIST(APPEND YACC_TARGET_outputs "${YACC_${Name}_OUTPUT_HEADER}") # message ( STATUS "${YACC_EXECUTABLE} ${YACC_TARGET_cmdopt} ${CMAKE_CURRENT_BINARY_DIR}/${ARGV1}" ) # message ( STATUS "${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/y.tab.h ${YACC_${Name}_OUTPUT_HEADER}" ) # message ( STATUS "${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/y.tab.c ${ARGV2}" ) ADD_CUSTOM_COMMAND(OUTPUT ${YACC_TARGET_outputs} ${YACC_TARGET_extraoutputs} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1} ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${YACC_EXECUTABLE} ${YACC_TARGET_cmdopt} ${CMAKE_CURRENT_BINARY_DIR}/${ARGV1} COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/y.tab.h ${YACC_${Name}_OUTPUT_HEADER} COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/y.tab.c ${ARGV2} DEPENDS ${ARGV1} COMMENT "[YACC][${Name}] Building parser with yacc" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) # define target variables SET(YACC_${Name}_DEFINED TRUE) SET(YACC_${Name}_INPUT ${ARGV1}) SET(YACC_${Name}_OUTPUTS ${YACC_TARGET_outputs}) SET(YACC_${Name}_COMPILE_FLAGS ${YACC_TARGET_cmdopt}) SET(YACC_${Name}_OUTPUT_SOURCE "${YaccOutput}") ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) ENDMACRO(YACC_TARGET) # #============================================================ ENDIF(YACC_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(YACC REQUIRED_VARS YACC_EXECUTABLE ) # FindYACC.cmake ends here ecbuild-3.14.1/cmake/ecbuild_define_build_types.cmake0000664000175000017500000000452115200367620023004 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################################ # define default build type set( _BUILD_TYPE_MSG "Build type options defined by ecbuild are: [ None | Debug | Bit | Production | Release | RelWithDebInfo ]" ) if( NOT ECBUILD_DEFAULT_BUILD_TYPE ) set( ECBUILD_DEFAULT_BUILD_TYPE "RelWithDebInfo" ) endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${ECBUILD_DEFAULT_BUILD_TYPE} CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() # capitalize the build type for easy use with conditionals string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS ) # correct capitalization of the build type if( CMAKE_BUILD_TYPE_CAPS STREQUAL "NONE" ) set(CMAKE_BUILD_TYPE None CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() if( CMAKE_BUILD_TYPE_CAPS STREQUAL "DEBUG" ) set(CMAKE_BUILD_TYPE Debug CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() if( CMAKE_BUILD_TYPE_CAPS STREQUAL "BIT" ) set(CMAKE_BUILD_TYPE Bit CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() if( CMAKE_BUILD_TYPE_CAPS STREQUAL "PRODUCTION" ) set(CMAKE_BUILD_TYPE Production CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() if( CMAKE_BUILD_TYPE_CAPS STREQUAL "RELEASE" ) set(CMAKE_BUILD_TYPE Release CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() if( CMAKE_BUILD_TYPE_CAPS STREQUAL "RELWITHDEBINFO" ) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING ${_BUILD_TYPE_MSG} FORCE ) endif() # warn if build type is not one of the defined ones if( NOT CMAKE_BUILD_TYPE MATCHES "None" AND NOT CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT CMAKE_BUILD_TYPE MATCHES "Bit" AND NOT CMAKE_BUILD_TYPE MATCHES "Production" AND NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" AND NOT CMAKE_BUILD_TYPE MATCHES "MinSizeRel" ) ecbuild_warn( "CMAKE_BUILD_TYPE has an unusual value (\"${CMAKE_BUILD_TYPE_CAPS}\"). ${_BUILD_TYPE_MSG}. Please make sure your build system correctly handles CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}.") endif() ecbuild-3.14.1/cmake/ecbuild_system.cmake0000664000175000017500000002470515200367620020501 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. if( NOT ${PROJECT_NAME}_ECBUILD_SYSTEM_INCLUDED ) set( ${PROJECT_NAME}_ECBUILD_SYSTEM_INCLUDED TRUE ) include( ecbuild ) ######################################################################################################## # disallow in-source build if( EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt ) # check for failed attempts to build within the source tree message( FATAL_ERROR "Project ${PROJECT_NAME} contains a CMakeCache.txt inside source tree [${CMAKE_SOURCE_DIR}/CMakeCache.txt].\n Please remove it and make sure that source tree is prestine and clean of unintended files, before retrying." ) endif() get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) if(${srcdir} STREQUAL ${bindir}) message("######################################################") message("You are attempting to build in your source directory (${srcdir}).") message("You must run cmake from a different build directory.") message("######################################################") message( FATAL_ERROR "${PROJECT_NAME} requires an out of source build.\n Please create a separate build directory and run 'cmake path/to/project [options]' from there.") endif() ######################################################################################################## # ecbuild versioning support set( ECBUILD_CMAKE_MINIMUM "3.11.0" ) if( ${CMAKE_VERSION} VERSION_LESS ${ECBUILD_CMAKE_MINIMUM} ) message(FATAL_ERROR "${PROJECT_NAME} requires at least CMake ${ECBUILD_CMAKE_MINIMUM} -- you are using ${CMAKE_COMMAND} [${CMAKE_VERSION}]\n Please, get a newer version of CMake @ www.cmake.org" ) endif() set( ECBUILD_MACROS_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "where ecbuild system is" ) if( NOT ecbuild_VERSION_STR ) include( ecbuild_parse_version ) ecbuild_parse_version_file( "${ECBUILD_MACROS_DIR}/VERSION" PREFIX ecbuild ) endif() # Set policies if( NOT ( PROJECT_NAME STREQUAL ecbuild ) ) include( ecbuild_policies NO_POLICY_SCOPE ) endif() # set capitalised project name if( ECBUILD_2_COMPAT ) string( TOUPPER ${PROJECT_NAME} PROJECT_NAME_CAPS ) string( TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWCASE ) endif() ######################################################################################################## # include our cmake macros, but only if any parent project is not an ecbuild project if( NOT ECBUILD_SYSTEM_INITIALISED ) # hostname of where we build site_name( BUILD_SITE ) mark_as_advanced( BUILD_SITE ) mark_as_advanced( BUILD_TESTING ) set( ECBUILD_PROJECTS "" CACHE INTERNAL "list of ecbuild (sub)projects that use ecbuild" ) # Include log macros since these are used right away include( ecbuild_log ) # Enable the compatibility layer if(ECBUILD_2_COMPAT) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/compat" ) include(ecbuild_compat) # Deprecate capitalised project name ecbuild_mark_compat(${PROJECT_NAME_CAPS} ${PROJECT_NAME}) ecbuild_mark_compat(${PROJECT_NAME_LOWCASE} ${PROJECT_NAME}) endif() execute_process( COMMAND env OUTPUT_VARIABLE __env ) ecbuild_debug( "---------------------------------------------------------" ) ecbuild_debug( "Environment:" ) ecbuild_debug( "---------------------------------------------------------\n${__env}" ) ecbuild_debug( "---------------------------------------------------------" ) ecbuild_info( "ecbuild ${ecbuild_VERSION_STR}\t${ECBUILD_MACROS_DIR}" ) ecbuild_info( "cmake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}\t${CMAKE_COMMAND}" ) if( CMAKE_TOOLCHAIN_FILE ) ecbuild_info( "toolchain ${CMAKE_TOOLCHAIN_FILE}" ) endif() if( ECBUILD_CONFIG ) ecbuild_info( "config ${ECBUILD_CONFIG}" ) endif() if( ECBUILD_CACHE ) include( ${ECBUILD_CACHE} ) ecbuild_info( "cache ${ECBUILD_CACHE}" ) endif() ecbuild_info( "---------------------------------------------------------" ) # add extra macros from external contributions set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/contrib" ) ############################################################################################ # define valid build types include(ecbuild_define_build_types) ############################################################################################ # define custom properties include(ecbuild_define_properties) ############################################################################################ # add cmake macros include(AddFileDependencies) include(CheckTypeSize) include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckCCompilerFlag) include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CMakeParseArguments) include(CMakePushCheckState) # include(CMakePrintSystemInformation) # available in cmake 2.8.4 if( CMAKE_CXX_COMPILER_LOADED ) include(CheckIncludeFileCXX) include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) include(CheckCXXSourceRuns) endif() if( CMAKE_Fortran_COMPILER_LOADED ) set( CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module CACHE PATH "directory for all fortran modules." ) include(CheckFortranFunctionExists) if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE ) include(FortranCInterface) endif() set( EC_HAVE_FORTRAN 1 ) endif() include(FeatureSummary) # support features in cmake include(TestBigEndian) ############################################################################################ # add our macros include( ecbuild_evaluate_dynamic_condition ) include( ecbuild_filter_list ) include( ecbuild_regex_escape ) include( ecbuild_parse_version ) include( ecbuild_list_macros ) include( ecbuild_list_add_pattern ) include( ecbuild_list_exclude_pattern ) include( ecbuild_try_run ) include( ecbuild_check_c_source_return ) include( ecbuild_check_cxx_source_return ) include( ecbuild_check_fortran_source_return ) include( ecbuild_requires_macro_version ) include( ecbuild_get_date ) include( ecbuild_add_persistent ) include( ecbuild_generate_config_headers ) include( ecbuild_generate_yy ) include( ecbuild_generate_fortran_interfaces ) include( ecbuild_echo_targets ) include( ecbuild_features ) include( ecbuild_add_option ) include( ecbuild_add_library ) include( ecbuild_add_executable ) include( ecbuild_append_to_rpath ) include( ecbuild_download_resource ) include( ecbuild_get_test_data ) include( ecbuild_check_urls ) include( ecbuild_add_c_flags ) include( ecbuild_add_cxx_flags ) include( ecbuild_get_cxx11_flags ) include( ecbuild_check_fortran ) include( ecbuild_add_fortran_flags ) include( ecbuild_add_test ) include( ecbuild_add_resources ) include( ecbuild_get_resources ) include( ecbuild_dont_pack ) include( ecbuild_project_files ) include( ecbuild_declare_project ) include( ecbuild_generate_project_config ) include( ecbuild_install_project ) include( ecbuild_separate_sources ) include( ecbuild_find_package_search_hints ) include( ecbuild_find_package ) include( ecbuild_print_summary ) include( ecbuild_warn_unused_files ) include( ecbuild_find_mpi ) include( ecbuild_find_omp ) include( ecbuild_find_perl ) include( ecbuild_find_python ) include( ecbuild_find_lexyacc ) include( ecbuild_find_fortranlibs ) include( ecbuild_git ) include( ecbuild_enable_fortran ) include( ecbuild_source_flags ) include( ecbuild_target_flags ) include( ecbuild_target_fortran_module_directory ) include( ecbuild_pkgconfig ) include( ecbuild_cache ) include( ecbuild_remove_fortran_flags ) include( ecbuild_configure_file ) include( ecbuild_install_dependency_with_soversion ) if( NOT (PROJECT_NAME STREQUAL ecbuild) ) include( ecbuild_bundle ) endif() include( ${CMAKE_CURRENT_LIST_DIR}/contrib/GetGitRevisionDescription.cmake ) ############################################################################################ # kickstart the build system if( ECBUILD_CONFIG ) include( ${ECBUILD_CONFIG} ) endif() ecbuild_prepare_cache() if( NOT (PROJECT_NAME STREQUAL ecbuild ) ) include( ecbuild_define_options ) # define build options include( ecbuild_compiler_flags ) # compiler flags include( ecbuild_check_compiler ) # check for compiler characteristics include( ecbuild_check_os ) # check for os characteristics endif() include( ecbuild_define_paths ) # defines installation paths ecbuild_flush_cache() ############################################################################################ # Testing include(CTest) # add cmake testing support enable_testing() ############################################################################################ # define the build timestamp, unless the user provided one via EC_BUILD_TIMESTAMP if( NOT DEFINED EC_BUILD_TIMESTAMP ) ecbuild_get_timestamp( EC_BUILD_TIMESTAMP ) set( EC_BUILD_TIMESTAMP "${EC_BUILD_TIMESTAMP}" CACHE INTERNAL "Build timestamp" ) endif() ecbuild_info( "---------------------------------------------------------" ) set( ECBUILD_SYSTEM_INITIALISED TRUE ) else() # Allow subprojects with different compilation flags. This could be done by defining # set( ECBUILD_C_FLAGS_DEBUG "-O0" ) # or # set( ECBUILD_CONFIG ".cmake" ) if( ECBUILD_CONFIG ) ecbuild_info( "---------------------------------------------------------" ) ecbuild_info( "config ${ECBUILD_CONFIG}" ) include( ${ECBUILD_CONFIG} ) endif() include( ecbuild_compiler_flags ) endif() endif() ecbuild-3.14.1/cmake/ecbuild_policies.cmake0000664000175000017500000000341315200367620020755 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. ############################################################################## # # ecBuild Policies # ================ # # NOTE: This file needs to be included with NO_POLICY_SCOPE or it will have no # effect! # ############################################################################## if( NOT ${PROJECT_NAME}_ECBUILD_POLICIES_INCLUDED ) set( ${PROJECT_NAME}_ECBUILD_POLICIES_INCLUDED TRUE ) if( ECBUILD_2_COMPAT ) # Allow mixed use of plain and keyword target_link_libraries cmake_policy( SET CMP0023 OLD ) # Allow use of the LOCATION target property. cmake_policy( SET CMP0026 OLD ) # Do not manage VERSION variables in project command cmake_policy( SET CMP0048 OLD ) # RPATH settings on macOS do not affect "install_name" # FTM, keep old behavior -- need to test if new behavior impacts binaries in build directory cmake_policy( SET CMP0068 OLD ) else() # we set these to avoid warnings cmake_policy( SET CMP0048 NEW ) # introduced in cmake 3.0 cmake_policy( SET CMP0068 NEW ) # introduced in cmake 3.9 endif() # for macosx use @rpath in a target’s install name (CMP0042) set( CMAKE_MACOSX_RPATH ON ) # find packages use _ROOT by default, new in version 3.12 if( POLICY CMP0074 ) cmake_policy( SET CMP0074 NEW ) endif() # Detect invalid indices in the ``list()`` command, new in version 3.21 if( POLICY CMP0121 ) cmake_policy( SET CMP0121 NEW ) endif() endif() ecbuild-3.14.1/cmake/FindCMath.cmake0000664000175000017500000000163715200367620017262 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. #Sets: # CMATH_LIBRARIES = the library to link against (RT etc) IF(UNIX) if( DEFINED CMATH_PATH ) find_library(CMATH_LIBRARIES m PATHS ${CMATH_PATH}/lib NO_DEFAULT_PATH ) endif() find_library(CMATH_LIBRARIES m ) include(FindPackageHandleStandardArgs) # handle the QUIET and REQUIRED arguments and set CMATH_FOUND to TRUE # if all listed variables are TRUE # Note: capitalisation of the package name must be the same as in the file name find_package_handle_standard_args(CMath DEFAULT_MSG CMATH_LIBRARIES ) ENDIF(UNIX) ecbuild-3.14.1/cmake/pkg-config.pc.in0000664000175000017500000000164615200367620017440 0ustar alastairalastair# This pkg-config file is generated by ecbuild_pkgconfig() # with template ecbuild/cmake/pkg-config.pc.in git_tag=@PKGCONFIG_GIT_TAG@ prefix=${pcfiledir}/../.. exec_prefix=${prefix} libdir=${prefix}/@INSTALL_LIB_DIR@ includedir=${prefix}/@INSTALL_INCLUDE_DIR@ bindir=${prefix}/@INSTALL_BIN_DIR@ fmoddir=${prefix}/@INSTALL_INCLUDE_DIR@ CC=@CMAKE_C_COMPILER@ CXX=@CMAKE_CXX_COMPILER@ FC=@CMAKE_Fortran_COMPILER@ libs=@PKGCONFIG_LIBS@ libs_private=@PKGCONFIG_LIBS_PRIVATE@ cflags=@PKGCONFIG_INCLUDE@ @PKGCONFIG_CFLAGS@ @PKGCONFIG_VARIABLES@ #==================================================================== Name: @PKGCONFIG_NAME@ Description: @PKGCONFIG_DESCRIPTION@ URL: @PKGCONFIG_URL@ Version: @PKGCONFIG_VERSION@ Libs: ${libs} Libs.private: ${libs_private} Requires: @PKGCONFIG_REQUIRES@ Requires.private: @PKGCONFIG_REQUIRES_PRIVATE@ Cflags: ${cflags} #==================================================================== ecbuild-3.14.1/cmake/ecbuild_generate_yy.cmake0000664000175000017500000001645115200367620021467 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_generate_yy # =================== # # Process lex/yacc files. :: # # ecbuild_generate_yy( YYPREFIX # YACC # LEX # DEPENDANT [ ... ] # [ SOURCE_DIR ] # [ OUTPUT_DIRECTORY ] # [ YACC_TARGET ] # [ LEX_TARGET ] # [ YACC_FLAGS ] # [ LEX_FLAGS ] # [ BISON_FLAGS ] # [ FLEX_FLAGS ] ) # # Options # ------- # # YYPREFIX : required # prefix to use for file and function names # # YACC : required # base name of the yacc source file (without .y extension) # # LEX : required # base name of the lex source file (without .l extension) # # DEPENDANT : required # list of files which depend on the generated lex and yacc target files # At least one should be an existing source file (not generated itself). # # SOURCE_DIR : optional, defaults to CMAKE_CURRENT_SOURCE_DIR # directory where yacc and lex source files are located # # OUTPUT_DIRECTORY : optional, defaults to CMAKE_CURRENT_BINARY_DIR # output directory for yacc and lex target files # # YACC_TARGET : optional, defaults to YACC # base name of the generated yacc target file (without .c extension) # # LEX_TARGET : optional, defaults to LEX # base name of the generated lex target file (without .c extension) # # YACC_FLAGS : optional, defaults to -t # flags to pass to yacc executable # # LEX_FLAGS : optional # flags to pass to lex executable # # BISON_FLAGS : optional, defaults to -t # flags to pass to bison executable # # FLEX_FLAGS : optional, defaults to -l # flags to pass to flex executable # ############################################################################## macro( ecbuild_generate_yy ) ecbuild_find_lexyacc() # find [ yacc|byson ] and [ lex|flex ] ecbuild_find_perl( REQUIRED ) set( options ) set( single_value_args YYPREFIX YACC LEX SOURCE_DIR OUTPUT_DIRECTORY YACC_TARGET LEX_TARGET LEX_FLAGS YACC_FLAGS FLEX_FLAGS BISON_FLAGS ) set( multi_value_args DEPENDANT ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_generate_yy(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_YYPREFIX ) ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the YYPREFIX.") endif() if( NOT _PAR_YACC ) ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the YACC file.") endif() if( NOT _PAR_LEX ) ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the LEX file.") endif() if( NOT _PAR_DEPENDANT ) ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the DEPENDANT files.") endif() set( BASE ${_PAR_YYPREFIX}_${_PAR_YACC} ) ## default flags if( NOT _PAR_LEX_FLAGS ) set( _PAR_LEX_FLAGS "" ) endif() if( NOT _PAR_FLEX_FLAGS ) set( _PAR_FLEX_FLAGS "-l" ) endif() if( NOT _PAR_YACC_FLAGS ) set( _PAR_YACC_FLAGS "-t" ) endif() if( NOT _PAR_BISON_FLAGS ) set( _PAR_BISON_FLAGS "-t" ) endif() if( NOT _PAR_YACC_TARGET ) set ( _PAR_YACC_TARGET ${_PAR_YACC} ) endif() if ( NOT _PAR_LEX_TARGET ) set ( _PAR_LEX_TARGET ${_PAR_LEX} ) endif() if( NOT _PAR_SOURCE_DIR ) set( _PAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) endif() if( NOT _PAR_OUTPUT_DIRECTORY ) set( _PAR_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) else() file( MAKE_DIRECTORY ${_PAR_OUTPUT_DIRECTORY} ) endif() set( ${BASE}yy_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.tmp.c ) set( ${BASE}yh_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.tmp.h ) set( ${BASE}yl_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_LEX_TARGET}.tmp.c ) set( ${BASE}yy_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.c ) set( ${BASE}yh_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.h ) set( ${BASE}yl_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_LEX_TARGET}.c ) if( BISON_FOUND ) bison_target( ${BASE}_parser ${_PAR_SOURCE_DIR}/${_PAR_YACC}.y ${${BASE}yy_tmp_target} COMPILE_FLAGS "${_PAR_BISON_FLAGS}" ) else() yacc_target( ${BASE}_parser ${_PAR_SOURCE_DIR}/${_PAR_YACC}.y ${${BASE}yy_tmp_target} COMPILE_FLAGS "${_PAR_YACC_FLAGS}" ) endif() if( FLEX_FOUND ) flex_target( ${BASE}_scanner ${_PAR_SOURCE_DIR}/${_PAR_LEX}.l ${${BASE}yl_tmp_target} COMPILE_FLAGS "${_PAR_FLEX_FLAGS}" ) add_flex_bison_dependency(${BASE}_scanner ${BASE}_parser) else() lex_target( ${BASE}_scanner ${_PAR_SOURCE_DIR}/${_PAR_LEX}.l ${${BASE}yl_tmp_target} COMPILE_FLAGS "${_PAR_LEX_FLAGS}" ) add_lex_yacc_dependency(${BASE}_scanner ${BASE}_parser) endif() set_source_files_properties(${${BASE}yy_tmp_target} GENERATED) set_source_files_properties(${${BASE}yh_tmp_target} GENERATED) set_source_files_properties(${${BASE}yl_tmp_target} GENERATED) add_custom_command(OUTPUT ${${BASE}yy_target} COMMAND ${CMAKE_COMMAND} -E copy ${${BASE}yy_tmp_target} ${${BASE}yy_target} COMMAND ${PERL_EXECUTABLE} -pi -e 's/yy/${_PAR_YYPREFIX}/g' ${${BASE}yy_target} COMMAND ${PERL_EXECUTABLE} -pi -e 's/\\bregister\\b//g' ${${BASE}yy_target} # remove deprecated register keyword COMMAND ${PERL_EXECUTABLE} -pi -e 's/\\.tmp\\.c/\\.c/g' ${${BASE}yy_target} DEPENDS ${${BASE}yy_tmp_target} ) add_custom_command(OUTPUT ${${BASE}yh_target} COMMAND ${CMAKE_COMMAND} -E copy ${${BASE}yh_tmp_target} ${${BASE}yh_target} COMMAND ${PERL_EXECUTABLE} -pi -e 's/yy/${_PAR_YYPREFIX}/g' ${${BASE}yh_target} COMMAND ${PERL_EXECUTABLE} -pi -e 's/\\bregister\\b//g' ${${BASE}yh_target} # remove deprecated register keyword COMMAND ${PERL_EXECUTABLE} -pi -e 's/\\.tmp\\.h/\\.h/g' ${${BASE}yh_target} DEPENDS ${${BASE}yh_tmp_target} ) add_custom_command(OUTPUT ${${BASE}yl_target} COMMAND ${CMAKE_COMMAND} -E copy ${${BASE}yl_tmp_target} ${${BASE}yl_target} COMMAND ${PERL_EXECUTABLE} -pi -e 's/yy/${_PAR_YYPREFIX}/g' ${${BASE}yl_target} COMMAND ${PERL_EXECUTABLE} -pi -e 's/\\bregister\\b//g' ${${BASE}yl_target} # remove deprecated register keyword COMMAND ${PERL_EXECUTABLE} -pi -e 's/\\.tmp\\.c/\\.c/g' ${${BASE}yl_target} DEPENDS ${${BASE}yl_tmp_target} ) set_source_files_properties(${${BASE}yy_target} GENERATED) set_source_files_properties(${${BASE}yh_target} GENERATED) set_source_files_properties(${${BASE}yl_target} GENERATED) foreach( file ${_PAR_DEPENDANT} ) if( NOT IS_ABSOLUTE ${file}) set( file ${_PAR_SOURCE_DIR}/${file} ) endif() set_source_files_properties( ${file} PROPERTIES OBJECT_DEPENDS "${${BASE}yy_target};${${BASE}yh_target};${${BASE}yl_target}" ) endforeach() endmacro( ecbuild_generate_yy ) ecbuild-3.14.1/cmake/ecbuild_get_test_data.cmake0000664000175000017500000004246415200367620021766 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## # function for downloading test data function( _download_test_data _p_NAME _p_DIR_URL _p_DIRLOCAL _p_CHECK_FILE_EXISTS _p_INSECURE ) # TODO: make that 'at ecmwf' #if(1) #unset(ENV{no_proxy}) #unset(ENV{NO_PROXY}) #set(ENV{http_proxy} "http://proxy.ecmwf.int:3333") #endif() # Do not retry downloads by default (ECBUILD-307) if( NOT DEFINED ECBUILD_DOWNLOAD_RETRIES ) set( ECBUILD_DOWNLOAD_RETRIES 0 ) endif() # Use default timeout of 30s if not specified (ECBUILD-307) if( NOT DEFINED ECBUILD_DOWNLOAD_TIMEOUT ) set( ECBUILD_DOWNLOAD_TIMEOUT 30 ) endif() # Allow insecure download as a global option if( NOT DEFINED ECBUILD_DOWNLOAD_INSECURE OR NOT ECBUILD_DOWNLOAD_INSECURE ) set( ECBUILD_DOWNLOAD_INSECURE _p_INSECURE ) endif() find_program( CURL_PROGRAM curl ) mark_as_advanced(CURL_PROGRAM) find_program( WGET_PROGRAM wget ) mark_as_advanced(WGET_PROGRAM) if( NOT CURL_PROGRAM AND NOT WGET_PROGRAM ) if( NOT WARNING_CANNOT_DOWNLOAD_TEST_DATA ) ecbuild_warn( "Couldn't find curl neither wget -- cannot download test data from server.\nPlease obtain the test data by other means and pleace it in the build directory." ) set( WARNING_CANNOT_DOWNLOAD_TEST_DATA 1 CACHE INTERNAL "Couldn't find curl neither wget -- cannot download test data from server" ) mark_as_advanced( WARNING_CANNOT_DOWNLOAD_TEST_DATA ) return() endif() endif() set( use_curl TRUE ) if( _p_CHECK_FILE_EXISTS ) # The "--continue-at - " option of curl is buggy... (ask Google) # Error message is: "curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume." # Switch to wget if _p_CHECK_FILE_EXISTS is activated if( WGET_PROGRAM ) set( use_curl FALSE ) else() set( _p_CHECK_FILE_EXISTS FALSE ) endif() elseif( NOT CURL_PROGRAM ) set( use_curl FALSE ) endif() if( use_curl ) if( ECBUILD_DOWNLOAD_INSECURE ) set( INSECURE_CURL "--insecure" ) else() set( INSECURE_CURL "" ) endif() add_custom_command( OUTPUT ${_p_NAME} COMMENT "(curl) downloading ${_p_DIR_URL}/${_p_NAME}" COMMAND ${CURL_PROGRAM} ${INSECURE_CURL} --silent --show-error --fail --output ${_p_DIRLOCAL}/${_p_NAME} --retry ${ECBUILD_DOWNLOAD_RETRIES} --connect-timeout ${ECBUILD_DOWNLOAD_TIMEOUT} ${_p_DIR_URL}/${_p_NAME} ) else() # wget takes the total number of tries, curl the number or retries math( EXPR ECBUILD_DOWNLOAD_RETRIES "${ECBUILD_DOWNLOAD_RETRIES} + 1" ) if( ECBUILD_DOWNLOAD_INSECURE ) set( INSECURE_WGET "--no-check-certificate" ) else() set( INSECURE_WGET "" ) endif() if( _p_CHECK_FILE_EXISTS ) add_custom_command( OUTPUT ${_p_NAME} COMMENT "(wget) downloading ${_p_DIR_URL}/${_p_NAME}" COMMAND ${WGET_PROGRAM} -c -nv -O ${_p_DIRLOCAL}/${_p_NAME} ${INSECURE_WGET} -t ${ECBUILD_DOWNLOAD_RETRIES} -T ${ECBUILD_DOWNLOAD_TIMEOUT} ${_p_DIR_URL}/${_p_NAME} ) else() add_custom_command( OUTPUT ${_p_NAME} COMMENT "(wget) downloading ${_p_DIR_URL}/${_p_NAME}" COMMAND ${WGET_PROGRAM} -nv -O ${_p_DIRLOCAL}/${_p_NAME} ${INSECURE_WGET} -t ${ECBUILD_DOWNLOAD_RETRIES} -T ${ECBUILD_DOWNLOAD_TIMEOUT} ${_p_DIR_URL}/${_p_NAME} ) endif() endif() endfunction() ############################################################################## #.rst: # # ecbuild_get_test_data # ===================== # # Download a test data set at build time. :: # # ecbuild_get_test_data( NAME # [ TARGET ] # [ DIRNAME ] # [ DIRLOCAL ] # [ MD5 ] # [ EXTRACT ] # [ NOCHECK ] # [ INSECURE ]) # # curl or wget is required (curl is preferred if available). # # Options # ------- # # NAME : required # name of the test data file # # TARGET : optional, defaults to test_data_ # CMake target name # # DIRNAME : optional # use when there is a directory structure on the server that # hosts test files # # DIRLOCAL : optional, defaults to ".", local directory in which the test data is copied # # MD5 : optional, ignored if NOCHECK is given # md5 checksum of the data set to verify. If not given and NOCHECK is *not* # set, download the md5 checksum and verify # # EXTRACT : optional # extract the downloaded file (supported archives: tar, zip, tar.gz, tar.bz2) # # NOCHECK : optional # do not verify the md5 checksum of the data file # # INSECURE : optional # explicitly allows curl and wget to perform "insecure" SSL connections # # Usage # ----- # # Download test data from ``//`` # # If the ``ECBUILD_DOWNLOAD_BASE_URL`` variable is not set, the default URL # ``https://sites.ecmwf.int/repository`` is used. # # If the ``DIRNAME`` argument is not given, test data will be downloaded # from ``//test-data//`` # where ```` is the name of the project with all '_' replaced by '-'. # # By default, the downloaded file is verified against an md5 checksum, either # given as the ``MD5`` argument or downloaded from the server otherwise. Use # the argument ``NOCHECK`` to disable this check. # # The default timeout is 30 seconds, which can be overridden with # ``ECBUILD_DOWNLOAD_TIMEOUT``. Downloads are by default only tried once, use # ``ECBUILD_DOWNLOAD_RETRIES`` to set the number of retries. # # Examples # -------- # # Do not verify the checksum: :: # # ecbuild_get_test_data( NAME msl.grib NOCHECK ) # # Checksum agains remote md5 file: :: # # ecbuild_get_test_data( NAME msl.grib ) # # Checksum agains local md5: :: # # ecbuild_get_test_data( NAME msl.grib MD5 f69ca0929d1122c7878d19f32401abe9 ) # ############################################################################## function( ecbuild_get_test_data ) set( options NOCHECK EXTRACT INSECURE ) set( single_value_args TARGET NAME DIRNAME DIRLOCAL MD5 SHA1 ) set( multi_value_args ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_p_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() file( RELATIVE_PATH currdir ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) ### check parameters if( NOT _p_NAME ) ecbuild_critical("ecbuild_get_test_data() expects a NAME") endif() if( NOT _p_TARGET ) string( REGEX REPLACE "[^A-Za-z0-9_]" "_" _p_TARGET "test_data_${_p_NAME}") # string( REGEX REPLACE "[^A-Za-z0-9_]" "_" _p_TARGET "${_p_NAME}") # set( _p_TARGET ${_p_NAME} ) endif() if( NOT _p_DIRLOCAL ) set( _p_DIRLOCAL "." ) endif() # Allow the user to override the base download URL (ECBUILD-447) if( NOT DEFINED ECBUILD_DOWNLOAD_BASE_URL ) set( ECBUILD_DOWNLOAD_BASE_URL https://sites.ecmwf.int/repository ) endif() # Set download URL if( NOT _p_DIRNAME ) string( REGEX REPLACE "_" "-" NORMALIZED_PROJECT_NAME "${PROJECT_NAME}") # replace all '_' by '-' set( DOWNLOAD_URL ${ECBUILD_DOWNLOAD_BASE_URL}/${NORMALIZED_PROJECT_NAME}/test-data/${currdir}) else() set( DOWNLOAD_URL ${ECBUILD_DOWNLOAD_BASE_URL}/${_p_DIRNAME} ) endif() if( NOT _p_NOCHECK AND NOT _p_MD5 AND NOT _p_SHA1 ) # special case where data might have been downloaded already and will be checked with the remote md5 anyway set( CHECK_FILE_EXISTS ON) else() # always download the data set( CHECK_FILE_EXISTS OFF) endif() if( _p_INSECURE ) # allow insecure SSL connection set( ALLOW_INSECURE ON) else() # do not allow insecure SSL connection set( ALLOW_INSECURE OFF) endif() # download the data _download_test_data( ${_p_NAME} ${DOWNLOAD_URL} ${_p_DIRLOCAL} ${CHECK_FILE_EXISTS} ${ALLOW_INSECURE}) # perform the checksum if requested set( _deps ${_p_NAME} ) if( NOT _p_NOCHECK ) if( NOT _p_MD5 AND NOT _p_SHA1) # use remote md5 add_custom_command( OUTPUT ${_p_NAME}.localmd5 COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5 WORKING_DIRECTORY ${_p_DIRLOCAL} DEPENDS ${_p_NAME} ) _download_test_data( ${_p_NAME}.md5 ${DOWNLOAD_URL} ${_p_DIRLOCAL} OFF ${ALLOW_INSECURE}) add_custom_command( OUTPUT ${_p_NAME}.ok COMMAND ${CMAKE_COMMAND} -E compare_files ${_p_NAME}.md5 ${_p_NAME}.localmd5 && ${CMAKE_COMMAND} -E touch ${_p_NAME}.ok WORKING_DIRECTORY ${_p_DIRLOCAL} DEPENDS ${_p_NAME}.localmd5 ${_p_NAME}.md5 ) list( APPEND _deps ${_p_NAME}.localmd5 ${_p_NAME}.ok ) endif() if( _p_MD5 ) add_custom_command( OUTPUT ${_p_NAME}.localmd5 COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5 WORKING_DIRECTORY ${_p_DIRLOCAL} DEPENDS ${_p_NAME} ) configure_file( "${ECBUILD_MACROS_DIR}/md5.in" ${_p_DIRLOCAL}/${_p_NAME}.md5 @ONLY NEWLINE_STYLE LF ) add_custom_command( OUTPUT ${_p_NAME}.ok COMMAND ${CMAKE_COMMAND} -E compare_files ${_p_NAME}.md5 ${_p_NAME}.localmd5 && ${CMAKE_COMMAND} -E touch ${_p_NAME}.ok WORKING_DIRECTORY ${_p_DIRLOCAL} DEPENDS ${_p_NAME}.localmd5 ) list( APPEND _deps ${_p_NAME}.localmd5 ${_p_NAME}.ok ) endif() # if( _p_SHA1 ) # find_program( SHASUM NAMES sha1sum shasum ) # if( SHASUM ) # add_custom_command( OUTPUT ${_p_NAME}.localsha1 # COMMAND ${SHASUM} ${_p_DIRLOCAL}/${_p_NAME} > ${_p_DIRLOCAL}/${_p_NAME}.localsha1 ) # add_custom_command( OUTPUT ${_p_NAME}.ok # COMMAND diff ${_p_DIRLOCAL}/${_p_NAME}.sha1 ${_p_DIRLOCAL}/${_p_NAME}.localsha1 && touch ${_p_DIRLOCAL}/${_p_NAME}.ok ) # configure_file( "${ECBUILD_MACROS_DIR}/sha1.in" ${_p_DIRLOCAL}/${_p_NAME}.sha1 @ONLY ) # list( APPEND _deps ${_p_NAME}.localsha1 ${_p_NAME}.ok ) # endif() # endif() endif() add_custom_target( ${_p_TARGET} DEPENDS ${_deps} ) if( _p_EXTRACT ) ecbuild_debug("ecbuild_get_test_data: extracting ${_p_DIRLOCAL}/${_p_NAME} (post-build for target ${_p_TARGET}") add_custom_command( TARGET ${_p_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E chdir ${_p_DIRLOCAL} tar xvf ${_p_NAME} ) endif() endfunction(ecbuild_get_test_data) ############################################################################## #.rst: # # ecbuild_get_test_multidata # ========================== # # Download multiple test data sets at build time. :: # # ecbuild_get_test_multidata( NAMES [ ... ] # TARGET # [ DIRNAME ] # [ DIRLOCAL ] # [ LABELS [ ...] ] # [ EXTRACT ] # [ NOCHECK ] # [ INSECURE ] ) # # curl or wget is required (curl is preferred if available). # # Options # ------- # # NAMES : required # list of names of the test data files # # TARGET : optional # CMake target name # # DIRNAME : optional # use when there is a directory structure on the server that # hosts test files # # DIRLOCAL : optional, defaults to ".", local directory in which the test data is copied # # LABELS : optional # list of labels to assign to the test # # Lower case project name and ``download_data`` are always added as labels. # # This allows selecting tests to run via ``ctest -L `` or tests # to exclude via ``ctest -LE ``. # # EXTRACT : optional # extract downloaded files (supported archives: tar, zip, tar.gz, tar.bz2) # # NOCHECK : optional # do not verify the md5 checksum of the data file # # INSECURE : optional # explicitly allows curl and wget to perform "insecure" SSL connections # # Usage # ----- # # Download test data from ``/`` # for each name given in the list of ``NAMES``. Each name may contain a # relative path, which is appended to ``DIRNAME`` and may be followed by an # md5 checksum, separated with a ``:`` (the name must not contain spaces). # # If the ``ECBUILD_DOWNLOAD_BASE_URL`` variable is not set, the default URL # ``https://get.ecmwf.int/repository/test-data`` is used. # # If the ``DIRNAME`` argument is not given, test data will be downloaded # from ``///`` # # By default, each downloaded file is verified against an md5 checksum, either # given as part of the name as described above or a remote checksum downloaded # from the server. Use the argument ``NOCHECK`` to disable this check. # # Examples # -------- # # Do not verify checksums: :: # # ecbuild_get_test_multidata( TARGET get_grib_data NAMES foo.grib bar.grib # DIRNAME test/data/dir NOCHECK ) # # Checksums agains remote md5 file: :: # # ecbuild_get_test_multidata( TARGET get_grib_data NAMES foo.grib bar.grib # DIRNAME test/data/dir ) # # Checksum agains local md5: :: # # ecbuild_get_test_multidata( TARGET get_grib_data DIRNAME test/data/dir # NAMES msl.grib:f69ca0929d1122c7878d19f32401abe9 ) # ############################################################################## function( ecbuild_get_test_multidata ) set( options EXTRACT NOCHECK INSECURE ) set( single_value_args TARGET DIRNAME DIRLOCAL ) set( multi_value_args NAMES LABELS ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_p_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_get_test_multidata(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() ### check parameters if( NOT _p_NAMES ) ecbuild_critical("ecbuild_get_test_multidata() expects a NAMES") endif() if( NOT _p_TARGET ) ecbuild_critical("ecbuild_get_test_multidata() expects a TARGET") endif() if( NOT _p_DIRLOCAL ) set( _p_DIRLOCAL ".") endif() if( _p_EXTRACT ) set( _extract EXTRACT ) endif() if( _p_NOCHECK ) set( _nocheck NOCHECK ) endif() if( _p_INSECURE ) set( _insecure INSECURE ) endif() ### prepare file set( _script ${CMAKE_CURRENT_BINARY_DIR}/get_data_${_p_TARGET}.cmake ) file( WRITE ${_script} " function(EXEC_CHECK) execute_process(COMMAND \${ARGV} RESULT_VARIABLE CMD_RESULT) if(CMD_RESULT) message(FATAL_ERROR \"Error running ${CMD}\") endif() endfunction()\n\n" ) foreach( _d ${_p_NAMES} ) string( REGEX MATCH "[^:]+" _f "${_d}" ) get_filename_component( _file ${_f} NAME ) get_filename_component( _dir ${_f} PATH ) set( _path_comps "" ) list( APPEND _path_comps ${_p_DIRNAME} ${_dir} ) join( _path_comps "/" _DIRNAME ) if( _DIRNAME ) set( _DIRNAME DIRNAME ${_DIRNAME} ) endif() unset( _path_comps ) string( REPLACE "." "_" _name "${_file}" ) string( REGEX MATCH ":.*" _md5 "${_d}" ) string( REPLACE ":" "" _md5 "${_md5}" ) if( _md5 ) set( _md5 MD5 ${_md5} ) endif() ecbuild_get_test_data( TARGET __get_data_${_p_TARGET}_${_name} DIRLOCAL ${_p_DIRLOCAL} NAME ${_file} ${_DIRNAME} ${_md5} ${_extract} ${_nocheck} ${_insecure}) if ( ${CMAKE_GENERATOR} MATCHES Ninja ) set( _fast "" ) else() # The option /fast disables dependency checking on a target, see # https://cmake.org/Wiki/CMake_FAQ#Is_there_a_way_to_skip_checking_of_dependent_libraries_when_compiling.3F set( _fast "/fast" ) endif() file( APPEND ${_script} "exec_check( \"${CMAKE_COMMAND}\" --build \"${CMAKE_BINARY_DIR}\" --target __get_data_${_p_TARGET}_${_name}${_fast} )\n" ) endforeach() if( HAVE_TESTS ) add_test( NAME ${_p_TARGET} COMMAND ${CMAKE_COMMAND} -P ${_script} ) string( TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWCASE ) set( _p_LABELS ${PROJECT_NAME_LOWCASE} download_data ${_p_LABELS} ) list( REMOVE_DUPLICATES _p_LABELS ) set_property( TEST ${_p_TARGET} APPEND PROPERTY LABELS "${_p_LABELS}" ) endif() endfunction(ecbuild_get_test_multidata) ecbuild-3.14.1/cmake/ecbuild_separate_sources.cmake0000664000175000017500000000727415200367620022526 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_separate_sources # ======================== # # Separate a given list of sources according to language. :: # # ecbuild_separate_sources( TARGET # SOURCES [ ... ] ) # # Options # ------- # # TARGET : required # base name for the CMake output variables to set # # SOURCES : required # list of source files to separate # # Output variables # ---------------- # # If any file of the following group of extensions is present in the list of # sources, the corresponding CMake variable is set: # # :_h_srcs: source files with extension .h, .hxx, .hh, .hpp, .H .tcc .txx .tpp # :_c_srcs: source files with extension .c # :_cxx_srcs: source files with extension .cc, .cxx, .cpp, .C # :_fortran_srcs: source files with extension .f, .F, .for, f77, .f90, # .f95, .F77, .F90, .F95 # :_cuda_srcs: source files with extension .cu # ############################################################################## function( ecbuild_separate_sources ) set( options ) set( single_value_args TARGET ) set( multi_value_args SOURCES ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_PAR_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_separate_sources(): \"${_PAR_UNPARSED_ARGUMENTS}\"") endif() if( NOT _PAR_TARGET ) ecbuild_critical("The call to ecbuild_separate_sources() doesn't specify the TARGET.") endif() if( NOT _PAR_SOURCES ) ecbuild_critical("The call to ecbuild_separate_sources() doesn't specify the SOURCES.") endif() foreach( src ${_PAR_SOURCES} ) if(${src} MATCHES "(\\.h$|\\.hxx$|\\.hh$|\\.hpp$|\\.H$|\\.tcc$|\\.txx$|\\.tpp$)") list( APPEND ${_PAR_TARGET}_h_srcs ${src} ) endif() endforeach() foreach( src ${_PAR_SOURCES} ) if(${src} MATCHES "(\\.c$)") list( APPEND ${_PAR_TARGET}_c_srcs ${src} ) endif() endforeach() foreach( src ${_PAR_SOURCES} ) if(${src} MATCHES "(\\.cc$|\\.cxx$|\\.cpp$|\\.C$)") list( APPEND ${_PAR_TARGET}_cxx_srcs ${src} ) endif() endforeach() foreach( src ${_PAR_SOURCES} ) if(${src} MATCHES "(\\.f$|\\.F$|\\.for$|\\.f77$|\\.f90$|\\.f95$|\\.f03$|\\.f08$|\\.F77$|\\.F90$|\\.F95$|\\.F03$|\\.F08$)") list( APPEND ${_PAR_TARGET}_fortran_srcs ${src} ) endif() endforeach() foreach( src ${_PAR_SOURCES} ) if(${src} MATCHES "(\\.cu$)") list( APPEND ${_PAR_TARGET}_cuda_srcs ${src} ) endif() endforeach() set_source_files_properties( ${${_PAR_TARGET}_fortran_srcs} PROPERTIES LANGUAGE Fortran ) set( ${_PAR_TARGET}_h_srcs "${${_PAR_TARGET}_h_srcs}" PARENT_SCOPE ) set( ${_PAR_TARGET}_c_srcs "${${_PAR_TARGET}_c_srcs}" PARENT_SCOPE ) set( ${_PAR_TARGET}_cxx_srcs "${${_PAR_TARGET}_cxx_srcs}" PARENT_SCOPE ) set( ${_PAR_TARGET}_fortran_srcs "${${_PAR_TARGET}_fortran_srcs}" PARENT_SCOPE ) set( ${_PAR_TARGET}_cuda_srcs "${${_PAR_TARGET}_cuda_srcs}" PARENT_SCOPE ) endfunction( ecbuild_separate_sources ) ecbuild-3.14.1/cmake/FindNetCDF.cmake0000664000175000017500000002052015200367620017321 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. # Try to find NetCDF includes and library # # This module defines # # - NetCDF_FOUND - System has NetCDF # - NetCDF_VERSION - the version of NetCDF # # Following components are available: # # - C - C interface to NetCDF (netcdf) # - CXX - CXX4 interface to NetCDF (netcdf_c++4) # - Fortran - Fortran interface to NetCDF (netcdff) # - CXX_LEGACY - Legacy C++ interface to NetCDF (netcdf_c++) # # For each component the following are defined: # # - NetCDF__FOUND - whether the component is found # - NetCDF::NetCDF_ - target of component to be used with target_link_libraries() # # Caveat: The targets might not link properly with static libraries, setting NetCDF__EXTRA_LIBRARIES may be required. # # The following paths will be searched in order if set in CMake (first priority) or environment (second priority) # # - NetCDF__ROOT # - NetCDF__DIR # - NetCDF__PATH # - The same variables with a NETCDF, NetCDF4, or NETCDF4 prefix instead of NetCDF # - NetCDF_ROOT # - NetCDF_DIR # - NetCDF_PATH # - The same variables with a NETCDF, NetCDF4, or NETCDF4 prefix instead of NetCDF # # The following variables affect the targets and NetCDF*_LIBRARIES variables: # # - NetCDF__EXTRA_LIBRARIES - added to NetCDF::NetCDF_ INTERFACE_LINK_LIBRARIES and NetCDF__LIBRARIES # # Notes: # # - If no components are defined, only the C component will be searched. # list( APPEND _possible_components C CXX Fortran CXX_LEGACY ) ## Header names for each component set( NetCDF_C_INCLUDE_NAME netcdf.h ) set( NetCDF_CXX_INCLUDE_NAME netcdf ) set( NetCDF_CXX_LEGACY_INCLUDE_NAME netcdfcpp.h ) set( NetCDF_Fortran_INCLUDE_NAME netcdf.mod NETCDF.mod ) ## Library names for each component set( NetCDF_C_LIBRARY_NAME netcdf ) set( NetCDF_CXX_LIBRARY_NAME netcdf_c++4 netcdf-cxx4 ) set( NetCDF_CXX_LEGACY_LIBRARY_NAME netcdf_c++ ) set( NetCDF_Fortran_LIBRARY_NAME netcdff ) foreach( _comp ${_possible_components} ) string( TOUPPER "${_comp}" _COMP ) set( _arg_${_COMP} ${_comp} ) set( _name_${_COMP} ${_comp} ) endforeach() unset( _search_components ) foreach( _comp ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS} ) string( TOUPPER "${_comp}" _COMP ) set( _arg_${_COMP} ${_comp} ) list( APPEND _search_components ${_name_${_COMP}} ) if( NOT _name_${_COMP} ) message( FATAL_ERROR "Find${CMAKE_FIND_PACKAGE_NAME}: COMPONENT ${_comp} is not a valid component. Valid components: ${_possible_components}" ) endif() endforeach() if( NOT _search_components ) set( _search_components C ) endif() ## Search hints for finding include directories and libraries foreach( _comp IN ITEMS "" "C" "CXX" "Fortran" "CXX_LEGACY" ) set( __comp "_${_comp}" ) if( NOT _comp ) set( __comp "" ) endif() set( _search_hints${__comp} ) foreach( _name IN ITEMS NetCDF NETCDF NetCDF4 NETCDF4 ) foreach( _var IN ITEMS ROOT DIR PATH ) list( APPEND _search_hints${__comp} ${${_name}${__comp}_${_var}} ENV ${_name}${__comp}_${_var} ) endforeach() endforeach() ## Old-school HPC module env variable names foreach( _name IN ITEMS NetCDF NETCDF NetCDF4 NETCDF4 ) list(APPEND _search_hints${__comp} ${${_name}${__comp}} ENV ${_name}${__comp}) endforeach() endforeach() set( _found FALSE ) set( _req_vars ) foreach( _comp ${_search_components} ) list( APPEND _req_vars NetCDF_${_comp}_INCLUDE_DIR NetCDF_${_comp}_LIBRARY ) ## Find include directories find_path(NetCDF_${_comp}_INCLUDE_DIR NAMES ${NetCDF_${_comp}_INCLUDE_NAME} DOC "netcdf ${_comp} include directory" HINTS ${_search_hints_${_comp}} ${_search_hints} PATH_SUFFIXES include ../../include ) mark_as_advanced(NetCDF_${_comp}_INCLUDE_DIR) ## Find libraries for each component string( TOUPPER "${_comp}" _COMP ) find_library(NetCDF_${_comp}_LIBRARY NAMES ${NetCDF_${_comp}_LIBRARY_NAME} DOC "netcdf ${_comp} library" HINTS ${_search_hints_${_comp}} ${_search_hints} PATH_SUFFIXES lib ../../lib ) mark_as_advanced(NetCDF_${_comp}_LIBRARY) if( NetCDF_${_comp}_LIBRARY AND NOT (NetCDF_${_comp}_LIBRARY MATCHES ".a$") ) set( NetCDF_${_comp}_LIBRARY_SHARED TRUE ) endif() if( NetCDF_${_comp}_LIBRARY AND NetCDF_${_comp}_INCLUDE_DIR ) set( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND TRUE ) set( _found TRUE ) if (NOT TARGET NetCDF::NetCDF_${_comp}) add_library(NetCDF::NetCDF_${_comp} UNKNOWN IMPORTED) set_target_properties(NetCDF::NetCDF_${_comp} PROPERTIES IMPORTED_LOCATION "${NetCDF_${_comp}_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_${_comp}_INCLUDE_DIR}") if( DEFINED NetCDF_${_comp}_EXTRA_LIBRARIES ) target_link_libraries(NetCDF::NetCDF_${_comp} INTERFACE ${NetCDF_${_comp}_EXTRA_LIBRARIES}) endif() endif() endif() endforeach() ## Find version if (_found) set( _config_search_hints ${_search_hints} ) set( _include_dirs ) foreach( _comp ${_search_components} ) if( DEFINED _search_hints_${_comp} ) list( APPEND _config_search_hints ${_search_hints_${_comp}} ) endif() if( DEFINED NetCDF_${_comp}_INCLUDE_DIR ) list( APPEND _include_dirs ${NetCDF_${_comp}_INCLUDE_DIR} ) endif() endforeach() if( _config_search_hints ) list( REMOVE_DUPLICATES _config_search_hints ) endif() if( _include_dirs ) list( REMOVE_DUPLICATES _include_dirs ) endif() find_program( NETCDF_CONFIG_EXECUTABLE NAMES nc-config HINTS ${_config_search_hints} PATH_SUFFIXES bin Bin ../../bin DOC "NetCDF nc-config helper" ) mark_as_advanced( NETCDF_CONFIG_EXECUTABLE ) find_file( NETCDF_META_H NAMES netcdf_meta.h HINTS ${_include_dirs} NO_DEFAULT_PATH DOC "NetCDF path to netcdf_meta.h" ) mark_as_advanced( NETCDF_META_H ) if( NETCDF_CONFIG_EXECUTABLE ) execute_process( COMMAND ${NETCDF_CONFIG_EXECUTABLE} --version RESULT_VARIABLE _netcdf_config_result OUTPUT_VARIABLE _netcdf_config_version) if( _netcdf_config_result EQUAL 0 ) string(REGEX REPLACE ".* ((([0-9]+)\\.)+([0-9]+)).*" "\\1" NetCDF_VERSION "${_netcdf_config_version}" ) endif() elseif( NETCDF_META_H ) file(STRINGS ${NETCDF_META_H} _netcdf_version_lines REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)") string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}") string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}") string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}") string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}") set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}") unset(_netcdf_version_major) unset(_netcdf_version_minor) unset(_netcdf_version_patch) unset(_netcdf_version_note) unset(_netcdf_version_lines) endif() endif () ## Finalize find_package include(FindPackageHandleStandardArgs) find_package_handle_standard_args( ${CMAKE_FIND_PACKAGE_NAME} REQUIRED_VARS ${_req_vars} VERSION_VAR NetCDF_VERSION HANDLE_COMPONENTS ) if( ${CMAKE_FIND_PACKAGE_NAME}_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY ) message( STATUS "Find${CMAKE_FIND_PACKAGE_NAME} defines targets:" ) foreach( _comp ${_search_components} ) string( TOUPPER "${_comp}" _COMP ) if( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND ) message( STATUS " - NetCDF::NetCDF_${_comp} [${NetCDF_${_comp}_LIBRARY}]") endif() endforeach() endif() ## Backwards compatibility, only reachable if ECBUILD_2_COMPAT is ON # Assumes the following internal variables are defined: # - _search_components # - _arg_ # - NetCDF__INCLUDE_DIR # - NetCDF__LIBRARY include( netcdf_compat OPTIONAL ) ecbuild-3.14.1/cmake/ecbuild_find_python.cmake0000664000175000017500000001420515200367620021470 0ustar alastairalastair# (C) Copyright 2011- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_find_python # =================== # # Find Python interpreter, its version and the Python libraries. :: # # ecbuild_find_python( [ VERSION ] [ REQUIRED ] [ NO_LIBS ] ) # # Options # ------- # # VERSION : optional # minimum required version # # REQUIRED : optional # fail if Python was not found # # NO_LIBS : optional # only search for the Python interpreter, not the libraries # # Unless ``NO_LIBS`` is set, the ``python-config`` utility, if found, is used # to determine the Python include directories, libraries and link line. Set the # CMake variable ``PYTHON_NO_CONFIG`` to use CMake's FindPythonLibs instead. # # Output variables # ---------------- # # The following CMake variables are set if python was found: # # :Python_Interpreter_FOUND: Python interpreter was found # :Python_Development_FOUND: Python (development) libraries were found # :Python_FOUND: Python was found (both interpreter and libraries) # :Python_EXECUTABLE: Python executable # :Python_VERSION_MAJOR: Major version number # :Python_VERSION_MINOR: Minor version number # :Python_VERSION_PATCH: Patch version number # :Python_VERSION: Python version # :Python_INCLUDE_DIRS: Python include directories # :Python_LIBRARIES: Python libraries # :Python_SITELIB: Python site packages directory # # The following variables with prefix ``PYTHON_`` are now *DEPRECATED* and # will be removed in a future version; these variables are still set for # backwards compatibility. The new variables with prefix ``Python_`` # should be used instead. # # :PYTHONINTERP_FOUND: Python interpreter was found # :PYTHONLIBS_FOUND: Python libraries were found # :PYTHON_FOUND: Python was found (both interpreter and libraries) # :PYTHON_EXECUTABLE: Python executable # :PYTHON_VERSION_MAJOR: major version number # :PYTHON_VERSION_MINOR: minor version number # :PYTHON_VERSION_PATCH: patch version number # :PYTHON_VERSION_STRING: Python version # :PYTHON_INCLUDE_DIRS: Python include directories # :PYTHON_LIBRARIES: Python libraries # :PYTHON_SITE_PACKAGES: Python site packages directory # ############################################################################## set( __test_python ${CMAKE_CURRENT_LIST_DIR}/pymain.c ) function( ecbuild_find_python ) # parse parameters set( options REQUIRED NO_LIBS ) set( single_value_args VERSION ) set( multi_value_args ) cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if(_p_UNPARSED_ARGUMENTS) ecbuild_critical("Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"") endif() if( _p_REQUIRED ) ecbuild_debug( "ecbuild_find_python: Searching for Python interpreter (required) ..." ) set( _p_REQUIRED REQUIRED ) else() ecbuild_debug( "ecbuild_find_python: Searching for Python interpreter ..." ) unset( _p_REQUIRED ) endif() # find python interpreter/executable # Search first without specifying the version, since doing so gives preference to the specified # version even though a never version of the interpreter may be available if ( _p_NO_LIBS ) find_package( Python ${_p_VERSION} COMPONENTS Interpreter ${_p_REQUIRED} ) set( __required_vars Python_FOUND Python_Interpreter_FOUND ) else() find_package( Python ${_p_VERSION} COMPONENTS Interpreter Development ${_p_REQUIRED} ) set( __required_vars Python_FOUND Python_Interpreter_FOUND Python_Development_FOUND ) endif() if( Python_Interpreter_FOUND ) ecbuild_debug( "ecbuild_find_python: Found Python interpreter version '${Python_VERSION}' at '${Python_EXECUTABLE}'" ) # python site-packages are located at... ecbuild_debug( "ecbuild_find_python: Python_SITELIB=${Python_SITELIB}" ) else() ecbuild_debug( "ecbuild_find_python: could NOT find Python interpreter!" ) endif() find_package_handle_standard_args( Python DEFAULT_MSG ${__required_vars} ) set( Python_FOUND ${Python_FOUND} PARENT_SCOPE ) set( Python_Interpreter_FOUND ${Python_Interpreter_FOUND} PARENT_SCOPE ) set( Python_Development_FOUND ${Python_Development_FOUND} PARENT_SCOPE ) set( Python_EXECUTABLE ${Python_EXECUTABLE} PARENT_SCOPE ) set( Python_VERSION_MAJOR ${Python_VERSION_MAJOR} PARENT_SCOPE ) set( Python_VERSION_MINOR ${Python_VERSION_MINOR} PARENT_SCOPE ) set( Python_VERSION_PATCH ${Python_VERSION_PATCH} PARENT_SCOPE ) set( Python_VERSION ${Python_VERSION} PARENT_SCOPE ) set( Python_INCLUDE_DIRS ${Python_INCLUDE_DIRS} PARENT_SCOPE ) set( Python_LIBRARIES ${Python_LIBRARIES} PARENT_SCOPE ) set( Python_SITELIB ${Python_SITELIB} PARENT_SCOPE ) # To keep backwards compatibility, the old variable names (PYTHON_*) are set as well set( PYTHON_FOUND "${Python_FOUND}" PARENT_SCOPE ) set( PYTHONINTERP_FOUND "${Python_Interpreter_FOUND}" PARENT_SCOPE ) set( PYTHONLIBS_FOUND "${Python_Development_FOUND}" PARENT_SCOPE ) set( PYTHON_EXECUTABLE "${Python_EXECUTABLE}" PARENT_SCOPE ) set( PYTHON_VERSION_MAJOR "${Python_VERSION_MAJOR}" PARENT_SCOPE ) set( PYTHON_VERSION_MINOR "${Python_VERSION_MINOR}" PARENT_SCOPE ) set( PYTHON_VERSION_PATCH "${Python_VERSION_PATCH}" PARENT_SCOPE ) set( PYTHON_VERSION_STRING "${Python_VERSION}" PARENT_SCOPE ) set( PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" PARENT_SCOPE ) set( PYTHON_LIBRARIES "${Python_LIBRARIES}" PARENT_SCOPE ) set( PYTHON_SITE_PACKAGES "${Python_SITELIB}" PARENT_SCOPE ) endfunction( ecbuild_find_python ) ecbuild-3.14.1/cmake/ecbuild_generate_project_config.cmake0000664000175000017500000000556215200367620024022 0ustar alastairalastair# (C) Copyright 2019- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation nor # does it submit to any jurisdiction. ############################################################################## #.rst: # # ecbuild_generate_project_config # =============================== # # Generate the -config.cmake file :: # # ecbuild_generate_project_config(