2015-09-10 18:05:05 +00:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
2015-12-14 12:31:28 +00:00
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Minimum OS X deployment version")
|
|
|
|
|
2015-12-14 19:38:26 +00:00
|
|
|
project("Rhubarb Lip Sync")
|
2015-09-10 18:05:05 +00:00
|
|
|
|
2015-11-19 20:17:35 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
|
2015-09-10 18:05:05 +00:00
|
|
|
|
2015-12-14 12:31:28 +00:00
|
|
|
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++")
|
|
|
|
endif()
|
|
|
|
|
2015-11-11 19:25:47 +00:00
|
|
|
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")
|
|
|
|
|
2015-11-03 14:31:13 +00:00
|
|
|
# Find Boost libraries
|
|
|
|
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
|
2015-11-18 19:59:03 +00:00
|
|
|
find_package(Boost REQUIRED COMPONENTS filesystem locale system)
|
2015-11-03 14:31:13 +00:00
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
|
2015-12-09 20:32:48 +00:00
|
|
|
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)
|
2015-09-10 19:31:25 +00:00
|
|
|
|
2015-09-17 19:46:05 +00:00
|
|
|
include_directories("lib/sphinxbase-5prealpha-2015-08-05/include" "lib/pocketsphinx-5prealpha-2015-08-05/include" "lib/cppformat")
|
2015-09-10 19:31:25 +00:00
|
|
|
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")
|
2015-09-17 19:46:05 +00:00
|
|
|
FILE(GLOB CPPFORMAT "lib/cppformat/*.cc")
|
2015-09-10 19:31:25 +00:00
|
|
|
|
2015-12-14 19:38:26 +00:00
|
|
|
add_executable(rhubarb ${SOURCE_FILES} ${SPHINX_BASE} ${POCKETSPHINX} ${CPPFORMAT})
|
|
|
|
target_link_libraries(rhubarb ${Boost_LIBRARIES})
|
2015-11-11 19:25:47 +00:00
|
|
|
|
|
|
|
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}")
|
|
|
|
|
2015-12-14 19:38:26 +00:00
|
|
|
add_custom_command(TARGET rhubarb POST_BUILD
|
2015-11-11 19:25:47 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${sourcePath}" "${targetPath}"
|
|
|
|
COMMENT "Creating '${relativeTargetDirectory}/${fileName}'"
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# Copy resource files
|
|
|
|
set(modelDir "${CMAKE_SOURCE_DIR}/lib/pocketsphinx-5prealpha-2015-08-05/model")
|
2015-11-18 19:59:03 +00:00
|
|
|
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")
|