Refactored CMakeLists.txt; updated LICENSE.md

This commit is contained in:
Daniel Wolf 2015-12-21 08:23:01 +01:00
parent 35f8472ebf
commit fd842111dc
4 changed files with 142 additions and 60 deletions

View File

@ -126,10 +126,8 @@
<sourceFolder url="file://$MODULE_DIR$/lib/sphinxbase-5prealpha-2015-08-05/src/libsphinxbase/util/slamch.c" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/lib/sphinxbase-5prealpha-2015-08-05/src/libsphinxbase/util/slapack_lite.c" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/lib/sphinxbase-5prealpha-2015-08-05/src/libsphinxbase/util/strfuncs.c" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/AudioStream.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/ChannelDownmixer.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/ChannelDownmixer.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/io_tools.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/SampleRateConverter.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/SampleRateConverter.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/audio_input/wave_file_writing.cpp" isTestSource="false" />
@ -151,38 +149,64 @@
<sourceFolder url="file://$MODULE_DIR$/src/Shape.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/tools.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/tools.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tools.cmake" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Header Search Paths">
<CLASSES>
<root url="file://C:/MinGW/include" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include-fixed" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include/c++" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include/ssp" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include/objc" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include/ssp" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/x86_64-w64-mingw32/include" />
<root url="file://$MODULE_DIR$/../../lib/boost_1_59_0" />
<root url="file://$MODULE_DIR$/lib/cppformat" />
<root url="file://$MODULE_DIR$/lib/pocketsphinx-5prealpha-2015-08-05/include" />
<root url="file://$MODULE_DIR$/lib/sphinxbase-5prealpha-2015-08-05/include" />
<root url="file://$MODULE_DIR$/src" />
</CLASSES>
<SOURCES>
<root url="file://C:/MinGW/include" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include-fixed" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include/c++" />
<root url="file://C:/MinGW/lib/gcc/mingw32/4.8.1/include/ssp" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include/objc" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/include/ssp" />
<root url="file://C:/Program Files/mingw-w64/x86_64-5.2.0-posix-seh-rt_v4-rev1/mingw64/x86_64-w64-mingw32/include" />
<root url="file://$MODULE_DIR$/../../lib/boost_1_59_0" />
<root url="file://$MODULE_DIR$/lib/cppformat" />
<root url="file://$MODULE_DIR$/lib/pocketsphinx-5prealpha-2015-08-05/include" />
<root url="file://$MODULE_DIR$/lib/sphinxbase-5prealpha-2015-08-05/include" />
<root url="file://$MODULE_DIR$/src" />
</SOURCES>
<excluded>
<root url="file://$MODULE_DIR$/lib/cppformat/format.cc" />
<root url="file://$MODULE_DIR$/lib/cppformat/posix.h" />
<root url="file://$MODULE_DIR$/lib/cppformat/posix.cc" />
<root url="file://$MODULE_DIR$/lib/cppformat/format.h" />
<root url="file://$MODULE_DIR$/lib/cppformat/posix.h" />
<root url="file://$MODULE_DIR$/src/Shape.cpp" />
<root url="file://$MODULE_DIR$/src/phone_extraction.cpp" />
<root url="file://$MODULE_DIR$/src/audio_input/WaveFileReader.h" />
<root url="file://$MODULE_DIR$/src/Shape.h" />
<root url="file://$MODULE_DIR$/src/phone_extraction.h" />
<root url="file://$MODULE_DIR$/src/platform_tools.cpp" />
<root url="file://$MODULE_DIR$/src/tools.cpp" />
<root url="file://$MODULE_DIR$/src/centiseconds.cpp" />
<root url="file://$MODULE_DIR$/src/audio_input/SampleRateConverter.h" />
<root url="file://$MODULE_DIR$/src/audio_input/wave_file_writing.h" />
<root url="file://$MODULE_DIR$/src/Phone.h" />
<root url="file://$MODULE_DIR$/src/platform_tools.h" />
<root url="file://$MODULE_DIR$/src/audio_input/WaveFileReader.cpp" />
<root url="file://$MODULE_DIR$/src/Phone.cpp" />
<root url="file://$MODULE_DIR$/src/main.cpp" />
<root url="file://$MODULE_DIR$/src/tools.h" />
<root url="file://$MODULE_DIR$/src/mouth_animation.h" />
<root url="file://$MODULE_DIR$/src/audio_input/ChannelDownmixer.cpp" />
<root url="file://$MODULE_DIR$/src/audio_input/wave_file_writing.cpp" />
<root url="file://$MODULE_DIR$/src/audio_input/ChannelDownmixer.h" />
<root url="file://$MODULE_DIR$/src/centiseconds.h" />
<root url="file://$MODULE_DIR$/src/audio_input/SampleRateConverter.cpp" />
<root url="file://$MODULE_DIR$/src/mouth_animation.cpp" />
</excluded>
</library>
</orderEntry>

View File

@ -1,56 +1,85 @@
cmake_minimum_required(VERSION 3.3)
# Support legacy OS X versions
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Minimum OS X deployment version")
project("Rhubarb Lip Sync")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
# Make sure Xcode uses libc++ instead of libstdc++, allowing us to use the C++11 standard library prior to OS X 10.9
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
# Enable C++14
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
# Make sure Xcode uses libc++ instead of libstdc++, allowing us to use the C++14 standard library prior to OS X 10.9
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
add_compile_options(-stdlib=libc++)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
endif()
# Set output directories
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")
# Find Boost libraries
# Define flags variables for later use
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(enableWarningsFlags "-Wall;-Wextra")
set(disableWarningsFlags "-w")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(enableWarningsFlags "/W4")
set(disableWarningsFlags "/W0")
endif()
# Define libraries
# ... Boost
set(Boost_USE_STATIC_LIBS ON) # Use static libs
set(Boost_USE_MULTITHREADED ON) # Enable multithreading support
set(Boost_USE_STATIC_RUNTIME ON) # Use static C++ runtime
find_package(Boost REQUIRED COMPONENTS filesystem locale system)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
set(SOURCE_FILES src/main.cpp src/audio_input/WaveFileReader.cpp src/audio_input/WaveFileReader.h src/audio_input/ChannelDownmixer.cpp src/audio_input/ChannelDownmixer.h src/audio_input/AudioStream.h src/audio_input/SampleRateConverter.cpp src/audio_input/SampleRateConverter.h src/audio_input/wave_file_writing.cpp src/audio_input/wave_file_writing.h src/audio_input/io_tools.h src/platform_tools.cpp src/platform_tools.h src/phone_extraction.cpp src/phone_extraction.h src/Phone.cpp src/Phone.h src/centiseconds.cpp src/centiseconds.h src/tools.cpp src/tools.h src/Shape.cpp src/Shape.h src/mouth_animation.cpp src/mouth_animation.h)
# ... C++ Format
include_directories(SYSTEM "lib/cppformat")
FILE(GLOB cppFormatFiles "lib/cppformat/*.cc")
add_library(cppFormat ${cppFormatFiles})
target_compile_options(cppFormat PRIVATE ${disableWarningsFlags})
include_directories("lib/sphinxbase-5prealpha-2015-08-05/include" "lib/pocketsphinx-5prealpha-2015-08-05/include" "lib/cppformat")
FILE(GLOB_RECURSE SPHINX_BASE "lib/sphinxbase-5prealpha-2015-08-05/src/libsphinxbase/*.c")
FILE(GLOB POCKETSPHINX "lib/pocketsphinx-5prealpha-2015-08-05/src/libpocketsphinx/*.c")
FILE(GLOB CPPFORMAT "lib/cppformat/*.cc")
# ... sphinxbase
include_directories(SYSTEM "lib/sphinxbase-5prealpha-2015-08-05/include")
FILE(GLOB_RECURSE sphinxbaseFiles "lib/sphinxbase-5prealpha-2015-08-05/src/libsphinxbase/*.c")
add_library(sphinxbase ${sphinxbaseFiles})
target_compile_options(sphinxbase PRIVATE ${disableWarningsFlags})
add_executable(rhubarb ${SOURCE_FILES} ${SPHINX_BASE} ${POCKETSPHINX} ${CPPFORMAT})
target_link_libraries(rhubarb ${Boost_LIBRARIES})
# ... PocketSphinx
include_directories(SYSTEM "lib/pocketsphinx-5prealpha-2015-08-05/include")
FILE(GLOB pocketSphinxFiles "lib/pocketsphinx-5prealpha-2015-08-05/src/libpocketsphinx/*.c")
add_library(pocketSphinx ${pocketSphinxFiles})
target_link_libraries(pocketSphinx sphinxbase)
target_compile_options(pocketSphinx PRIVATE ${disableWarningsFlags})
function(copy_after_build sourceGlob relativeTargetDirectory)
# Set `sourcePaths`
file(GLOB sourcePaths "${sourceGlob}")
foreach(sourcePath ${sourcePaths})
# Set `fileName`
get_filename_component(fileName "${sourcePath}" NAME)
# Set `targetPath`
set(targetPath "${CMAKE_BINARY_DIR}/${relativeTargetDirectory}/${fileName}")
add_custom_command(TARGET rhubarb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${sourcePath}" "${targetPath}"
COMMENT "Creating '${relativeTargetDirectory}/${fileName}'"
)
endforeach()
endfunction()
# Define executable
include_directories("src" "src/audio_input")
set(SOURCE_FILES
src/main.cpp
src/Phone.cpp
src/Shape.cpp
src/centiseconds.cpp
src/mouth_animation.cpp
src/phone_extraction.cpp
src/platform_tools.cpp
src/tools.cpp
src/audio_input/ChannelDownmixer.cpp
src/audio_input/SampleRateConverter.cpp
src/audio_input/WaveFileReader.cpp
src/audio_input/wave_file_writing.cpp
)
add_executable(rhubarb ${SOURCE_FILES})
target_link_libraries(rhubarb ${Boost_LIBRARIES} cppFormat sphinxbase pocketSphinx)
target_compile_options(rhubarb PUBLIC ${enableWarningsFlags})
# Copy resource files
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")

