Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update build for Apple Silicon #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@ Please attach this file when asking for support along with any other relevant in

## Code Setup
1. Clone the repo with all of its submodules with: `git clone https://github.com/cwhitney/SilverSprint.git --depth 1 --recursive`
2. Build Cinder for your platform [OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html).
1. Build Cinder for your platform [OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html).
If you're having trouble building Cinder, it may be missing some of its dependencies. You may need to run `git submodule update --init --recursive` to make sure Cinder has all of its submodules.
3. The structure of the repo is like so:

```
Root
- apps
- Arduino
- SilverSprints
- libs
- Cinder
```
4. Update Arduino if necessary. (See above.)
5. Open the project file for your platform. It will be in `apps/SilverSprints/xcode/SilverSprint.xcodeproj` for OS X, and `apps/SilverSprints/vs2015` for PC.
6. Build SilverSprints. There are no external dependencies aside from Cinder itself.
1. The structure of the repo is like so:
```
Root
- apps
- Arduino
- SilverSprints
- libs
- Cinder
```
1. Update Arduino if necessary. (See above.)
1. Open the project file for your platform. It will be in `apps/SilverSprints/xcode/SilverSprint.xcodeproj` for OS X, and `apps/SilverSprints/vs2015` for PC.
1. Build SilverSprints. There are no external dependencies aside from Cinder itself.

## Credits

Expand Down
2 changes: 1 addition & 1 deletion apps/SilverSprints/src/SilverSprintsApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void SilverSprintApp::setup()
#endif

auto sysLogger = log::makeLogger<log::LoggerSystem>();
sysLogger->setLoggingLevel(log::LEVEL_VERBOSE);
sysLogger->setLevel(log::LEVEL_VERBOSE);

CI_LOG_I("Start program");

Expand Down
4 changes: 2 additions & 2 deletions apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ void ReceiverTcp::accept( OnAcceptErrorFn onAcceptErrorFn, OnAcceptFn onAcceptFn
if( ! mAcceptor || ! mAcceptor->is_open() )
return;

auto socket = std::make_shared<tcp::socket>( mAcceptor->get_io_service() );
auto socket = std::make_shared<tcp::socket>( mAcceptor->get_executor() );

mAcceptor->async_accept( *socket, std::bind(
[&, onAcceptErrorFn, onAcceptFn]( TcpSocketRef socket, const asio::error_code &error ) {
Expand Down Expand Up @@ -1771,4 +1771,4 @@ void calcOffsetFromSystem( uint64_t ntpTime, int64_t *localOffsetSecs, int64_t *

} // namespace osc

} // namespace cinder
} // namespace cinder
18 changes: 9 additions & 9 deletions apps/Silversprints/blocks/OSC/src/cinder/osc/Osc.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,14 +499,14 @@ class SenderUdp : public SenderBase {
const std::string &destinationHost,
uint16_t destinationPort,
const protocol &protocol = protocol::v4(),
asio::io_service &service = ci::app::App::get()->io_service() );
asio::io_service &service = ci::app::App::get()->io_context() );
//! Constructs a Sender (called a \a server in the OSC spec) using UDP as transport, whose local endpoint is
//! defined by \a localPort and \a protocol, which defaults to v4, and remote endpoint is defined by \a
//! destination. Takes an optional io_service, used to construct the socket from.
SenderUdp( uint16_t localPort,
const protocol::endpoint &destination,
const protocol &protocol = protocol::v4(),
asio::io_service &service = ci::app::App::get()->io_service() );
asio::io_service &service = ci::app::App::get()->io_context() );
//! Constructs a Sender (called a \a server in the OSC spec) using UDP for transport, with an already created
//! udp::socket shared_ptr \a socket and remote endpoint \a destination. This constructor is good for using
//! already constructed sockets for more indepth configuration. Expects the local endpoint to be constructed.
Expand Down Expand Up @@ -562,7 +562,7 @@ class SenderTcp : public SenderBase {
const std::string &destinationHost,
uint16_t destinationPort,
const protocol &protocol = protocol::v4(),
asio::io_service &service = ci::app::App::get()->io_service(),
asio::io_service &service = ci::app::App::get()->io_context(),
PacketFramingRef packetFraming = nullptr );
//! Constructs a Sender (called a \a server in the OSC spec) using TCP as transport, whose local endpoint is
//! defined by \a localPort and \a protocol, which defaults to v4, and remote endpoint is defined by \a
Expand All @@ -571,7 +571,7 @@ class SenderTcp : public SenderBase {
SenderTcp( uint16_t localPort,
const protocol::endpoint &destination,
const protocol &protocol = protocol::v4(),
asio::io_service &service = ci::app::App::get()->io_service(),
asio::io_service &service = ci::app::App::get()->io_context(),
PacketFramingRef packetFraming = nullptr );
//! Constructs a Sender (called a \a server in the OSC spec) using TCP as transport, with an already created
//! tcp::socket shared_ptr \a socket, and remote endpoint is defined by \a destination and PacketFraming
Expand Down Expand Up @@ -690,11 +690,11 @@ class ReceiverUdp : public ReceiverBase {
//! construct the socket from.
ReceiverUdp( uint16_t port,
const protocol &protocol = protocol::v4(),
asio::io_service &io = ci::app::App::get()->io_service() );
asio::io_service &io = ci::app::App::get()->io_context() );
//! Constructs a Receiver (called a \a client in the OSC spec) using UDP for transport, whose local endpoint
//! is defined by \a localEndpoint. Takes an optional io_service to construct the socket from.
ReceiverUdp( const protocol::endpoint &localEndpoint,
asio::io_service &io = ci::app::App::get()->io_service() );
asio::io_service &io = ci::app::App::get()->io_context() );
//! Constructs a Receiver (called a \a client in the OSC spec) using UDP for transport, from the already
//! constructed udp::socket shared_ptr \a socket. Use this for extra configuration and or sharing sockets
//! between sender and receiver.
Expand Down Expand Up @@ -762,13 +762,13 @@ class ReceiverTcp : public ReceiverBase {
//! to construct the socket from.
ReceiverTcp( uint16_t port,
const protocol &protocol = protocol::v4(),
asio::io_service &service = ci::app::App::get()->io_service(),
asio::io_service &service = ci::app::App::get()->io_context(),
PacketFramingRef packetFraming = nullptr );
//! Constructs a Receiver (called a \a client in the OSC spec) using TCP for transport, whose local endpoint
//! is defined by \a localEndpoint and PacketFraming shared_ptr \a packetFraming, which defaults to null. Takes
//! an optional io_service to construct the socket from.
ReceiverTcp( const protocol::endpoint &localEndpoint,
asio::io_service &service = ci::app::App::get()->io_service(),
asio::io_service &service = ci::app::App::get()->io_context(),
PacketFramingRef packetFraming = nullptr );
//! Constructs a Receiver (called a \a client in the OSC spec) using TCP for transport, from the already
//! constructed tcp::acceptor shared_ptr \a acceptor and PacketFraming shared_ptr \a packetFraming, which
Expand Down Expand Up @@ -913,4 +913,4 @@ namespace time {

} // namespace osc

} // namespace cinder
} // namespace cinder
1 change: 0 additions & 1 deletion apps/Silversprints/include/data/SerialReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "cinder/Log.h"
#include "cinder/Timeline.h"
#include "cinder/ConcurrentCircularBuffer.h"
#include <boost/algorithm/string.hpp>

