Commit 6acfa41f authored by Sreekanth Arikatla's avatar Sreekanth Arikatla

COMP: Build audio only on windows

parent 8f8b89dc
cmake_minimum_required(VERSION 3.2)
project(iMSTK VERSION 0.0.1 LANGUAGES C CXX)
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
#-----------------------------------------------------------------------------
# CTest/Dashboards
#-----------------------------------------------------------------------------
......@@ -110,7 +114,14 @@ if(${PROJECT_NAME}_SUPERBUILD)
imstk_define_dependency(VTK)
imstk_define_dependency(VRPN)
imstk_define_dependency(LibNiFalcon)
imstk_define_dependency(SFML)
if(APPLE OR LINUX)
message("Warning: Building iMSTK WITHOUT audio support!")
set(${PROJECT_NAME}_AUDIO_ENABLED OFF)
else()
set(${PROJECT_NAME}_AUDIO_ENABLED "Windows OS detected: Building iMSTK with AUDIO support." ON)
imstk_define_dependency(SFML)
endif()
option(${PROJECT_NAME}_USE_ODE "Build iMSTK with ODE support." OFF)
if(${PROJECT_NAME}_USE_ODE)
......@@ -243,7 +254,7 @@ find_package( VRPN REQUIRED )
include_directories( ${VRPN_INCLUDE_DIRS} )
add_definitions( -DVRPN_USE_LIBNIFALCON )
if(${PROJECT_NAME}_USE_OMNI)
add_definitions( -DiMSTK_USE_OPENHAPTICS )
add_definitions( -DiMSTK_USE_OPENHAPTICS )
add_definitions( -DVRPN_USE_PHANTOM_SERVER )
else()
remove_definitions( -DiMSTK_USE_OPENHAPTICS )
......@@ -271,7 +282,12 @@ else()
endif()
# SFML
find_package( SFML REQUIRED )
if(APPLE OR LINUX)
remove_definitions( -DiMSTK_AUDIO_ENABLED )
else()
find_package( SFML REQUIRED )
add_definitions( -DiMSTK_AUDIO_ENABLED )
endif()
# Google Test
if(BUILD_TESTING)
......
......@@ -26,11 +26,15 @@ add_executable(${PROJECT_NAME} main.cpp)
#-----------------------------------------------------------------------------
# Link libraries to executable
#-----------------------------------------------------------------------------
target_link_libraries(${PROJECT_NAME}
if(UNIX)
target_link_libraries(${PROJECT_NAME}
SimulationManager)
else()
target_link_libraries(${PROJECT_NAME}
SimulationManager
SFML
)
SFML)
endif()
#-----------------------------------------------------------------------------
# Associate external data
#-----------------------------------------------------------------------------
......
......@@ -97,9 +97,13 @@
#include <string>
#include <vtkJPEGReader.h>
#ifdef iMSTK_AUDIO_ENABLED
// Audio
#include <SFML/Audio.hpp>
#endif
// global variables
const std::string phantomOmni1Name = "Phantom1";
const std::string phantomOmni2Name = "Phantom2";
......@@ -3340,6 +3344,7 @@ void testRigidBody()
// Example modified from SFML/Examples
void testSound(const std::string& filename)
{
#ifdef iMSTK_AUDIO_ENABLED
// Load a sound buffer from a .wav file
sf::SoundBuffer buffer;
if (!buffer.loadFromFile(filename))
......@@ -3378,11 +3383,15 @@ void testSound(const std::string& filename)
std::cout << std::flush;
}
std::cout << "\n" << std::endl;
#else
LOG(INFO) << "testSound: Audio is supported only on windows!";
#endif
}
// Example modified from SFML/Examples
void playMusic(const std::string& filename)
{
#ifdef iMSTK_AUDIO_ENABLED
// Load an ogg music file
sf::Music music;
if (!music.openFromFile(filename))
......@@ -3411,6 +3420,9 @@ void playMusic(const std::string& filename)
std::cout << std::flush;
}
std::cout << "\n" << std::endl;
#else
LOG(INFO) << "playMusic: Audio is supported only on windows!";
#endif
}
void testAudio()
......@@ -3463,7 +3475,7 @@ int main()
Test physics
------------------*/
//testPbdVolume();
testPbdCloth();
//testPbdCloth();
//testPbdCollision();
//testPbdFluidBenchmarking();
//testPbdFluid();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment