James E. King III | b1d63e7 | 2019-01-22 14:16:39 -0500 | [diff] [blame] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
| 20 | if (IS_ABSOLUTE "${LIB_INSTALL_DIR}") |
| 21 | set(AS3_INSTALL_DIR "${LIB_INSTALL_DIR}/as3") |
| 22 | else () |
| 23 | set(AS3_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/as3") |
| 24 | endif () |
| 25 | |
| 26 | set(PRELEASE "true") |
| 27 | if (CMAKE_BUILD_TYPE MATCHES DEBUG) |
| 28 | set(PRELEASE "false") |
| 29 | endif () |
| 30 | |
| 31 | add_custom_target(ThriftAs3 ALL |
| 32 | COMMENT "Building as3 library using Gradle Wrapper" |
| 33 | COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} compileFlex |
| 34 | --console=plain --no-daemon |
| 35 | -Prelease=${PRELEASE} |
| 36 | "-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build" |
| 37 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 38 | ) |
| 39 | |
| 40 | # Enable publishing from CMake if the publishing information is provided |
| 41 | if (NOT CMAKE_BUILD_TYPE MATCHES DEBUG) |
| 42 | add_custom_target(MavenPublishAs3 |
| 43 | COMMENT "Publishing as3 library to Apache Maven staging" |
| 44 | COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} clean publishMavenPublicationToMavenRepository |
| 45 | --console=plain --no-daemon |
| 46 | -Prelease=${PRELEASE} |
| 47 | -Psign=${PRELEASE} |
| 48 | "-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build" |
| 49 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 50 | ) |
| 51 | endif () |
| 52 | |
| 53 | # Hook the CMake install process to the results from make ALL. |
| 54 | # This works best when 'make all && sudo make install/fast' is used. |
| 55 | # Using slash to end the source location to avoid copying the directory path. |
| 56 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build/libs/ |
| 57 | DESTINATION ${AS3_INSTALL_DIR} |
| 58 | FILES_MATCHING PATTERN "libthrift-as3.swc") |
| 59 | |
| 60 | if (BUILD_TESTING) |
| 61 | add_test(NAME As3Test |
| 62 | COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} test |
| 63 | --console=plain --no-daemon |
| 64 | -Prelease=${PRELEASE} |
| 65 | "-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build" |
| 66 | "-Pthrift.compiler=${THRIFT_COMPILER}" |
| 67 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 68 | endif () |