#include "data/StateManager.h"
#include "data/Model.h"
Expand Down
1 change: 0 additions & 1 deletion apps/Silversprints/include/ui/CiTextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "cinder/gl/TextureFont.h"
#include "data/Model.h"

#include <boost/algorithm/string.hpp>

class CiTextField : public ci::Rectf {
public:
Expand Down
16 changes: 13 additions & 3 deletions apps/Silversprints/src/data/SerialReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,13 @@ void SerialReader::readSerial()
void SerialReader::parseCommandToBuffer( std::string command )
{
std::vector<std::string> strs;
boost::split(strs, command, boost::is_any_of(":"));

std::stringstream ss (command);
std::string item;

while (getline (ss, item, ':')) {
strs.push_back (item);
}

std::vector<std::string> tmpBuffer;
tmpBuffer.push_back( strs[0] );

Expand Down Expand Up @@ -310,7 +315,12 @@ void SerialReader::parseFromBuffer()
// RACE PROGRESS (args are race ticks, then race time millis)
else if (cmd == "R") {
std::vector<std::string> rdata;
boost::split(rdata, args, boost::is_any_of(","));
std::stringstream ss (args);
std::string item;

while (getline (ss, item, ',')) {
rdata.push_back (item);
}

int raceMillis = fromString<int>(rdata.back());
//float dt = raceMillis - Model::instance().elapsedRaceTimeMillis;
Expand Down
22 changes: 21 additions & 1 deletion apps/Silversprints/src/ui/CiTextField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ using namespace ci::app;
using namespace std;
using namespace gfx;

// trim from start (in place)
static inline void ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
return !std::isspace(ch);
}));
}

// trim from end (in place)
static inline void rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
return !std::isspace(ch);
}).base(), s.end());
}

// trim from both ends (in place)
static inline void trim(std::string &s) {
rtrim(s);
ltrim(s);
}

CiTextField::~CiTextField(){
mMouseDownCb.disconnect();
mMouseDragCb.disconnect();
Expand Down Expand Up @@ -227,7 +247,7 @@ void CiTextField::blur(){

bActive = false;

boost::trim(mText);
trim(mText);

if( mText !="" ){
enable();
Expand Down
3 changes: 1 addition & 2 deletions apps/Silversprints/src/ui/RaceText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

#include "ui/RaceText.h"
#include <boost/algorithm/string.hpp>
#include <sstream>

using namespace gfx;
Expand Down Expand Up @@ -54,7 +53,7 @@ void RaceText::draw( gfx::PlayerData *data, const ci::vec2 &offset )
gl::color( Color::white() );

// NAME
boost::to_upper(data->player_name);
for (auto & c: data->player_name) c = toupper(c);
Model::instance().texFont->drawString(data->player_name, vec2(20, 44), Model::instance().getTfDrawOpts());

// SPEED
Expand Down
2 changes: 1 addition & 1 deletion libs/Cinder
Submodule Cinder updated 3501 files