diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..0e0427e9675aec2b827df6c3f96d745b1f14b167 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,91 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# List of the CI build stages. +stages: + - dependencies + - build + +# Common setup for the CI Docker images. +before_script: + - yum -y install glibc-devel which git make gmp-devel + - set +e && source CI/setup_lcg.sh; set -e + +# Build the upstream project(s) needed by this one. +.dependencies_template: &dependencies_template + stage: dependencies + tags: + - docker + - cvmfs + script: + - git clone https://gitlab.cern.ch/GeoModelDev/GeoModelCore.git + - git clone https://gitlab.cern.ch/GeoModelDev/GeoModelIO.git + - mkdir GeoModelCore-build GeoModelIO-build + - cd GeoModelCore-build/ + - cmake -GNinja -DCMAKE_INSTALL_PREFIX=../dependencies-install ${CMAKE_EXTRA_FLAGS} ../GeoModelCore/ + - cmake --build . --target install + - cd ../GeoModelIO-build/ + - cmake -GNinja -DCMAKE_INSTALL_PREFIX=../dependencies-install -DCMAKE_PREFIX_PATH=${PWD}/../dependencies-install ${CMAKE_EXTRA_FLAGS} ../GeoModelIO/ + - cmake --build . --target install + artifacts: + paths: + - dependencies-install/ + +dependencies:slc6: + <<: *dependencies_template + image: cern/slc6-base:latest + +dependencies:centos7: + <<: *dependencies_template + image: cern/cc7-base:latest + +dependencies:slc6-standalone: + <<: *dependencies_template + image: cern/slc6-base:latest + variables: + CMAKE_EXTRA_FLAGS: -DGEOMODEL_USE_BUILTIN_EIGEN3=TRUE + +dependencies:centos7-standalone: + <<: *dependencies_template + image: cern/cc7-base:latest + variables: + CMAKE_EXTRA_FLAGS: -DGEOMODEL_USE_BUILTIN_EIGEN3=TRUE + +# Build this project. +.build_template: &build_template + stage: build + tags: + - docker + - cvmfs + script: + - mkdir build + - cd build/ + - cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=${PWD}/../dependencies-install ${CMAKE_EXTRA_FLAGS} ../ + - cmake --build . + +build:slc6: + <<: *build_template + image: cern/slc6-base:latest + dependencies: + - dependencies:slc6 + +build:centos7: + <<: *build_template + image: cern/cc7-base:latest + dependencies: + - dependencies:centos7 + +build:slc6-standalone: + <<: *build_template + image: cern/slc6-base:latest + dependencies: + - dependencies:slc6-standalone + variables: + CMAKE_EXTRA_FLAGS: -DGEOMODEL_USE_BUILTIN_XERCESC=TRUE -DGEOMODEL_USE_BUILTIN_JSON=TRUE + +build:centos7-standalone: + <<: *build_template + image: cern/cc7-base:latest + dependencies: + - dependencies:centos7-standalone + variables: + CMAKE_EXTRA_FLAGS: -DGEOMODEL_USE_BUILTIN_XERCESC=TRUE -DGEOMODEL_USE_BUILTIN_JSON=TRUE diff --git a/CI/setup_lcg.sh b/CI/setup_lcg.sh new file mode 100644 index 0000000000000000000000000000000000000000..cacad8fa7b5d0662eb9c947fbc46e927721b2c22 --- /dev/null +++ b/CI/setup_lcg.sh @@ -0,0 +1,25 @@ +#!/bin/sh -ex +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# Setup an LCG view via cvmfs. +# + +# determine os release +if [ "$(cat /etc/redhat-release | grep 'Scientific Linux CERN SLC release 6')" ]; then + os=slc6 + compiler=gcc8-opt +elif [ "$(cat /etc/centos-release | grep 'CentOS Linux release 7')" ]; then + os=centos7 + compiler=gcc9-opt +else + echo "Unknown OS" 1>&2 + exit 1 +fi + +release=LCG_96b +platform=x86_64-${os}-${compiler} +lcg=/cvmfs/sft.cern.ch/lcg/views/${release}/${platform} + +source ${lcg}/setup.sh + diff --git a/CMakeLists.txt b/CMakeLists.txt index bd67d951fd49fa25a66e830c1ac9326d6b432a28..8c31c2ab89de660e0f5d2419b902442d5b320414 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,62 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + # Set up the project. cmake_minimum_required( VERSION 3.1 ) -project( "GeoModelTools" VERSION 1.0.0 LANGUAGES CXX ) +project( "GeoModelTools" VERSION 3.1.2 LANGUAGES CXX ) + +# Set default build options. +set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" ) +set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" ) +set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" ) + +# Make the module directory visible to CMake. +list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) + +# Use the GNU install directory names. +include( GNUInstallDirs ) + +# Set up the "optional" dependencies. +include( SetupXercesC ) +include( SetupJSON ) + +# Find the externals needed by the project. +find_package( GeoModelCore REQUIRED ) +find_package( GeoModelIO REQUIRED ) + +# Set up the build of the libraries of the project. +add_subdirectory( GeoModelXMLParser ) +add_subdirectory( GeoModelJSONParser ) +add_subdirectory( ExpressionEvaluator ) +add_subdirectory( GMCAT ) -add_subdirectory(GeoModelXMLParser) -add_subdirectory(GeoModelJSONParser) -add_subdirectory(ExpressionEvaluator) -add_subdirectory(GMCAT) +# Create and install the version description of the project. +include( WriteBasicConfigVersionFile ) +write_basic_config_version_file( + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion ) +install( + FILES + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake + COMPONENT Development + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) -install(EXPORT GeoModelJSONParser-export FILE GeoModelTools-GeoModelJSONParser.cmake DESTINATION lib/cmake/GeoModelTools) -install(EXPORT GeoModelXMLParser-export FILE GeoModelTools-GeoModelXMLParser.cmake DESTINATION lib/cmake/GeoModelTools) -install(EXPORT ExpressionEvaluator-export FILE GeoModelTools-ExpressionEvaluator.cmake DESTINATION lib/cmake/GeoModelTools) +# Create and install the description of the libraries. +install( EXPORT ${PROJECT_NAME}-export + FILE ${PROJECT_NAME}Targets.cmake + COMPONENT Development + NAMESPACE "${PROJECT_NAME}::" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) -install(FILES cmake/GeoModelToolsConfig.cmake DESTINATION lib/cmake/GeoModelTools) +# Install the hand-written project configuration. +configure_file( ${CMAKE_SOURCE_DIR}/cmake/GeoModelToolsConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake + @ONLY ) +install( + FILES + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake + COMPONENT Development + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) +# Set up the packaging of the project using CPack. +include( GeoModelToolsPackaging ) diff --git a/ExpressionEvaluator/CMakeLists.txt b/ExpressionEvaluator/CMakeLists.txt index 2e8c273e2c4f3297ab8b98318154cc2704de7865..e5e882f45ef71ce8aa73d8017cda352d0d6e1b77 100644 --- a/ExpressionEvaluator/CMakeLists.txt +++ b/ExpressionEvaluator/CMakeLists.txt @@ -1,17 +1,4 @@ -cmake_minimum_required( VERSION 3.1 ) - -# Set up the project. -project( "ExpressionEvaluator" VERSION 1.0.0 LANGUAGES CXX ) - -# Set default build options. -set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" ) -set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" ) -set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" ) - -# Use the GNU install directory names. -include( GNUInstallDirs ) - -find_package( GeoModelCore REQUIRED ) +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Find the header and source files. file( GLOB SOURCES src/*.cxx ) @@ -19,36 +6,28 @@ file( GLOB HEADERS ExpressionEvaluator/*.h ) # Create the library. add_library( ExpressionEvaluator SHARED ${HEADERS} ${SOURCES} ) -set_property( TARGET ExpressionEvaluator - PROPERTY PUBLIC_HEADER ${HEADERS} ) -target_link_libraries( ExpressionEvaluator PUBLIC GeoModelCore::GeoModelKernel ) -target_include_directories( ExpressionEvaluator SYSTEM PUBLIC ) +target_link_libraries( ExpressionEvaluator PRIVATE + GeoModelCore::GeoModelKernel ) target_include_directories( ExpressionEvaluator PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<INSTALL_INTERFACE:include> ) + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) source_group( "ExpressionEvaluator" FILES ${HEADERS} ) source_group( "src" FILES ${SOURCES} ) - -# # Install the library. -# install( TARGETS ExpressionEvaluator -# EXPORT ExpressionEvaluator -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ExpressionEvaluator ) - -# Install a CMake description of the project/library. -# install( EXPORT ExpressionEvaluator DESTINATION cmake ) - - -# new test GeoModelCore -install( TARGETS ExpressionEvaluator EXPORT ExpressionEvaluator-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ExpressionEvaluator ) -# -# Version the shared library. (Please update when cutting a new release!) -# -set(MYLIB_VERSION_MAJOR 1) -set(MYLIB_VERSION_MINOR 1) -set(MYLIB_VERSION_PATCH 0) -set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH}) - -set_target_properties(ExpressionEvaluator PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR}) - +set_target_properties( ExpressionEvaluator PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} ) + +# Install the library. +install( TARGETS ExpressionEvaluator + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Runtime + NAMELINK_SKIP ) +install( TARGETS ExpressionEvaluator + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development + NAMELINK_ONLY ) +install( FILES ${HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ExpressionEvaluator + COMPONENT Development ) diff --git a/GMCAT/CMakeLists.txt b/GMCAT/CMakeLists.txt index 67fb628ed2f2a363ea302a98c2352eb25aaed0ea..392472ec03181bc5318cd53c38e85bab1e1946c7 100644 --- a/GMCAT/CMakeLists.txt +++ b/GMCAT/CMakeLists.txt @@ -1,27 +1,20 @@ - -set(MYLIB_VERSION_MAJOR 1) -set(MYLIB_VERSION_MINOR 0) -set(MYLIB_VERSION_PATCH 0) - -set( CMAKE_BUILD_TYPE DEBUG ) -set(CMAKE_CXX_FLAGS "-fPIC -O0 -g -gdwarf-2" ) - -project ( "gmcat" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) - -find_package( GeoModelCore REQUIRED ) -find_package( GeoModelIO REQUIRED ) -find_package( Eigen3 REQUIRED ) -file( GLOB SOURCES src/*.cxx ) - -include_directories ("${PROJECT_SOURCE_DIR}") -include_directories ("${PROJECT_SOURCE_DIR}/src") -add_executable ( gmcat ${SOURCES} ${HEADERS} ) - -# External dependencies: - -target_link_libraries (gmcat GeoModelCore::GeoModelKernel GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite ) -install(TARGETS gmcat DESTINATION bin) - - - - +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Declare the package's executable. +add_executable( gmcat src/gmcat.cxx ) +target_link_libraries( gmcat PRIVATE GeoModelCore::GeoModelKernel + GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite + GeoModelIO::GeoModelDBManager ) + +# Tweak how debug information should be attached to the executable, in Debug +# builds. +if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND + "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" ) + target_compile_options( gmcat PRIVATE "-gdwarf-2" ) +endif() + +# Install the executable. +install( TARGETS gmcat + EXPORT ${PROJECT_NAME}-export + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT Runtime ) diff --git a/GeoModelJSONParser/CMakeLists.txt b/GeoModelJSONParser/CMakeLists.txt index ee5815453b56cfffa93b567dda1c5e80877c75b4..03f7a90fbcab87520a3540695df10b905b087ac1 100644 --- a/GeoModelJSONParser/CMakeLists.txt +++ b/GeoModelJSONParser/CMakeLists.txt @@ -1,20 +1,4 @@ -cmake_minimum_required( VERSION 3.1 ) - -# Set up the project. -project( "GeoModelJSONParser" VERSION 1.0.0 LANGUAGES CXX ) - -find_package( GeoModelCore REQUIRED ) -find_package( nlohmann_json QUIET ) -find_package( Eigen3 REQUIRED ) - - -# Set default build options. -set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" ) -set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" ) -set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" ) - -# Use the GNU install directory names. -include( GNUInstallDirs ) +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Find the header and source files. file( GLOB SOURCES src/*.cxx ) @@ -22,29 +6,30 @@ file( GLOB HEADERS GeoModelJSONParser/*.h ) # Create the library. add_library( GeoModelJSONParser SHARED ${HEADERS} ${SOURCES} ) -set_property( TARGET GeoModelJSONParser - PROPERTY PUBLIC_HEADER ${HEADERS} ) -if( nlohmann_json_FOUND ) - target_link_libraries( GeoModelJSONParser PUBLIC nlohmann_json::nlohmann_json GeoModelCore::GeoModelKernel ) -else() - message(STATUS "'nlohmann_json' not found by CMake!! Anyway, if you installed the single header file in a standard system include dir, I will be able to use it.") - target_link_libraries( GeoModelJSONParser PUBLIC GeoModelCore::GeoModelKernel ) -endif() -target_include_directories( GeoModelJSONParser SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR} ) +target_link_libraries( GeoModelJSONParser PUBLIC nlohmann_json::nlohmann_json ) target_include_directories( GeoModelJSONParser PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<INSTALL_INTERFACE:include> ) + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) source_group( "GeoModelJSONParser" FILES ${HEADERS} ) source_group( "src" FILES ${SOURCES} ) +set_target_properties( GeoModelJSONParser PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} ) +if( GEOMODEL_USE_BUILTIN_JSON ) + add_dependencies( GeoModelJSONParser JSON ) +endif() -install( TARGETS GeoModelJSONParser EXPORT GeoModelJSONParser-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoModelJSONParser ) -# -# Version the shared library. (Please update when cutting a new release!) -# -set(MYLIB_VERSION_MAJOR 1) -set(MYLIB_VERSION_MINOR 1) -set(MYLIB_VERSION_PATCH 0) -set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH}) - -set_target_properties(GeoModelJSONParser PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR}) +# Install the library. +install( TARGETS GeoModelJSONParser + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Runtime + NAMELINK_SKIP ) +install( TARGETS GeoModelJSONParser + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development + NAMELINK_ONLY ) +install( FILES ${HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoModelJSONParser + COMPONENT Development ) diff --git a/GeoModelXMLParser/CMakeLists.txt b/GeoModelXMLParser/CMakeLists.txt index 59a586eb7f3518d078018a922f8a216c70c747b6..47d12c2623b2eea3f023dbdbc3663f8a9636f8cd 100644 --- a/GeoModelXMLParser/CMakeLists.txt +++ b/GeoModelXMLParser/CMakeLists.txt @@ -1,19 +1,4 @@ -cmake_minimum_required( VERSION 3.1 ) - -# Set up the project. -project( "GeoModelXMLParser" VERSION 1.0.0 LANGUAGES CXX ) - -find_package( GeoModelCore REQUIRED ) -find_package( XercesC REQUIRED ) - - -# Set default build options. -set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" ) -set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" ) -set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" ) - -# Use the GNU install directory names. -include( GNUInstallDirs ) +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Find the header and source files. file( GLOB SOURCES src/*.cxx ) @@ -21,36 +6,31 @@ file( GLOB HEADERS GeoModelXMLParser/*.h ) # Create the library. add_library( GeoModelXMLParser SHARED ${HEADERS} ${SOURCES} ) -set_property( TARGET GeoModelXMLParser - PROPERTY PUBLIC_HEADER ${HEADERS} ) -target_link_libraries( GeoModelXMLParser PUBLIC ExpressionEvaluator XercesC::XercesC GeoModelCore::GeoModelKernel ) -target_include_directories( GeoModelXMLParser SYSTEM PUBLIC ) +target_link_libraries( GeoModelXMLParser PUBLIC XercesC::XercesC + ExpressionEvaluator ) target_include_directories( GeoModelXMLParser PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<INSTALL_INTERFACE:include> ) + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) source_group( "GeoModelXMLParser" FILES ${HEADERS} ) source_group( "src" FILES ${SOURCES} ) - -# # Install the library. -# install( TARGETS GeoModelXMLParser -# EXPORT GeoModelXMLParser -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoModelXMLParser ) - -# Install a CMake description of the project/library. -# install( EXPORT GeoModelXMLParser DESTINATION cmake ) - - -# new test GeoModelCore -install( TARGETS GeoModelXMLParser EXPORT GeoModelXMLParser-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoModelXMLParser ) -# -# Version the shared library. (Please update when cutting a new release!) -# -set(MYLIB_VERSION_MAJOR 1) -set(MYLIB_VERSION_MINOR 1) -set(MYLIB_VERSION_PATCH 0) -set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH}) - -set_target_properties(GeoModelXMLParser PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR}) - +set_target_properties( GeoModelXMLParser PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} ) +if( GEOMODEL_USE_BUILTIN_XERCESC ) + add_dependencies( GeoModelXMLParser XercesC ) +endif() + +# Install the library. +install( TARGETS GeoModelXMLParser + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Runtime + NAMELINK_SKIP ) +install( TARGETS GeoModelXMLParser + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development + NAMELINK_ONLY ) +install( FILES ${HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoModelXMLParser + COMPONENT Development ) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c8f313a89ab99d4c3c3bda6be312aa07d2009497 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + 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 2019 GeoModelDev + + 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. diff --git a/cmake/GeoModelToolsConfig.cmake b/cmake/GeoModelToolsConfig.cmake deleted file mode 100644 index 9ae634f706c5abebb85f2202e258dbc31c68b5f6..0000000000000000000000000000000000000000 --- a/cmake/GeoModelToolsConfig.cmake +++ /dev/null @@ -1,5 +0,0 @@ -get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -include(${SELF_DIR}/GeoModelTools-ExpressionEvaluator.cmake) -include(${SELF_DIR}/GeoModelTools-GeoModelJSONParser.cmake) -include(${SELF_DIR}/GeoModelTools-GeoModelXMLParser.cmake) - diff --git a/cmake/GeoModelToolsConfig.cmake.in b/cmake/GeoModelToolsConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..e8dfa06b83c53284430404ec5ddd12c6ef8d69a1 --- /dev/null +++ b/cmake/GeoModelToolsConfig.cmake.in @@ -0,0 +1,24 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# First off, import the upstream dependencies of the project. +find_package( GeoModelCore @GeoModelCore_VERSION@ ) +find_package( GeoModelIO @GeoModelIO_VERSION@ ) +find_package( nlohmann_json @nlohmann_json_VERSION@ ) +find_package( XercesC @XercesC_VERSION@ ) + +# Include the exported configuration of GeoModelCore. +get_filename_component( SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) +include( ${SELF_DIR}/GeoModelToolsTargets.cmake ) + +# Set the version of the installed project. +set( GeoModelTools_VERSION "@PROJECT_VERSION@" ) + +# Print some standard messages about the package being found. +include( FindPackageHandleStandardArgs ) +find_package_handle_standard_args( GeoModelTools + FOUND_VAR GeoModelTools_FOUND + REQUIRED_VARS SELF_DIR + VERSION_VAR GeoModelTools_VERSION ) + +# Clean up. +unset( SELF_DIR ) diff --git a/cmake/GeoModelToolsPackaging.cmake b/cmake/GeoModelToolsPackaging.cmake new file mode 100644 index 0000000000000000000000000000000000000000..fde8202df37834edcc712c5978ad8301c75a4b74 --- /dev/null +++ b/cmake/GeoModelToolsPackaging.cmake @@ -0,0 +1,34 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Set up the basic properties of the package(s). +set( CPACK_PACKAGE_DESCRIPTION_SUMMARY + "${PROJECT_NAME} - ${PROJECT_VERSION}" ) +set( CPACK_PACKAGE_DESCRIPTION + "Geometry model tool libraries" ) +set( CPACK_PACKAGE_VERSION "${PROJECT_VERSION}" ) +set( CPACK_PACKAGE_CONTACT "geomodel-developers@cern.ch" ) + +# Set up the readme and license for the package. +set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE ) +set( CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README.md ) +set( CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md ) + +# Set up the handling of the Runtime and Development components during +# the packaging. +include( CPackComponent ) +set( CPACK_COMPONENTS_ALL Runtime Development ) +set( CPACK_RPM_COMPONENT_INSTALL TRUE ) +set( CPACK_DEB_COMPONENT_INSTALL TRUE ) +set( CPACK_COMPONENTS_IGNORE_GROUPS TRUE ) +cpack_add_component( Runtime + DISPLAY_NAME "GeoModelTools libraries/executables" + DESCRIPTION "Core runtime libraries/executables of GeoModelTools" + REQUIRED ) +cpack_add_component( Development + DISPLAY_NAME "GeoModelTools development" + DESCRIPTION "Development package for GeoModelTools" + DEPENDS Runtime + DISABLED ) + +# Include the main CPack configuration. +include( CPack ) diff --git a/cmake/SetupJSON.cmake b/cmake/SetupJSON.cmake new file mode 100644 index 0000000000000000000000000000000000000000..13a43e4428656ddb713ed4c8a1566fd19c6ba546 --- /dev/null +++ b/cmake/SetupJSON.cmake @@ -0,0 +1,55 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# This module is used to set up nlohmann_json for the project. Either by +# looking for it on the build machine, or by downloading it during the build +# itself. +# + +# Configuration option for how XercesC should be used. +option( GEOMODEL_USE_BUILTIN_JSON + "Download a version of nlohmann_json during the build" FALSE ) + +# Now do what was requested. +if( GEOMODEL_USE_BUILTIN_JSON ) + + # Tell the user what's happening. + message( STATUS "Building nlohmann_json as part of the project" ) + + # The include directory and library that will be produced. + set( nlohmann_json_INCLUDE_DIR + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/${CMAKE_INSTALL_INCLUDEDIR}" ) + set( nlohmann_json_INCLUDE_DIRS "${nlohmann_json_INCLUDE_DIR}" ) + + # Create the include directory already, otherwise CMake refuses to + # create the imported target. + file( MAKE_DIRECTORY "${nlohmann_json_INCLUDE_DIR}" ) + + # Build/install nlohmann_json using ExternalProject_Add(...). + include( ExternalProject ) + ExternalProject_Add( JSON + PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONBuild + INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall + URL "https://cern.ch/lcgpackages/tarFiles/sources/json-3.6.1.tar.gz" + URL_MD5 "c53592d55e7fec787cf0a406d36098a3" + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} + -DJSON_BuildTests:BOOL=OFF -DJSON_MultipleHeaders:BOOL=ON + BUILD_BYPRODUCTS "${nlohmann_json_INCLUDE_DIR}" ) + install( DIRECTORY + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JSONInstall/ + DESTINATION . + COMPONENT Development + USE_SOURCE_PERMISSIONS ) + + # Set up nlohmann_json's imported target. + add_library( nlohmann_json::nlohmann_json INTERFACE IMPORTED ) + set_target_properties( nlohmann_json::nlohmann_json PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}" ) + +else() + + # Just find an existing installation of nlohmann_json. + find_package( nlohmann_json ) + +endif() diff --git a/cmake/SetupXercesC.cmake b/cmake/SetupXercesC.cmake new file mode 100644 index 0000000000000000000000000000000000000000..1d86524f0feb7db97a0b1e29797e1302476f31d5 --- /dev/null +++ b/cmake/SetupXercesC.cmake @@ -0,0 +1,67 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# This module is used to set up XercesC for the project. Either by looking for +# it on the build machine, or by downloading it during the build itself. +# + +# Configuration option for how XercesC should be used. +option( GEOMODEL_USE_BUILTIN_XERCESC + "Download/build a version of XercesC during the build" FALSE ) + +# Now do what was requested. +if( GEOMODEL_USE_BUILTIN_XERCESC ) + + # Tell the user what's happening. + message( STATUS "Building XercesC as part of the project" ) + + # The include directory and library that will be produced. + set( XercesC_INCLUDE_DIR + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/${CMAKE_INSTALL_INCLUDEDIR}" ) + set( XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}" ) + set( XercesC_LIBRARY + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/lib/${CMAKE_SHARED_LIBRARY_PREFIX}xerces-c${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set( XercesC_LIBRARIES "${XercesC_LIBRARY}" ) + + # Create the include directory already, otherwise CMake refuses to + # create the imported target. + file( MAKE_DIRECTORY "${XercesC_INCLUDE_DIR}" ) + + # Build/install Eigen3 using ExternalProject_Add(...). + include( ExternalProject ) + ExternalProject_Add( XercesC + PREFIX "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCBuild" + INSTALL_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall" + URL "https://cern.ch/lcgpackages/tarFiles/sources/xerces-c-3.1.3.tar.gz" + URL_MD5 "70320ab0e3269e47d978a6ca0c0e1e2d" + CONFIGURE_COMMAND + ${CMAKE_COMMAND} -E env CXXFLAGS=-std=c++${CMAKE_CXX_STANDARD} + <SOURCE_DIR>/configure --disable-static --prefix=<INSTALL_DIR> + INSTALL_COMMAND make install + COMMAND ${CMAKE_COMMAND} -E remove -f + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/lib/${CMAKE_SHARED_LIBRARY_PREFIX}xerces-c.la" + COMMAND ${CMAKE_COMMAND} -E remove_directory + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/lib/pkgconfig" + BUILD_BYPRODUCTS "${XercesC_INCLUDE_DIR}" "${XercesC_LIBRARY}" ) + install( DIRECTORY + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/bin" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/lib" + DESTINATION . + COMPONENT Runtime + USE_SOURCE_PERMISSIONS ) + install( DIRECTORY "${XercesC_INCLUDE_DIR}" + DESTINATION . + COMPONENT Development + USE_SOURCE_PERMISSIONS ) + + # Set up XercesC's imported target. + add_library( XercesC::XercesC UNKNOWN IMPORTED ) + set_target_properties( XercesC::XercesC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${XercesC_INCLUDE_DIR}" + IMPORTED_LOCATION "${XercesC_LIBRARY}" ) + +else() + + # Just find an existing installation of XercesC. + find_package( XercesC REQUIRED ) + +endif()