xespeak CmakeLists.txt

来源:互联网 发布:手机淘宝怎么交电费 编辑:程序博客网 时间:2024/05/19 17:23
if (UNIX)
message("The system is ${CMAKE_SYSTEM}")
message("The system name is ${CMAKE_SYSTEM_NAME}")
message("The system version is ${CMAKE_SYSTEM_VERSION}")
message("The system processor is ${CMAKE_SYSTEM_PROCESSOR}")
endif()


message("The cmake version is ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}-${CMAKE_PATCH_VERSION}")
message("The compiler is ${CMAKE_C_COMPILER}.")


message("PROJECT_SOURCE_DIR is ${PROJECT_SOURCE_DIR}")
message("CMAKE_CURRENT_SOURCE_DIR is ${CMAKE_CURRENT_SOURCE_DIR}")
message("CMAKE_SOURCE_DIR is ${CMAKE_SOURCE_DIR}")


project(xespeak)
cmake_minimum_required(VERSION 2.8)


set(COM_SRC_LIST    compiledict.cpp
                    dictionary.cpp
                    intonation.cpp
                    klatt.h
                    klatt.cpp
                    numbers.cpp
                    phoneme.h
                    phonemelist.cpp
                    readclause.cpp
                    setlengths.cpp
                    sonic.h
                    sonic.cpp
                    synth_mbrola.cpp
                    synthdata.cpp
                    synthesize.h
                    synthesize.cpp
                    tr_languages.cpp
                    translate.h
                    translate.cpp
                    voice.h
                    voices.cpp
                    wavegen.cpp
                    portaudio.h
                    sintab.h
                    speak_lib.h)


if(WIN32)
    message("The operation platform is windows")
    if(MSVC)
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
        set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
        set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
    endif()
    if(PLATFORM_WINDOWS_DLL)
        message("Now to make windows dll...")
        #add_subdirectory(./os/win32/cmd)
        #add_definitions(-DPLATFORM_WINDOWS)
        include_directories(./os/win32/dll/)
        #aux_source_directory(. SRC_LIST)
        set(SRC_LIST    ./os/win32/dll/speech.h
                        ./os/win32/dll/stdint.h
                        ./os/win32/dll/StdAfx.h
                        speak_lib.cpp
                        ${COM_SRC_LIST})
        #add_library(${PROJECT_NAME} STATIC ${SRC_LIST})


        add_library(PAStaticWMME STATIC IMPORTED)
        set_target_properties(PAStaticWMME PROPERTIES
            IMPORTED_LOCATION_RELEASE ./os/win32/deps/PAStaticWMME.lib
            IMPORTED_LOCATION_DEBUG   ./os/win32/deps/PAStaticWMME.lib
            IMPORTED_LINK_INTERFACE_LIBRARIES PAStaticWMME)
        add_library(${PROJECT_NAME} SHARED ${SRC_LIST})
        target_link_libraries(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/os/win32/deps/PAStaticWMME.lib)
    elseif(PLATFORM_WINDOWS_CMD)
        message("Now to make windows cmd...")
        #add_subdirectory(./os/win32/cmd)
        #aux_source_directory(. SRC_LIST)
        add_definitions(/DWIN32 /DNDEBUG /D_CONSOLE)
        include_directories(./os/win32/cmd/)
        set(SRC_LIST    ./os/win32/cmd/speech.h
                        ./os/win32/cmd/stdint.h
                        ./os/win32/cmd/StdAfx.h
                        speak.cpp
                        ${COM_SRC_LIST})
        add_library(PAStaticWMME STATIC IMPORTED)
        set_target_properties(PAStaticWMME PROPERTIES
            IMPORTED_LOCATION_RELEASE ./os/win32/deps/PAStaticWMME.lib
            IMPORTED_LOCATION_DEBUG   ./os/win32/deps/PAStaticWMME.lib
            IMPORTED_LINK_INTERFACE_LIBRARIES PAStaticWMME)


        add_executable(${PROJECT_NAME} ${SRC_LIST})
        target_link_libraries(${PROJECT_NAME}
            ${CMAKE_CURRENT_SOURCE_DIR}/os/win32/deps/PAStaticWMME.lib
            Winmm.lib)
    endif()
elseif(UNIX)
    message("The operation platform is Linux")
endif()
0 0