mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-01 07:38:52 +02:00
server compiles on macOS
This commit is contained in:
parent
8b9b94919c
commit
fbf4c9126a
4 changed files with 92 additions and 6 deletions
|
@ -9,7 +9,8 @@ else
|
||||||
TARGET_DIR ?= /usr
|
TARGET_DIR ?= /usr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -std=c++0x -Wall -Wno-unused-function -O3 -pthread -DASIO_STANDALONE -DVERSION=\"$(VERSION)\" -I. -I.. -I../externals/asio/asio/include -I../externals/popl/include
|
CXXFLAGS += -std=c++0x -Wall -Wno-unused-function -O3 -DASIO_STANDALONE -DVERSION=\"$(VERSION)\" -I. -I.. -I../externals/asio/asio/include -I../externals/popl/include
|
||||||
|
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o json/jsonrpc.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o ../common/log.o ../common/sampleFormat.o ../message/pcmChunk.o
|
||||||
|
|
||||||
ifeq ($(ENDIAN), BIG)
|
ifeq ($(ENDIAN), BIG)
|
||||||
CXXFLAGS += -DIS_BIG_ENDIAN
|
CXXFLAGS += -DIS_BIG_ENDIAN
|
||||||
|
@ -18,27 +19,38 @@ endif
|
||||||
ifeq ($(TARGET), OPENWRT)
|
ifeq ($(TARGET), OPENWRT)
|
||||||
|
|
||||||
STRIP = echo
|
STRIP = echo
|
||||||
CXXFLAGS += -DNO_CPP11_STRING
|
CXXFLAGS += -DNO_CPP11_STRING -pthread
|
||||||
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -latomic
|
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -latomic
|
||||||
|
OBJ += publishAvahi.o
|
||||||
|
|
||||||
else ifeq ($(TARGET), FREEBSD)
|
else ifeq ($(TARGET), FREEBSD)
|
||||||
|
|
||||||
SHELL = /usr/local/bin/bash
|
SHELL = /usr/local/bin/bash
|
||||||
CXX = /usr/local/bin/g++
|
CXX = /usr/local/bin/g++
|
||||||
CXXFLAGS += -DNO_CPP11_STRING -DFREEBSD
|
CXXFLAGS += -DNO_CPP11_STRING -DFREEBSD -pthread
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
||||||
|
OBJ += publishAvahi.o
|
||||||
|
|
||||||
|
else ifeq ($(TARGET), MACOS)
|
||||||
|
|
||||||
|
CXX = /usr/bin/g++
|
||||||
|
CXXFLAGS += -DFREEBSD -DMACOS -DHAS_BONJOUR -Wno-deprecated -I/usr/local/include
|
||||||
|
STRIP = strip
|
||||||
|
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC -L/usr/local/lib
|
||||||
|
OBJ += publishBonjour.o
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
CXX = /usr/bin/g++
|
CXX = /usr/bin/g++
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
|
CXXFLAGS += -pthread
|
||||||
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
||||||
|
OBJ += publishAvahi.o
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o json/jsonrpc.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o publishAvahi.o ../common/log.o ../common/sampleFormat.o ../message/pcmChunk.o
|
|
||||||
BIN = snapserver
|
BIN = snapserver
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
33
server/publishBonjour.cpp
Normal file
33
server/publishBonjour.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/***
|
||||||
|
This file is part of snapcast
|
||||||
|
Copyright (C) 2014-2016 Johannes Pohl
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
***/
|
||||||
|
|
||||||
|
|
||||||
|
#include "publishBonjour.h"
|
||||||
|
|
||||||
|
|
||||||
|
PublishBonjour::PublishBonjour(const std::string& serviceName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PublishBonjour::~PublishBonjour()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
37
server/publishBonjour.h
Normal file
37
server/publishBonjour.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/***
|
||||||
|
This file is part of snapcast
|
||||||
|
Copyright (C) 2014-2016 Johannes Pohl
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
***/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PUBLISH_BONJOUR_H
|
||||||
|
#define PUBLISH_BONJOUR_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
class PublishBonjour
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PublishBonjour(const std::string& serviceName);
|
||||||
|
~PublishBonjour();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,11 @@
|
||||||
#include "message/message.h"
|
#include "message/message.h"
|
||||||
#include "encoder/encoderFactory.h"
|
#include "encoder/encoderFactory.h"
|
||||||
#include "streamServer.h"
|
#include "streamServer.h"
|
||||||
|
#if defined(HAS_AVAHI)
|
||||||
#include "publishAvahi.h"
|
#include "publishAvahi.h"
|
||||||
|
#elif defined(HAS_BONJOUR)
|
||||||
|
#include "publishBonjour.h"
|
||||||
|
#endif
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
|
@ -142,13 +146,13 @@ int main(int argc, char* argv[])
|
||||||
setpriority(PRIO_PROCESS, 0, processPriority);
|
setpriority(PRIO_PROCESS, 0, processPriority);
|
||||||
logS(kLogNotice) << "daemon started" << std::endl;
|
logS(kLogNotice) << "daemon started" << std::endl;
|
||||||
}
|
}
|
||||||
|
#if defined(HAS_AVAHI)
|
||||||
PublishAvahi publishAvahi("Snapcast");
|
PublishAvahi publishAvahi("Snapcast");
|
||||||
std::vector<AvahiService> services;
|
std::vector<AvahiService> services;
|
||||||
services.push_back(AvahiService("_snapcast._tcp", settings.port));
|
services.push_back(AvahiService("_snapcast._tcp", settings.port));
|
||||||
services.push_back(AvahiService("_snapcast-jsonrpc._tcp", settings.controlPort));
|
services.push_back(AvahiService("_snapcast-jsonrpc._tcp", settings.controlPort));
|
||||||
publishAvahi.publish(services);
|
publishAvahi.publish(services);
|
||||||
|
#endif
|
||||||
if (settings.bufferMs < 400)
|
if (settings.bufferMs < 400)
|
||||||
settings.bufferMs = 400;
|
settings.bufferMs = 400;
|
||||||
settings.sampleFormat = sampleFormatValue.getValue();
|
settings.sampleFormat = sampleFormatValue.getValue();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue