Browse Source

Merge pull request #6 from Aang23/cmake_support

Initial CMake support
tags/v1.8.0
Liam 4 years ago
committed by GitHub
parent
commit
f730a6efe5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +21
    -0
      CMakeLists.txt
  3. +20
    -0
      cmake/FindLibSndFile.cmake

+ 3
- 0
.gitignore View File

@@ -50,3 +50,6 @@ aptdec


# VSCode # VSCode
.vscode .vscode

# CMake
build

+ 21
- 0
CMakeLists.txt View File

@@ -0,0 +1,21 @@
cmake_minimum_required (VERSION 3.0.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

project (aptdec)

add_executable(aptdec main.c color.c dsp.c filter.c image.c median.c pngio.c reg.c)

# Math
target_link_libraries(aptdec PRIVATE m)

# PNG
if(WIN32 AND NOT MINGW)
find_package(PNG CONFIG REQUIRED)
else()
find_package(PNG REQUIRED)
endif()
target_link_libraries(aptdec PRIVATE PNG::PNG)

# SndFile
find_package(LibSndFile REQUIRED)
target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY})

+ 20
- 0
cmake/FindLibSndFile.cmake View File

@@ -0,0 +1,20 @@
# Find libsndfile

FIND_PATH(LIBSNDFILE_INCLUDE_DIR sndfile.h)

SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile)
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES} PATH)

IF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)
SET(LIBSNDFILE_FOUND TRUE)
ENDIF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)

IF (LIBSNDFILE_FOUND)
IF (NOT LibSndFile_FIND_QUIETLY)
MESSAGE (STATUS "Found LibSndFile: ${LIBSNDFILE_LIBRARY}")
ENDIF (NOT LibSndFile_FIND_QUIETLY)
ELSE (LIBSNDFILE_FOUND)
IF (LibSndFile_FIND_REQUIRED)
MESSAGE (FATAL_ERROR "Could not find sndfile")
ENDIF (LibSndFile_FIND_REQUIRED)
ENDIF (LIBSNDFILE_FOUND)

Loading…
Cancel
Save