Convert build system to use cmake and fix for Mac OS X build

This commit is contained in:
balr0g 2013-07-07 17:55:33 -04:00
parent 5d147c9f04
commit e40c32d8ad
6 changed files with 54 additions and 7 deletions

5
.gitignore vendored
View File

@ -1,2 +1,5 @@
*.o
dsd dsd
*.[ao]
*.so*
*.dylib
build

21
CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
project(dsd)
cmake_minimum_required(VERSION 2.6)
FILE(GLOB SRCS *.c)
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}" "${CMAKE_INSTALL_PREFIX}/include")
LINK_DIRECTORIES("${CMAKE_INSTALL_PREFIX}/lib")
ADD_EXECUTABLE(dsd ${SRCS})
TARGET_LINK_LIBRARIES(dsd mbe)
install(TARGETS dsd DESTINATION bin)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

View File

@ -14,9 +14,9 @@
# PERFORMANCE OF THIS SOFTWARE. # PERFORMANCE OF THIS SOFTWARE.
CC = gcc CC = gcc
CFLAGS = -O2 -Wall CFLAGS = -O2 -Wall -g
INCLUDES = -I. -I/usr/local/include -I/usr/include INCLUDES = -I. -I/usr/local/include -I/usr/include -I../mbelib-master
LIBS = -L/usr/local/lib -lm -lmbe LIBS = -L/usr/local/lib -L../mbelib-master -lm -lmbe
INSTALL=install INSTALL=install
AR=ar AR=ar
RANLIB=ranlib RANLIB=ranlib

23
cmake_uninstall.cmake.in Normal file
View File

@ -0,0 +1,23 @@
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
cmake_policy(SET CMP0007 OLD)
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

2
dsd.h
View File

@ -31,7 +31,7 @@
#ifdef SOLARIS #ifdef SOLARIS
#include <sys/audioio.h> #include <sys/audioio.h>
#endif #endif
#ifdef BSD #if defined(BSD) && !defined(__APPLE__)
#include <sys/soundcard.h> #include <sys/soundcard.h>
#endif #endif
#include <math.h> #include <math.h>

View File

@ -237,7 +237,7 @@ openAudioOutDevice (dsd_opts * opts, int speed)
} }
#endif #endif
#ifdef BSD #if defined(BSD) && !defined(__APPLE__)
int fmt; int fmt;
@ -318,7 +318,7 @@ openAudioInDevice (dsd_opts * opts)
} }
#endif #endif
#ifdef BSD #if defined(BSD) && !defined(__APPLE__)
int fmt; int fmt;
if (opts->split == 1) if (opts->split == 1)