cmake build working for interface project

This commit is contained in:
Stephen Birarda 2013-02-07 17:29:01 -08:00
parent 9a8b558863
commit f5cbe7a05a
24 changed files with 195 additions and 25 deletions

View file

@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
project(hifi)
set(GLM_DIR "${CMAKE_SOURCE_DIR}/thirdparty/glm")
set(PORTAUDIO_DIR "${CMAKE_SOURCE_DIR}/thirdparty/PortAudio")
set(GLM_ROOT_DIR ${CMAKE_SOURCE_DIR}/thirdparty)
set(PORTAUDIO_ROOT_DIR ${CMAKE_SOURCE_DIR}/thirdparty/Portaudio)
set(LODEPNG_ROOT_DIR ${CMAKE_SOURCE_DIR}/thirdparty/LodePNG)
add_subdirectory(interface)

View file

@ -0,0 +1,63 @@
# FindGLM - attempts to locate the glm matrix/vector library.
#
# This module defines the following variables (on success):
# GLM_INCLUDE_DIRS - where to find glm/glm.hpp
# GLM_FOUND - if the library was successfully located
#
# It is trying a few standard installation locations, but can be customized
# with the following variables:
# GLM_ROOT_DIR - root directory of a glm installation
# Headers are expected to be found in either:
# <GLM_ROOT_DIR>/glm/glm.hpp OR
# <GLM_ROOT_DIR>/include/glm/glm.hpp
# This variable can either be a cmake or environment
# variable. Note however that changing the value
# of the environment varible will NOT result in
# re-running the header search and therefore NOT
# adjust the variables set by this module.
#=============================================================================
# Copyright 2012 Carsten Neumann
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# default search dirs
SET(_glm_HEADER_SEARCH_DIRS
"/usr/include"
"/usr/local/include")
# check environment variable
SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
# put user specified location at beginning of search
IF(GLM_ROOT_DIR)
SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
"${GLM_ROOT_DIR}/include"
${_glm_HEADER_SEARCH_DIRS})
ENDIF(GLM_ROOT_DIR)
# locate header
FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
PATHS ${_glm_HEADER_SEARCH_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
GLM_INCLUDE_DIR)
IF(GLM_FOUND)
SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
ENDIF(GLM_FOUND)

View file

@ -0,0 +1,44 @@
# - Try to find the LodePNG library
#
# You must provide a LODEPNG_ROOT_DIR which contains the header and cpp file
#
# Once done this will define
#
# LODEPNG_FOUND - system has LODEPNG_FOUND
# LODEPNG_INCLUDE_DIRS - the LodePNG include directory
# LODEPNG_LIBRARY - Link these to use LodePNG
#
# Copyright (c) 2013 Stephen Birarda <birarda@coffeeandpower.com>
#
if (LODEPNG_LIBRARY AND LODEPNG_INCLUDE_DIRS)
# in cache already
set(LODEPNG_FOUND TRUE)
else (LODEPNG_LIBRARY AND LODEPNG_INCLUDE_DIRS)
set(LODEPNG_INCLUDE_DIRS
${LODEPNG_ROOT_DIR}/lodepng.h
)
set(LODEPNG_LIBRARY
${LODEPNG_ROOT_DIR}/lodepng.cpp
)
if (LODEPNG_INCLUDE_DIRS AND LODEPNG_LIBRARY)
set(LODEPNG_FOUND TRUE)
endif (LODEPNG_INCLUDE_DIRS AND LODEPNG_LIBRARY)
if (LODEPNG_FOUND)
if (NOT LodePNG_FIND_QUIETLY)
message(STATUS "Found LodePNG: ${LODEPNG_LIBRARY}")
endif (NOT LodePNG_FIND_QUIETLY)
else (LODEPNG_FOUND)
if (LodePNG_FIND_REQUIRED)
message(FATAL_ERROR "Could not find LodePNG")
endif (LodePNG_FIND_REQUIRED)
endif (LODEPNG_FOUND)
# show the LODEPNG_INCLUDE_DIRS and LODEPNG_LIBRARY variables only in the advanced view
mark_as_advanced(LODEPNG_INCLUDE_DIRS LODEPNG_LIBRARY)
endif (LODEPNG_LIBRARY AND LODEPNG_INCLUDE_DIRS)

View file

@ -0,0 +1,46 @@
# - Try to find the Portaudio library
#
# You must provide a PORTAUDIO_ROOT_DIR which contains the header and library
#
# Once done this will define
#
# PORTAUDIO_FOUND - system has Portaudio
# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
# PORTAUDIO_LIBRARY - Link these to use Portaudio
#
# Copyright (c) 2013 Stephen Birarda <birarda@coffeeandpower.com>
#
# Heavily based on Andreas Schneider's original FindPortaudio.cmake
# which can be found at http://gnuradio.org/redmine/projects/gnuradio/repository/
if (PORTAUDIO_LIBRARY AND PORTAUDIO_INCLUDE_DIRS)
# in cache already
set(PORTAUDIO_FOUND TRUE)
else (PORTAUDIO_LIBRARY AND PORTAUDIO_INCLUDE_DIRS)
set(PORTAUDIO_INCLUDE_DIRS
${PORTAUDIO_ROOT_DIR}/portaudio.h
)
set(PORTAUDIO_LIBRARY
${PORTAUDIO_ROOT_DIR}/libportaudio.a
)
if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARY)
set(PORTAUDIO_FOUND TRUE)
endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARY)
if (PORTAUDIO_FOUND)
if (NOT Portaudio_FIND_QUIETLY)
message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARY}")
endif (NOT Portaudio_FIND_QUIETLY)
else (PORTAUDIO_FOUND)
if (Portaudio_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Portaudio")
endif (Portaudio_FIND_REQUIRED)
endif (PORTAUDIO_FOUND)
# show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARY variables only in the advanced view
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARY)
endif (PORTAUDIO_LIBRARY AND PORTAUDIO_INCLUDE_DIRS)

