diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ab8acb0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,9 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +PROJECT(Echoprint) + +SET(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") +SET(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") +SET(INSTALL_INCLUDE_DIR "include/codegen" CACHE PATH "Installation directory for header files") + +ADD_SUBDIRECTORY(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..3bac559 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,55 @@ +# Create the library +FILE(GLOB codegen_SRCS + "${CMAKE_CURRENT_SOURCE_DIR}/Codegen.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/AudioStreamInput.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/Whitening.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/AudioBufferInput.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/MatrixUtility.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/Metadata.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/Fingerprint.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/Base64.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/SubbandAnalysis.cxx" + ) +FILE(GLOB codegen_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") + +# Find package taglib. +FIND_PATH(TagLib_INCLUDE_DIRS fileref.h + PATH_SUFFIXES taglib + DOC "Directory where TagLib headers are located" + ) +FIND_LIBRARY(TagLib_LIBRARY tag + DOC "The TagLib library" + ) + +FIND_PACKAGE(ZLIB REQUIRED) +FIND_PACKAGE(Threads REQUIRED) + +INCLUDE_DIRECTORIES(SYSTEM + ${TagLib_INCLUDE_DIRS} + ) + +ADD_LIBRARY(codegen SHARED ${codegen_SRCS}) +TARGET_LINK_LIBRARIES(codegen + ${CMAKE_THREAD_LIBS_INIT} + ${TagLib_LIBRARY} + ${ZLIB_LIBRARIES} + ) +SET_TARGET_PROPERTIES(codegen PROPERTIES + PUBLIC_HEADER "${codegen_HEADERS}" + VERSION 4.1.1 + SOVERSION 4 + ) +INSTALL(TARGETS codegen + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib # .so + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib # .a + PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" COMPONENT dev + ) + +# The main file +ADD_EXECUTABLE(echoprint-codegen + "${CMAKE_CURRENT_SOURCE_DIR}/main.cxx" + ) +TARGET_LINK_LIBRARIES(echoprint-codegen codegen) +INSTALL(TARGETS echoprint-codegen + DESTINATION "${INSTALL_BIN_DIR}" + )