1
0
forked from blue/mlc

build scenario changes

This commit is contained in:
Blue 2023-10-20 17:39:27 -03:00
parent 5c3a4a592e
commit 2cce5f52f0
Signed by untrusted user: blue
GPG Key ID: 9B203B252A63EE38
5 changed files with 76 additions and 25 deletions

View File

@ -26,23 +26,21 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(PkgConfig REQUIRED)
find_package(FLAC REQUIRED) find_package(FLAC REQUIRED)
find_package(JPEG REQUIRED) find_package(JPEG REQUIRED)
find_package(LAME REQUIRED)
find_package(TAGLIB REQUIRED)
pkg_check_modules(LAME REQUIRED IMPORTED_TARGET lame) add_executable(${PROJECT_NAME})
pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib)
add_executable(mlc)
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS}) target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
add_subdirectory(src) add_subdirectory(src)
target_link_libraries(mlc target_link_libraries(${PROJECT_NAME}
FLAC::FLAC FLAC::FLAC
PkgConfig::LAME LAME::LAME
JPEG::JPEG JPEG::JPEG
PkgConfig::TAGLIB TAGLIB::TAGLIB
) )
install(TARGETS mlc RUNTIME DESTINATION bin) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

23
cmake/FindFLAC.cmake Normal file
View File

@ -0,0 +1,23 @@
find_path(FLAC_INCLUDE_DIR FLAC/stream_decoder.h)
find_library(FLAC_LIBRARIES FLAC NAMES flac)
if(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES)
set(FLAC_FOUND TRUE)
endif()
if(FLAC_FOUND)
add_library(FLAC::FLAC SHARED IMPORTED)
set_target_properties(FLAC::FLAC PROPERTIES
IMPORTED_LOCATION "${FLAC_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}/FLAC"
INTERFACE_LINK_LIBRARIES "${FLAC_LIBRARIES}"
)
if (NOT FLAC_FIND_QUIETLY)
message(STATUS "Found FLAC includes: ${FLAC_INCLUDE_DIR}/FLAC")
message(STATUS "Found FLAC library: ${FLAC_LIBRARIES}")
endif ()
else()
if (FLAC_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find FLAC development files")
endif ()
endif()

View File

@ -1,20 +1,26 @@
#copied from here, thank you #copied from here, thank you
#https://github.com/sipwise/sems/blob/master/cmake/FindLame.cmake #https://github.com/sipwise/sems/blob/master/cmake/FindLame.cmake
FIND_PATH(LAME_INCLUDE_DIR lame/lame.h) find_path(LAME_INCLUDE_DIR lame/lame.h)
FIND_LIBRARY(LAME_LIBRARIES NAMES mp3lame) find_library(LAME_LIBRARIES lame NAMES mp3lame)
IF(LAME_INCLUDE_DIR AND LAME_LIBRARIES) if(LAME_INCLUDE_DIR AND LAME_LIBRARIES)
SET(LAME_FOUND TRUE) set(LAME_FOUND TRUE)
ENDIF(LAME_INCLUDE_DIR AND LAME_LIBRARIES) endif(LAME_INCLUDE_DIR AND LAME_LIBRARIES)
IF(LAME_FOUND) if(LAME_FOUND)
IF (NOT Lame_FIND_QUIETLY) add_library(LAME::LAME SHARED IMPORTED)
MESSAGE(STATUS "Found lame includes: ${LAME_INCLUDE_DIR}/lame/lame.h") set_target_properties(LAME::LAME PROPERTIES
MESSAGE(STATUS "Found lame library: ${LAME_LIBRARIES}") IMPORTED_LOCATION "${LAME_LIBRARIES}"
ENDIF (NOT Lame_FIND_QUIETLY) INTERFACE_INCLUDE_DIRECTORIES "${LAME_INCLUDE_DIR}/lame"
ELSE(LAME_FOUND) INTERFACE_LINK_LIBRARIES "${LAME_LIBRARIES}"
IF (Lame_FIND_REQUIRED) )
MESSAGE(FATAL_ERROR "Could NOT find lame development files") if (NOT Lame_FIND_QUIETLY)
ENDIF (Lame_FIND_REQUIRED) message(STATUS "Found lame includes: ${LAME_INCLUDE_DIR}/lame")
ENDIF(LAME_FOUND) message(STATUS "Found lame library: ${LAME_LIBRARIES}")
endif (NOT Lame_FIND_QUIETLY)
else(LAME_FOUND)
if (Lame_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find lame development files")
endif (Lame_FIND_REQUIRED)
endif(LAME_FOUND)

24
cmake/FindTAGLIB.cmake Normal file
View File

@ -0,0 +1,24 @@
find_path(TAGLIB_INCLUDE_DIR taglib/id3v2tag.h)
find_library(TAGLIB_LIBRARIES taglib NAMES TAGLIB tag)
if(TAGLIB_INCLUDE_DIR AND TAGLIB_LIBRARIES)
set(TAGLIB_FOUND TRUE)
endif()
if(TAGLIB_FOUND)
add_library(TAGLIB::TAGLIB SHARED IMPORTED)
set_target_properties(TAGLIB::TAGLIB PROPERTIES
IMPORTED_LOCATION "${TAGLIB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}/taglib"
INTERFACE_LINK_LIBRARIES "${TAGLIB_LIBRARIES}"
)
if (NOT TAGLIB_FIND_QUIETLY)
message(STATUS "Found TAGLIB includes: ${FLAC_INCLUDE_DIR}/taglib")
message(STATUS "Found TAGLIB library: ${TAGLIB_LIBRARIES}")
endif ()
else()
if (TAGLIB_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find TAGLIB development files")
endif ()
endif()

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <FLAC/stream_decoder.h> #include <stream_decoder.h>
#include <lame.h> #include <lame.h>
#include <jpeglib.h> #include <jpeglib.h>
#include <id3v2tag.h> #include <id3v2tag.h>