Browse Source

Windows MSVC

- fix winsock2 in MSVC build
- seperate msvc flags from mingw in waf
pull/477/head
Hlodver Sigurdsson 6 years ago
parent
commit
183b5f0e61
11 changed files with 29 additions and 51 deletions
  1. +1
    -1
      common/JackActivationCount.cpp
  2. +3
    -0
      common/JackAtomicArrayState.h
  3. +3
    -0
      common/JackAtomicState.h
  4. +4
    -0
      common/jack/jack.h
  5. +1
    -5
      common/jack/systemdeps.h
  6. +2
    -1
      common/shm.c
  7. +2
    -1
      common/wscript
  8. +5
    -33
      windows/JackAtomic_os.h
  9. +1
    -1
      windows/JackNetWinSocket.h
  10. +1
    -2
      windows/JackRouter/JackRouter.cpp
  11. +6
    -7
      wscript

+ 1
- 1
common/JackActivationCount.cpp View File

@@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/
#include "systemdeps.h"
#include "JackAtomic.h"
#include "JackActivationCount.h"
#include "JackConstants.h"


+ 3
- 0
common/JackAtomicArrayState.h View File

@@ -21,6 +21,9 @@
#define __JackAtomicArrayState__

#include "JackAtomic.h"
#ifdef _MSC_VER
#include "JackAtomic_os.h"
#endif
#include "JackCompilerDeps.h"
#include <string.h> // for memcpy



+ 3
- 0
common/JackAtomicState.h View File

@@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __JackAtomicState__

#include "JackAtomic.h"
#ifdef _MSC_VER
#include "JackAtomic_os.h"
#endif
#include "JackCompilerDeps.h"
#include <string.h> // for memcpy



+ 4
- 0
common/jack/jack.h View File

@@ -1420,7 +1420,9 @@ jack_time_t jack_get_time(void) JACK_OPTIONAL_WEAK_EXPORT;
*
* @param msg error message text (no newline at end).
*/
#ifndef _MSC_VER
extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
#endif
/**
* Set the @ref jack_error_callback for error message display.
* Set it to NULL to restore default_jack_error_callback function.
@@ -1438,7 +1440,9 @@ void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXP
*
* @param msg info message text (no newline at end).
*/
#ifndef _MSC_VER
extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
#endif

/**
* Set the @ref jack_info_callback for info message display.


+ 1
- 5
common/jack/systemdeps.h View File

@@ -61,11 +61,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(GNU_WIN32)

#include <stdint.h>

#ifdef __MINGW32__
# include <winsock2.h> // mingw gives warning if we include windows.h before winsock2.h
#endif

#include <winsock2.h>
#include <windows.h>

#ifdef _MSC_VER /* Microsoft compiler */


+ 2
- 1
common/shm.c View File

@@ -33,9 +33,10 @@

#include "JackConstants.h"
#ifdef _WIN32
#define _WINSOCKAPI_
#include <windows.h>
#include <process.h>
#include <stdio.h>
#include <windows.h>
#include <Lmcons.h>
#include <memoryapi.h>
#else


+ 2
- 1
common/wscript View File

