build scenario changes

This commit is contained in:
Blue 2023-10-20 17:39:27 -03:00
parent 5c3a4a592e
commit 2cce5f52f0
Signed by: 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_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(PkgConfig REQUIRED)
find_package(FLAC REQUIRED)
find_package(JPEG REQUIRED)
find_package(LAME REQUIRED)
find_package(TAGLIB REQUIRED)
pkg_check_modules(LAME REQUIRED IMPORTED_TARGET lame)
pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib)
add_executable(mlc)
add_executable(${PROJECT_NAME})
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
add_subdirectory(src)
target_link_libraries(mlc
target_link_libraries(${PROJECT_NAME}
FLAC::FLAC
PkgConfig::LAME
LAME::LAME
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
#https://github.com/sipwise/sems/blob/master/cmake/FindLame.cmake
FIND_PATH(LAME_INCLUDE_DIR lame/lame.h)
FIND_LIBRARY(LAME_LIBRARIES NAMES mp3lame)
find_path(LAME_INCLUDE_DIR lame/lame.h)
find_library(LAME_LIBRARIES lame NAMES mp3lame)
IF(LAME_INCLUDE_DIR AND LAME_LIBRARIES)
SET(LAME_FOUND TRUE)
ENDIF(LAME_INCLUDE_DIR AND LAME_LIBRARIES)
if(LAME_INCLUDE_DIR AND LAME_LIBRARIES)
set(LAME_FOUND TRUE)
endif(LAME_INCLUDE_DIR AND LAME_LIBRARIES)
IF(LAME_FOUND)
IF (NOT Lame_FIND_QUIETLY)
MESSAGE(STATUS "Found lame includes: ${LAME_INCLUDE_DIR}/lame/lame.h")
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)
if(LAME_FOUND)
add_library(LAME::LAME SHARED IMPORTED)
set_target_properties(LAME::LAME PROPERTIES
IMPORTED_LOCATION "${LAME_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LAME_INCLUDE_DIR}/lame"
INTERFACE_LINK_LIBRARIES "${LAME_LIBRARIES}"
)
if (NOT Lame_FIND_QUIETLY)
message(STATUS "Found lame includes: ${LAME_INCLUDE_DIR}/lame")
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
#include <FLAC/stream_decoder.h>
#include <stream_decoder.h>
#include <lame.h>
#include <jpeglib.h>
#include <id3v2tag.h>