2023-10-08 23:29:40 +00:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
2023-07-16 00:15:31 +00:00
|
|
|
project(
|
|
|
|
mlc
|
2023-10-11 00:28:06 +00:00
|
|
|
VERSION 1.3.23
|
2023-07-16 00:15:31 +00:00
|
|
|
DESCRIPTION "Media Library Compiler: rips your media library to a lossy compilation"
|
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
|
|
|
cmake_policy(SET CMP0076 NEW)
|
|
|
|
cmake_policy(SET CMP0079 NEW)
|
2023-07-15 19:44:29 +00:00
|
|
|
|
2023-10-10 16:24:46 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
|
|
list(APPEND COMPILE_OPTIONS -O3)
|
|
|
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
list(APPEND COMPILE_OPTIONS -g)
|
|
|
|
list(APPEND COMPILE_OPTIONS -Wall)
|
|
|
|
list(APPEND COMPILE_OPTIONS -Wextra)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message("Compilation options: " ${COMPILE_OPTIONS})
|
|
|
|
|
2023-07-16 00:15:31 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
2023-07-15 19:44:29 +00:00
|
|
|
|
2023-07-25 23:39:56 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2023-07-16 00:15:31 +00:00
|
|
|
find_package(FLAC REQUIRED)
|
2023-07-18 23:05:32 +00:00
|
|
|
find_package(JPEG REQUIRED)
|
2023-07-16 00:15:31 +00:00
|
|
|
|
2023-07-25 23:39:56 +00:00
|
|
|
pkg_check_modules(LAME REQUIRED IMPORTED_TARGET lame)
|
|
|
|
pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib)
|
|
|
|
|
2023-10-06 21:39:07 +00:00
|
|
|
add_executable(mlc)
|
2023-10-10 16:24:46 +00:00
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
|
2023-10-06 21:39:07 +00:00
|
|
|
|
|
|
|
add_subdirectory(src)
|
2023-07-16 00:15:31 +00:00
|
|
|
|
|
|
|
target_link_libraries(mlc
|
2023-07-25 23:39:56 +00:00
|
|
|
FLAC::FLAC
|
|
|
|
PkgConfig::LAME
|
2023-07-18 23:05:32 +00:00
|
|
|
JPEG::JPEG
|
2023-07-25 23:39:56 +00:00
|
|
|
PkgConfig::TAGLIB
|
2023-07-16 00:15:31 +00:00
|
|
|
)
|
2023-07-15 19:44:29 +00:00
|
|
|
|
|
|
|
install(TARGETS mlc RUNTIME DESTINATION bin)
|