@@ -29,7 +29,8 @@ def create_jack_process_obj(bld, target, sources, uselib = None, framework = Non
if bld.env['IS_SUN']:
env_includes = ['../solaris', '../posix', '../solaris/oss']
if bld.env['IS_WINDOWS']:
driver.env.append_unique('LDFLAGS', ['/DLL', "common\\build"])
if conf.env['CC_NAME'] == 'msvc':
driver.env.append_unique('LDFLAGS', ['/DLL', "common\\build", '/MT'])
env_includes = ['../windows', '../windows/portaudio']
process.includes = ['.'] + env_includes + ['jack', '..']
process.name = target


+ 5
- 33
windows/JackAtomic_os.h View File

@@ -22,8 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "JackTypes.h"

#ifndef __MINGW32__
#ifdef _MSC_VER
#define COMPARE_EXCHANGE(ADDRESS, NEW, EXPECTED) atomic::msvc::interlocked<UInt32, 4>::compare_exchange(ADDRESS, NEW, EXPECTED)
#endif

#ifdef __MINGW32__
#ifdef __SMP__
# define LOCK lock
#else
@@ -37,37 +40,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//----------------------------------------------------------------
// CAS functions
//----------------------------------------------------------------
#if defined(_M_X64)

#include <atomic>

bool CAS(volatile UInt32 value, UInt32 newvalue, volatile void * addr)
{
return std::atomic_compare_exchange_weak((std::_Atomic_address *) addr, value, newvalue);
}

#else

inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void * addr)
{
register char c;
__asm {
push ebx
push esi
mov esi, addr
mov eax, value
mov ebx, newvalue
LOCK cmpxchg dword ptr [esi], ebx
sete c
pop esi
pop ebx
}
return c;
}

#endif

#else

#define LOCK "lock ; "

@@ -84,6 +56,6 @@ static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* ad
return ret;
}

#endif
#endif // __MINGW32__

#endif

+ 1
- 1
windows/JackNetWinSocket.h View File

@@ -22,8 +22,8 @@

#include "JackNetSocket.h"
#include <winsock2.h>
#ifdef __MINGW32__
#include <ws2tcpip.h>
#ifdef __MINGW32__
#include <stdint.h>
#endif



+ 1
- 2
windows/JackRouter/JackRouter.cpp View File

@@ -56,8 +56,7 @@ static const double twoRaisedTo32Reciprocal = 1. / twoRaisedTo32;
//------------------------------------------------------------------------------------------
// on windows, we do the COM stuff.
#if WINDOWS
#include "windows.h"
#if _WIN32
#include "mmsystem.h"
#ifdef _WIN64
#define JACK_ROUTER "JackRouter.dll"


+ 6
- 7
wscript View File

@@ -116,10 +116,6 @@ def options(opt):
help='Enable Portaudio driver',
conf_dest='BUILD_DRIVER_PORTAUDIO')
portaudio.check(header_name='windows.h') # only build portaudio on windows
# portaudio.check_cfg(
# package='portaudio-2.0 >= 19',
# uselib_store='PORTAUDIO',
# args='--cflags --libs')
winmme = opt.add_auto_option(
'winmme',
help='Enable WinMME driver',
@@ -209,12 +205,15 @@ def configure(conf):
detect_platform(conf)

if conf.env['IS_WINDOWS']:
conf.env.append_unique('CCDEFINES', '_POSIX')
conf.env.append_unique('CXXDEFINES', '_POSIX')
if conf.env['CC_NAME'] == 'msvc':
conf.env.append_unique('CXXFLAGS', '/MT') # static linking
conf.env.append_unique('CXXFLAGS', '/std:c++14')
conf.env.append_unique('CXXFLAGS', '/EHsc')
conf.env.append_unique('CXXFLAGS', '/D_WINSOCKAPI_=1') # https://stackoverflow.com/a/1517198
conf.env.append_unique('LIBPATH', os.getcwd() + '\\windows\\lib')
else:
conf.env.append_unique('CCDEFINES', '_POSIX')
conf.env.append_unique('CXXDEFINES', '_POSIX')
else:
conf.env.append_unique('CXXFLAGS', '-Wall')
conf.env.append_unique('CXXFLAGS', '-std=gnu++11')
@@ -733,7 +732,7 @@ def build_drivers(bld):
target = 'portaudio',
source = portaudio_src,
use = ['PORTAUDIO'],
win_dll = ['common\\jackserver.lib', '..\\libportaudio64.lib'])
win_dll = ['common\\jackserver.lib', os.getenv('PORTAUDIO_LIBRARY') or 'libportaudio64.lib'])

if bld.env['BUILD_DRIVER_WINMME']:
create_driver_obj(


Loading…
Cancel
Save