View file

@ -6,8 +6,26 @@ file(GLOB INTERFACE_SRCS src/*.cpp src/*.h)
add_executable(interface ${INTERFACE_SRCS})
include_directories(${GLM_DIR})
target_link_libraries(interface GLM)
if (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreServices -framework Carbon")
endif (APPLE)
include_directories(${PORTAUDIO_DIR})
target_link_libraries(interface ${PORTAUDIO_DIR}/libportaudio.a)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(GLM REQUIRED)
find_package(Portaudio REQUIRED)
find_package(LodePNG REQUIRED)
include_directories(
${OPENGL_INCLUDE_DIRS}
${GLUT_INCLUDE_DIRS}
${GLM_INCLUDE_DIRS}
${PORTAUDIO_INCLUDE_DIRS}
${LODEPNG_INCLUDE_DIRS}
)
target_link_libraries(interface
${OPENGL_LIBRARY}
${GLUT_LIBRARY}
${PORTAUDIO_LIBRARY}
${LODEPNG_LIBRARY}
)

View file

@ -9,7 +9,7 @@
#ifndef __interface__Agent__
#define __interface__Agent__
#include <glm.hpp>
#include <glm/glm.hpp>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

View file

@ -10,7 +10,7 @@
#define __interface__Audio__
#include <iostream>
#include "portaudio.h"
#include <Portaudio/portaudio.h>
#include "Head.h"
#include "AudioData.h"

View file

@ -10,7 +10,7 @@
#define __interface__AudioSource__
#include <iostream>
#include <glm.hpp>
#include <glm/glm.hpp>
class AudioSource {
public:

View file

@ -9,7 +9,7 @@
#ifndef __interface__Cube__
#define __interface__Cube__
#include <glm.hpp>
#include <glm/glm.hpp>
#include "Util.h"
#include "world.h"
#include <GLUT/glut.h>

View file

@ -7,7 +7,7 @@
//
#include "Field.h"
#include <glm.hpp>
#include <glm/glm.hpp>
#define FIELD_SCALE 0.00050
#define COLOR_DRIFT_RATE 0.001f // per-frame drift of particle color towards field element color
#define COLOR_MIN 0.2f // minimum R/G/B value at 0,0,0 - also needs setting in cloud.cpp

View file

@ -17,7 +17,7 @@
#include <iostream>
#include "world.h"
#include "Util.h"
#include <glm.hpp>
#include <glm/glm.hpp>
// Field is a lattice of vectors uniformly distributed FIELD_ELEMENTS^(1/3) on side
const int FIELD_ELEMENTS = 1000;

View file

@ -9,7 +9,7 @@
#ifndef __interface__Finger__
#define __interface__Finger__
#include <glm.hpp>
#include <glm/glm.hpp>
#include "Util.h"
#include "world.h"
#include <GLUT/glut.h>

View file

@ -9,7 +9,7 @@
#ifndef __interface__Hand__
#define __interface__Hand__
#include <glm.hpp>
#include <glm/glm.hpp>
#include <iostream>
#include "Util.h"
#include "Field.h"

View file

@ -9,7 +9,7 @@
#include <iostream>
#include "Head.h"
#include "Util.h"
#include <glm.hpp>
#include <glm/glm.hpp>
#include "SerialInterface.h"
float skinColor[] = {1.0, 0.84, 0.66};

View file

@ -9,7 +9,7 @@
#ifndef __interface__Lattice__
#define __interface__Lattice__
#include <glm.hpp>
#include <glm/glm.hpp>
#include "Util.h"
#include "world.h"
#include <GLUT/glut.h>

View file

@ -9,7 +9,7 @@
#ifndef __interface__Oscilloscope__
#define __interface__Oscilloscope__
#include <glm.hpp>
#include <glm/glm.hpp>
#include "Util.h"
#include "World.h"
#include <GLUT/glut.h>

View file

@ -9,7 +9,7 @@
#ifndef __interface__Particle__
#define __interface__Particle__
#include <glm.hpp>
#include <glm/glm.hpp>
#include "Util.h"
#include "world.h"
#include <GLUT/glut.h>

View file

@ -6,7 +6,7 @@
#ifndef __interface__SerialInterface__
#define __interface__SerialInterface__
#include <glm.hpp>
#include <glm/glm.hpp>
#include "util.h"
#include "world.h"
#include <GLUT/glut.h>

View file

@ -13,7 +13,7 @@
#else
#include <GL/glut.h>
#endif
#include "lodepng.h"
#include <LodePNG/lodepng.h>
#include <vector>
#include <cstdio>

View file

@ -13,7 +13,7 @@
#endif
#include <iostream>
#include "world.h"
#include <glm.hpp>
#include <glm/glm.hpp>
#include "util.h"

View file

@ -9,7 +9,7 @@
#ifndef __interface__Util__
#define __interface__Util__
#include <glm.hpp>
#include <glm/glm.hpp>
float azimuth_to(glm::vec3 head_pos, glm::vec3 source_pos);
float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float head_yaw);

View file

@ -36,8 +36,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <glm.hpp>
#include "portaudio.h"
#include <glm/glm.hpp>
// Bring in OpenCV