From 1caa844dad647b03cf3c1d11bf211e9fcde4b7f1 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Wed, 15 Mar 2017 11:38:22 -0700 Subject: Windows Compiling --- winbuild/calibrate/calibrate.vcxproj | 159 +++++++++++++++++++++++++++ winbuild/calibrate/calibrate.vcxproj.filters | 27 +++++ 2 files changed, 186 insertions(+) create mode 100644 winbuild/calibrate/calibrate.vcxproj create mode 100644 winbuild/calibrate/calibrate.vcxproj.filters (limited to 'winbuild/calibrate') diff --git a/winbuild/calibrate/calibrate.vcxproj b/winbuild/calibrate/calibrate.vcxproj new file mode 100644 index 0000000..53492e9 --- /dev/null +++ b/winbuild/calibrate/calibrate.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {A60984C4-0D12-423B-AED7-EBE4AD3F1C6B} + Win32Proj + calibrate + 10.0.14393.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) + + + Console + + + + + + + Level3 + Disabled + HIDAPI;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) + + + Console + + + + + Level3 + + + MaxSpeed + true + true + HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) + + + Console + true + true + + + + + Level3 + + + MaxSpeed + true + true + HIDAPI;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) + + + Console + true + true + + + + + + + + + + + {435cfd2c-8724-42ee-8fde-71ef7d2c6b2f} + + + + + + \ No newline at end of file diff --git a/winbuild/calibrate/calibrate.vcxproj.filters b/winbuild/calibrate/calibrate.vcxproj.filters new file mode 100644 index 0000000..546497e --- /dev/null +++ b/winbuild/calibrate/calibrate.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file -- cgit v1.3.1 From a409645cd3e2b8f0cc67541a9e4c88bf2cd96a79 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Wed, 15 Mar 2017 15:31:17 -0700 Subject: Building & basic running --- calibrate.c | 1 + include/libsurvive/survive.h | 14 +++++++++++--- redist/symbol_enumerator.c | 2 +- src/survive.c | 3 ++- winbuild/calibrate/calibrate.vcxproj | 21 +++++++++++++++++---- winbuild/libsurvive/libsurvive.vcxproj | 12 ++++++++---- winbuild/libsurvive/libsurvive.vcxproj.filters | 12 ++++++++++++ 7 files changed, 52 insertions(+), 13 deletions(-) (limited to 'winbuild/calibrate') diff --git a/calibrate.c b/calibrate.c index b6671b5..9633a77 100644 --- a/calibrate.c +++ b/calibrate.c @@ -199,3 +199,4 @@ int main() printf( "Returned\n" ); } + diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index db04a9d..2663c57 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -147,10 +147,10 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode #elif defined(_MSC_VER) #pragma section(".CRT$XCU",read) #define INITIALIZER2_(f,p) \ - static void f(void); \ + __declspec(dllexport) void f(void); \ __declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \ __pragma(comment(linker,"/include:" p #f "_")) \ - static void f(void) + void f(void) #ifdef _WIN64 #define INITIALIZER(f) INITIALIZER2_(f,"") #else @@ -163,11 +163,19 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode #endif // End macros from StackOverflow. +//static void foo(void) +//{ +// int a=0; +//} +// +//INITIALIZER(foo); + void RegisterDriver( const char * name, void * data ); #define REGISTER_LINKTIME( func ) \ - INITIALIZER(LTRegister##func) { RegisterDriver( #func, &func ); } + __declspec(dllexport) void LTRegister##func() { RegisterDriver( #func, &func ); } \ + INITIALIZER(LTRegister##func) diff --git a/redist/symbol_enumerator.c b/redist/symbol_enumerator.c index eddddb9..7d33900 100644 --- a/redist/symbol_enumerator.c +++ b/redist/symbol_enumerator.c @@ -1,7 +1,7 @@ #include #include "symbol_enumerator.h" -#if defined( WIN32 ) || defined( WINDOWS ) || defined( USE_WINDOWS ) +#if defined( WIN32 ) || defined( WINDOWS ) || defined( USE_WINDOWS ) || defined( _WIN32 ) #include diff --git a/src/survive.c b/src/survive.c index 1b5bed1..2982a4f 100755 --- a/src/survive.c +++ b/src/survive.c @@ -14,7 +14,8 @@ static int did_runtime_symnum; int SymnumCheck( const char * path, const char * name, void * location, long size ) { - if( strncmp( name, "REGISTER", 8 ) == 0 ) + printf("%s\n", name); + if( strncmp( name, "LTRegister", 8 ) == 0 ) { typedef void (*sf)(); sf fn = (sf)location; diff --git a/winbuild/calibrate/calibrate.vcxproj b/winbuild/calibrate/calibrate.vcxproj index 53492e9..f08b953 100644 --- a/winbuild/calibrate/calibrate.vcxproj +++ b/winbuild/calibrate/calibrate.vcxproj @@ -88,11 +88,14 @@ Level3 Disabled - HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) Console + + + setupapi.lib;dbghelp.lib;%(AdditionalDependencies) @@ -101,11 +104,15 @@ Level3 Disabled - HIDAPI;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) Console + + + setupapi.lib;dbghelp.lib;%(AdditionalDependencies) + LTRegisterDriverRegHTCVive;%(ForceSymbolReferences) @@ -116,13 +123,16 @@ MaxSpeed true true - HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) Console true true + + + setupapi.lib;dbghelp.lib;%(AdditionalDependencies) @@ -133,13 +143,16 @@ MaxSpeed true true - HIDAPI;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) Console true true + + + setupapi.lib;dbghelp.lib;%(AdditionalDependencies) diff --git a/winbuild/libsurvive/libsurvive.vcxproj b/winbuild/libsurvive/libsurvive.vcxproj index 225cab6..f104954 100644 --- a/winbuild/libsurvive/libsurvive.vcxproj +++ b/winbuild/libsurvive/libsurvive.vcxproj @@ -77,7 +77,7 @@ Level3 Disabled - NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;_DEBUG;_LIB;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;_DEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -90,7 +90,7 @@ Level3 Disabled - NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -105,7 +105,7 @@ MaxSpeed true true - NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -122,7 +122,7 @@ MaxSpeed true true - NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;NDEBUG;_LIB;%(PreprocessorDefinitions) + RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;NDEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -141,6 +141,7 @@ + @@ -154,6 +155,7 @@ + @@ -164,10 +166,12 @@ + + diff --git a/winbuild/libsurvive/libsurvive.vcxproj.filters b/winbuild/libsurvive/libsurvive.vcxproj.filters index 0a3b6c3..761da6a 100644 --- a/winbuild/libsurvive/libsurvive.vcxproj.filters +++ b/winbuild/libsurvive/libsurvive.vcxproj.filters @@ -75,6 +75,12 @@ Source Files + + Source Files + + + Source Files + @@ -113,5 +119,11 @@ Header Files + + Header Files + + + Header Files + \ No newline at end of file -- cgit v1.3.1 From fa0f4825937ed93163bb2cd165c001d7444d8928 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Thu, 16 Mar 2017 10:31:19 -0700 Subject: Last try at getting linktime registration working under MSVC --- include/libsurvive/survive.h | 4 ++++ src/survive.c | 11 +++++++++++ winbuild/calibrate/calibrate.vcxproj | 11 ++++++----- winbuild/libsurvive/libsurvive.vcxproj | 10 ++++++---- winbuild/libsurvive/libsurvive.vcxproj.filters | 6 ++++++ 5 files changed, 33 insertions(+), 9 deletions(-) (limited to 'winbuild/calibrate') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index 2663c57..deb91c4 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -149,6 +149,7 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode #define INITIALIZER2_(f,p) \ __declspec(dllexport) void f(void); \ __declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \ + volatile static void * LTRegistrationPinnerFor##f = &##f; \ __pragma(comment(linker,"/include:" p #f "_")) \ void f(void) #ifdef _WIN64 @@ -176,6 +177,9 @@ void RegisterDriver( const char * name, void * data ); #define REGISTER_LINKTIME( func ) \ __declspec(dllexport) void LTRegister##func() { RegisterDriver( #func, &func ); } \ INITIALIZER(LTRegister##func) + + + //void __attribute__((constructor)) LTRegister##func() { RegisterDriver(#func, &func); } diff --git a/src/survive.c b/src/survive.c index 2982a4f..c2b2940 100755 --- a/src/survive.c +++ b/src/survive.c @@ -47,6 +47,17 @@ SurviveContext * survive_init( int headless ) did_runtime_symnum = 1; } #endif +//#ifdef MANUAL_REGISTRATION +// // note: this manual registration is currently only in use on builds using Visual Studio. +// +//#define MANUAL_DRIVER_REGISTRATION(func) int func( SurviveObject * so, PoserData * pd ); RegisterDriver( #func, &func); +// +// MANUAL_DRIVER_REGISTRATION(PoserCharlesSlow) +// MANUAL_DRIVER_REGISTRATION(PoserDaveOrtho) +// MANUAL_DRIVER_REGISTRATION(PoserDummy) +// MANUAL_DRIVER_REGISTRATION(DriverRegHTCVive) +// +//#endif int r = 0; int i = 0; diff --git a/winbuild/calibrate/calibrate.vcxproj b/winbuild/calibrate/calibrate.vcxproj index f08b953..13fce78 100644 --- a/winbuild/calibrate/calibrate.vcxproj +++ b/winbuild/calibrate/calibrate.vcxproj @@ -88,7 +88,7 @@ Level3 Disabled - RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + USE_DOUBLE;RUNTIME_SYMNUMX;HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -104,7 +104,7 @@ Level3 Disabled - RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + USE_DOUBLE;RUNTIME_SYMNUMX;HIDAPI;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -112,7 +112,8 @@ setupapi.lib;dbghelp.lib;%(AdditionalDependencies) - LTRegisterDriverRegHTCVive;%(ForceSymbolReferences) + + @@ -123,7 +124,7 @@ MaxSpeed true true - RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + USE_DOUBLE;RUNTIME_SYMNUMX;HIDAPI;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -143,7 +144,7 @@ MaxSpeed true true - RUNTIME_SYMNUM;HIDAPI;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + USE_DOUBLE;RUNTIME_SYMNUMX;HIDAPI;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) diff --git a/winbuild/libsurvive/libsurvive.vcxproj b/winbuild/libsurvive/libsurvive.vcxproj index f104954..dc23907 100644 --- a/winbuild/libsurvive/libsurvive.vcxproj +++ b/winbuild/libsurvive/libsurvive.vcxproj @@ -77,7 +77,7 @@ Level3 Disabled - RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;_DEBUG;_LIB;%(PreprocessorDefinitions) + USE_DOUBLE;MANUAL_REGISTRATION;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;_DEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -90,7 +90,7 @@ Level3 Disabled - RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + USE_DOUBLE;MANUAL_REGISTRATION;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -105,7 +105,7 @@ MaxSpeed true true - RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + USE_DOUBLE;MANUAL_REGISTRATION;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -122,7 +122,7 @@ MaxSpeed true true - RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;NDEBUG;_LIB;%(PreprocessorDefinitions) + USE_DOUBLE;MANUAL_REGISTRATION;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;NDEBUG;_LIB;%(PreprocessorDefinitions) ..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories) @@ -139,6 +139,7 @@ + @@ -165,6 +166,7 @@ + diff --git a/winbuild/libsurvive/libsurvive.vcxproj.filters b/winbuild/libsurvive/libsurvive.vcxproj.filters index 761da6a..370ce14 100644 --- a/winbuild/libsurvive/libsurvive.vcxproj.filters +++ b/winbuild/libsurvive/libsurvive.vcxproj.filters @@ -81,6 +81,9 @@ Source Files + + Source Files + @@ -125,5 +128,8 @@ Header Files + + Header Files + \ No newline at end of file -- cgit v1.3.1