From: Marcus Tomlinson Date: Sun, 24 Feb 2019 17:58:43 +0000 (+0000) Subject: Check for '#if defined( WIN32 )' in test apps X-Git-Url: https://main.carlh.net/gitweb/?p=rtaudio-cdist.git;a=commitdiff_plain;h=03599c1281835f886e98da7d15244075ec88913f Check for '#if defined( WIN32 )' in test apps --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 19d2c54..9ee491d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,10 @@ if(WIN32) set(CMAKE_DEBUG_POSTFIX "d") endif() +if(MINGW) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + # Build Options option(BUILD_SHARED_LIBS "Compile library shared lib." TRUE) option(BUILD_STATIC_LIBS "Compile library static lib." TRUE) @@ -196,9 +200,6 @@ if (NEED_PTHREAD) list(APPEND LINKLIBS Threads::Threads) endif() -# Set compile-time definitions -add_definitions(${API_DEFS}) - # Create library targets. cmake_policy(SET CMP0042 OLD) set(LIB_TARGETS) @@ -218,6 +219,7 @@ if(BUILD_SHARED_LIBS) ${INCDIRS}) # Set compile-time definitions + target_compile_definitions(rtaudio PRIVATE ${API_DEFS}) target_compile_definitions(rtaudio PRIVATE RTAUDIO_EXPORT) target_link_libraries(rtaudio ${LINKLIBS}) @@ -238,6 +240,9 @@ if(BUILD_STATIC_LIBS) $ ${INCDIRS}) + # Set compile-time definitions + target_compile_definitions(rtaudio_static PRIVATE ${API_DEFS}) + target_link_libraries(rtaudio_static ${LINKLIBS}) endif() diff --git a/tests/playraw.cpp b/tests/playraw.cpp index f11f83c..0216f4a 100644 --- a/tests/playraw.cpp +++ b/tests/playraw.cpp @@ -44,7 +44,7 @@ typedef double MY_TYPE; */ // Platform-dependent sleep routines. -#if defined( __WINDOWS_ASIO__ ) || defined( __WINDOWS_DS__ ) || defined( __WINDOWS_WASAPI__ ) +#if defined( WIN32 ) #include #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) #else // Unix variants diff --git a/tests/playsaw.cpp b/tests/playsaw.cpp index d1953b6..1f7bd52 100644 --- a/tests/playsaw.cpp +++ b/tests/playsaw.cpp @@ -41,7 +41,7 @@ typedef double MY_TYPE; */ // Platform-dependent sleep routines. -#if defined( __WINDOWS_ASIO__ ) || defined( __WINDOWS_DS__ ) || defined( __WINDOWS_WASAPI__ ) +#if defined( WIN32 ) #include #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) #else // Unix variants diff --git a/tests/record.cpp b/tests/record.cpp index 0e48f77..faa9789 100644 --- a/tests/record.cpp +++ b/tests/record.cpp @@ -38,7 +38,7 @@ typedef double MY_TYPE; */ // Platform-dependent sleep routines. -#if defined( __WINDOWS_ASIO__ ) || defined( __WINDOWS_DS__ ) || defined( __WINDOWS_WASAPI__ ) +#if defined( WIN32 ) #include #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) #else // Unix variants diff --git a/tests/teststops.cpp b/tests/teststops.cpp index 6159b88..0b85b48 100644 --- a/tests/teststops.cpp +++ b/tests/teststops.cpp @@ -21,7 +21,7 @@ #define REPETITIONS 10 // Platform-dependent sleep routines. -#if defined( __WINDOWS_ASIO__ ) || defined( __WINDOWS_DS__ ) || defined( __WINDOWS_WASAPI__ ) +#if defined( WIN32 ) #include #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) #else // Unix variants