Skip to content

Commit

Permalink
fixed windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Shilo_XyZ_ authored and Shilo_XyZ_ committed Aug 27, 2020
1 parent 5cba3d1 commit 27e58bd
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
25 changes: 18 additions & 7 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ set_target_properties(SDL2 PROPERTIES IMPORTED_LOCATION_RELEASE ${sdl2_install_d
set_target_properties(SDL2 PROPERTIES IMPORTED_LOCATION_DEBUG ${sdl2_install_dir}/lib/SDL2d${CMAKE_STATIC_LIBRARY_SUFFIX})
add_dependencies(SDL2 sdl2)

add_library(SDL2main STATIC IMPORTED)
set_target_properties(SDL2main PROPERTIES IMPORTED_LOCATION_RELEASE ${sdl2_install_dir}/lib/SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX})
set_target_properties(SDL2main PROPERTIES IMPORTED_LOCATION_DEBUG ${sdl2_install_dir}/lib/SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX})
add_dependencies(SDL2main sdl2)

ExternalProject_Get_Property(project_portaudio install_dir)

set(portaudio_install_dir ${install_dir})
Expand All @@ -74,14 +79,21 @@ add_library(Portaudio STATIC IMPORTED)
set_target_properties(Portaudio PROPERTIES IMPORTED_LOCATION ${portaudio_install_dir}/lib/${portaudio_libName})
add_dependencies(Portaudio project_portaudio)

set(ADD_LIBS SDL2 Portaudio)
set(ADD_INCLUDES_PATHS
${sdl2_install_dir}/include
${portaudio_install_dir}/include
)
#set(ADD_LIBS SDL2 Portaudio)
#set(ADD_INCLUDES_PATHS
# ${sdl2_install_dir}/include
# ${portaudio_install_dir}/include
#)

set(PORTAUDIO_INCLUDE_DIRS ${portaudio_install_dir}/include)
set(PORTAUDIO_LIBRARIES Portaudio)

set(SDL2_FOUND TRUE)
set(PORTAUDIO_FOUND TRUE)
set(PORTAUDIO_VERSION 19)

add_library(SDL2::SDL2main ALIAS SDL2main)
add_library(SDL2::SDL2 ALIAS SDL2)

else()

Expand All @@ -92,6 +104,7 @@ endif()

set(PlayerWriter_DIR ${CMAKE_CURRENT_SOURCE_DIR}/pcm_utils/PlayerWriter)


if ((SDL2_FOUND) AND (PORTAUDIO_FOUND) AND (PORTAUDIO_VERSION EQUAL 19))
set(ADD_LIBS ${PORTAUDIO_LIBRARIES})
set(ADD_INCLUDES_PATHS ${PORTAUDIO_INCLUDE_DIRS})
Expand All @@ -102,8 +115,6 @@ if ((SDL2_FOUND) AND (PORTAUDIO_FOUND) AND (PORTAUDIO_VERSION EQUAL 19))
list(APPEND ADD_LIBS SDL2::SDL2main SDL2::SDL2)
endif()

message(STATUS "Include: " ${ADD_INCLUDES_PATHS})

set(PlayerWriter_SRC
${PlayerWriter_DIR}/player.cpp
)
Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ if (NOT WIN32)
)
endif()


#if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:playlib /NODEFAULTLIB:common")
#endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/SAFESEH:NO")
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/argparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void Options::dump(std::ostream &os) const {
}
os << "\tUse dither: " << printBool(width14 ? use_dither : false) << endl;

if ((crop_top || crop_bot) && !rpiMode) {
if ((crop_top || crop_bot)) {
os << "\tCrop video top=" << crop_top << ", bot=" << crop_bot << endl;
}
if (codec != uncompresed) {
Expand Down
1 change: 1 addition & 0 deletions src/ctrlc_listener.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <iostream>

#ifdef _MSC_VER
#include <windows.h>
Expand Down
1 change: 1 addition & 0 deletions src/ffmpegvideocoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define FFMPEGVIDEOCODER_H

#include <memory>
#include <string>

#include "ipcmframeprocessingpolicy.h"

Expand Down
12 changes: 10 additions & 2 deletions src/main-st.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ static int play(Options &options) {
// --- working pipeline ---

Splitter<AudioProdusser::AudioPacket> *splitter = nullptr;
if (options.Play() && !options.rpiMode) {
if (options.Play()
#if RPI
&& !options.rpiMode
#endif
) {
#if PLAYER
splitter = new Splitter<AudioProdusser::AudioPacket>();
splitter->AddConsumer(new PlayerConsumer(0, 2));
Expand All @@ -119,7 +123,11 @@ static int play(Options &options) {
new BitWidthConverter{options.width14, options.use_dither};

auto &preparedSamples =
(options.Play() && !options.rpiMode)
(options.Play()
#if RPI
&& !options.rpiMode
#endif
)
? audioprodusser.NextStage(splitter).NextStage(bitWidthConverter)
: audioprodusser.NextStage(bitWidthConverter);

Expand Down

0 comments on commit 27e58bd

Please sign in to comment.