|
| 1 | +#============================================================================ |
| 2 | +# |
| 3 | +# Copyright (c) Kitware, Inc. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0.txt |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | +#============================================================================ |
| 18 | +# |
| 19 | +# External project for the project. |
| 20 | +# |
| 21 | + |
| 22 | +set(proj shape4D) |
| 23 | + |
| 24 | +# Set dependency list |
| 25 | +set(${proj}_DEPENDENCIES |
| 26 | + "" |
| 27 | + ) |
| 28 | + |
| 29 | +# Include dependent projects if any |
| 30 | +ExternalProject_Include_Dependencies(${proj} |
| 31 | + PROJECT_VAR proj |
| 32 | + DEPENDS_VAR ${proj}_DEPENDENCIES |
| 33 | + SUPERBUILD_VAR Slicer_SUPERBUILD |
| 34 | + ) |
| 35 | + |
| 36 | +list(APPEND ${proj}_DEPENDENCIES Slicer) |
| 37 | + |
| 38 | +if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) |
| 39 | + message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !") |
| 40 | +endif() |
| 41 | + |
| 42 | +# Sanity checks |
| 43 | +if(DEFINED ${proj}_DIR AND NOT EXISTS ${${proj}_DIR}) |
| 44 | + message(FATAL_ERROR "${proj}_DIR variable is defined but corresponds to non-existing directory") |
| 45 | +endif() |
| 46 | + |
| 47 | +if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) |
| 48 | + |
| 49 | + set(config ${CMAKE_BUILD_TYPE}) |
| 50 | + if(DEFINED CMAKE_CONFIGURATION_TYPES) |
| 51 | + set(config ${CMAKE_CFG_INTDIR}) |
| 52 | + endif() |
| 53 | + |
| 54 | + set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) |
| 55 | + set(${proj}_PACKAGE_DIR ${${proj}_DIR}/${proj}-build) |
| 56 | + ExternalProject_Add(${proj} |
| 57 | + ${${proj}_EP_ARGS} |
| 58 | + GIT_REPOSITORY "${EP_GIT_PROTOCOL}://github.com/jcfr/shape4D.git" |
| 59 | + GIT_TAG "3f47cf711a3d21a441c1e46ea992b0f0480b5cf8" # slicersalt-2018-01-22-c74c766a4c |
| 60 | + SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} |
| 61 | + BINARY_DIR ${${proj}_DIR} |
| 62 | + INSTALL_COMMAND ${CMAKE_COMMAND} --build ${${proj}_PACKAGE_DIR} --config ${config} --target package |
| 63 | + CMAKE_CACHE_ARGS |
| 64 | + # Compiler settings |
| 65 | + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} |
| 66 | + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} |
| 67 | + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} |
| 68 | + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} |
| 69 | + -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} |
| 70 | + -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED} |
| 71 | + -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS} |
| 72 | + # Dependencies |
| 73 | + -DSlicer_DIR:PATH=${Slicer_INNER_BUILD_DIR} |
| 74 | + # Options |
| 75 | + -D${proj}_BUILD_SLICER_EXTENSION:BOOL=ON |
| 76 | + -DBUILD_TESTING:BOOL=OFF |
| 77 | + DEPENDS |
| 78 | + ${${proj}_DEPENDENCIES} |
| 79 | + ) |
| 80 | + |
| 81 | + list(APPEND ${APPLICATION_NAME}_EXTENSION_CPACK_PACKAGE_DIRS |
| 82 | + ${${proj}_PACKAGE_DIR}/_CPack_Packages |
| 83 | + ) |
| 84 | +else() |
| 85 | + ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES}) |
| 86 | +endif() |
0 commit comments