PACKAGE creates ZIP file

This commit is contained in:
Daniel Wolf 2016-01-12 22:04:11 +01:00
parent 2bfe671f82
commit eace5dbd1b
5 changed files with 75 additions and 25 deletions

View File

@ -4,7 +4,11 @@ cmake_minimum_required(VERSION 3.3)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Minimum OS X deployment version")
set(appName "Rhubarb Lip Sync")
set(appVersion "0.1.0-alpha")
set(appVersionMajor 0)
set(appVersionMinor 1)
set(appVersionPatch 0)
set(appVersionSuffix -alpha)
set(appVersion "${appVersionMajor}.${appVersionMinor}.${appVersionPatch}${appVersionSuffix}")
project(${appName})
@ -112,8 +116,28 @@ set(TEST_FILES
add_executable(runTests ${TEST_FILES})
target_link_libraries(runTests gtest gmock gmock_main)
# Copy resource files
set(CPACK_PACKAGE_NAME ${appName})
string(REPLACE " " "-" CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR ${appVersionMajor})
set(CPACK_PACKAGE_VERSION_MINOR ${appVersionMinor})
set(CPACK_PACKAGE_VERSION_PATCH ${appVersionPatch})
set(CPACK_PACKAGE_VERSION ${appVersion})
set(CPACK_GENERATOR ZIP)
# Copy resource files at build time; install them at package time
include(tools.cmake)
set(modelDir "${CMAKE_SOURCE_DIR}/lib/pocketsphinx-5prealpha-2015-08-05/model")
copy_after_build("${modelDir}/en-us/en-us-phone.lm.bin" "res/sphinx")
copy_after_build("${modelDir}/en-us/en-us/*" "res/sphinx/acoustic_model")
copy_and_install("${modelDir}/en-us/en-us-phone.lm.bin" "res/sphinx")
copy_and_install("${modelDir}/en-us/en-us/*" "res/sphinx/acoustic_model")
install(
TARGETS rhubarb
RUNTIME
DESTINATION .
)
install(
FILES README.md LICENSE.md
DESTINATION .
)
include(CPack)

38
lib/googletest.patch Normal file
View File

@ -0,0 +1,38 @@
diff --git a/lib/googletest/googlemock/CMakeLists.txt b/lib/googletest/googlemock/CMakeLists.txt
index beb259a..b9b53f6 100644
--- a/lib/googletest/googlemock/CMakeLists.txt
+++ b/lib/googletest/googlemock/CMakeLists.txt
@@ -102,14 +102,6 @@ endif()
########################################################################
#
-# Install rules
-install(TARGETS gmock gmock_main
- DESTINATION lib)
-install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock
- DESTINATION include)
-
-########################################################################
-#
# Google Mock's own tests.
#
# You can skip this section if you aren't interested in testing
diff --git a/lib/googletest/googletest/CMakeLists.txt b/lib/googletest/googletest/CMakeLists.txt
index 621d0f0..f949217 100644
--- a/lib/googletest/googletest/CMakeLists.txt
+++ b/lib/googletest/googletest/CMakeLists.txt
@@ -101,14 +101,6 @@ endif()
########################################################################
#
-# Install rules
-install(TARGETS gtest gtest_main
- DESTINATION lib)
-install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest
- DESTINATION include)
-
-########################################################################
-#
# Samples on how to link user tests with gtest or gtest_main.
#
# They are not built by default. To build them, set the

View File

@ -100,14 +100,6 @@ if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_include_directories(gmock_main INTERFACE "${gmock_SOURCE_DIR}/include")
endif()
########################################################################
#
# Install rules
install(TARGETS gmock gmock_main
DESTINATION lib)
install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock
DESTINATION include)
########################################################################
#
# Google Mock's own tests.

View File

@ -99,14 +99,6 @@ if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include")
endif()
########################################################################
#
# Install rules
install(TARGETS gtest gtest_main
DESTINATION lib)
install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest
DESTINATION include)
########################################################################
#
# Samples on how to link user tests with gtest or gtest_main.

View File

@ -1,4 +1,4 @@
function(copy_after_build sourceGlob relativeTargetDirectory)
function(copy_and_install sourceGlob relativeTargetDirectory)
# Set `sourcePaths`
file(GLOB sourcePaths "${sourceGlob}")
@ -6,12 +6,16 @@ function(copy_after_build sourceGlob relativeTargetDirectory)
# Set `fileName`
get_filename_component(fileName "${sourcePath}" NAME)
# Set `targetPath`
set(targetPath "$<TARGET_FILE_DIR:rhubarb>/${relativeTargetDirectory}/${fileName}")
# Copy file during build
add_custom_command(TARGET rhubarb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${sourcePath}" "${targetPath}"
COMMAND ${CMAKE_COMMAND} -E copy "${sourcePath}" "$<TARGET_FILE_DIR:rhubarb>/${relativeTargetDirectory}/${fileName}"
COMMENT "Creating '${relativeTargetDirectory}/${fileName}'"
)
# Install file
install(
FILES "${sourcePath}"
DESTINATION "${relativeTargetDirectory}"
)
endforeach()
endfunction()