View File

@ -21,6 +21,18 @@ All parts of [Rhubarb Lip Sync](https://github.com/DanielSWolf/rhubarb-lip-sync)
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
### Boost
The [Boost](http://www.boost.org/) libraries are released under the **Boost Software License**.
> Boost Software License - Version 1.0 - August 17th, 2003
>
> Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:
>
> The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
### C++ Format
The [C++ Format](https://github.com/cppformat/cppformat) library is released under the **2-clause BSD License**.
@ -36,6 +48,21 @@ The [C++ Format](https://github.com/cppformat/cppformat) library is released und
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### CMU Sphinx common libraries (sphinxbase)
The [sphinxbase](https://github.com/cmusphinx/sphinxbase) library is released under a variation of the **2-clause BSD License**.
> Copyright (c) 1999-2015 Carnegie Mellon University. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
>
> This work was supported in part by funding from the Defense Advanced Research Projects Agency and the National Science Foundation of the United States of America, and the CMU Sphinx Speech Consortium.
>
> THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### PocketSphinx
The [PocketSphinx](https://github.com/cmusphinx/pocketsphinx) library is released under a variation of the **2-clause BSD License**.
@ -63,18 +90,3 @@ The US english acoustic model that is distributed along with the [PocketSphinx](
> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
>
> THIS SOFTWARE IS PROVIDED BY ALPHA CEPHEI INC. ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALPHA CEPHEI INC. NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### CMU Sphinx common libraries (sphinxbase)
The [sphinxbase](https://github.com/cmusphinx/sphinxbase) library is released under a variation of the **2-clause BSD License**.
> Copyright (c) 1999-2015 Carnegie Mellon University. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
>
> This work was supported in part by funding from the Defense Advanced Research Projects Agency and the National Science Foundation of the United States of America, and the CMU Sphinx Speech Consortium.
>
> THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

17
tools.cmake Normal file
View File

@ -0,0 +1,17 @@
function(copy_after_build sourceGlob relativeTargetDirectory)
# Set `sourcePaths`
file(GLOB sourcePaths "${sourceGlob}")
foreach(sourcePath ${sourcePaths})
# Set `fileName`
get_filename_component(fileName "${sourcePath}" NAME)
# Set `targetPath`
set(targetPath "${CMAKE_BINARY_DIR}/${relativeTargetDirectory}/${fileName}")
add_custom_command(TARGET rhubarb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${sourcePath}" "${targetPath}"
COMMENT "Creating '${relativeTargetDirectory}/${fileName}'"
)
endforeach()
endfunction()