summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-03 09:46:29 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-03 09:46:29 +0200
commit6c23e1ad43f143ee8b694b907432c5801713a7d5 (patch)
treeca9199e86c47211114c4063a04fc4e1063a74432
parent340906d3571ba3c75e67d8457de4129381d5a6b3 (diff)
fix MSVC, now runs
-rw-r--r--CMakeLists.txt61
-rw-r--r--facetracknoir/main.cpp10
-rw-r--r--ftnoir_protocol_sc/ftnoir-protocol-sc.rc4
-rw-r--r--ftnoir_protocol_sc/scserver_acceleration.manifest (renamed from ftnoir_protocol_sc/scserver-acceleration.manifest)0
-rw-r--r--ftnoir_protocol_sc/scserver_sp2.manifest (renamed from ftnoir_protocol_sc/scserver-sp2.manifest)26
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h7
-rw-r--r--opentrack/version.C5
-rw-r--r--opentrack/version.cc9
8 files changed, 89 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4389432d..c45163dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,7 @@ set(my-qt-deps)
if(WIN32) # hack to avoid breakage on buildbot
set(my-qt-deps ws2_32)
endif()
-set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps})
+set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${my-qt-deps})
# note, hatire supports both ftnoir and opentrack
# don't remove without being sure as hell -sh 20140922
@@ -69,6 +69,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR APPLE)
set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ")
endif()
+set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
+
# qt broken as usual
set(EXTRA-MOCS opentrack/options.hpp)
@@ -85,10 +87,17 @@ endmacro()
macro(opentrack_qt n)
qt5_wrap_cpp(${n}-moc ${${n}-c} OPTIONS --no-notes)
QT5_WRAP_UI(${n}-uih ${${n}-ui})
- QT5_ADD_RESOURCES(${n}-rcc)
+ QT5_ADD_RESOURCES(${n}-rcc ${${n}-rc})
set(${n}-all ${${n}-c} ${${n}-rc} ${${n}-rcc} ${${n}-uih} ${${n}-moc} ${${n}-res})
endmacro()
+set(msvc-subsystem "/VERSION:5.1 /SUBSYSTEM:WINDOWS,5.01")
+function(opentrack_compat target)
+ if(MSVC)
+ set_target_properties(${target} PROPERTIES LINK_FLAGS "${msvc-subsystem} /DEBUG /OPT:ICF")
+ endif()
+endfunction()
+
macro(opentrack_library n dir)
cmake_parse_arguments(foolib "" "LINK;COMPILE;GNU-LINK;GNU-COMPILE" "" ${ARGN})
if(NOT " ${foolib_UNPARSED_ARGUMENTS}" STREQUAL " ")
@@ -104,7 +113,11 @@ macro(opentrack_library n dir)
COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden"
)
else()
- set_target_properties(${n} PROPERTIES LINK_FLAGS "${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}")
+ set(link-flags)
+ if(MSVC)
+ set(link-flags "${msvc-subsystem} /DEBUG /OPT:ICF")
+ endif()
+ set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}")
endif()
install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .)
endmacro()
@@ -171,6 +184,7 @@ add_custom_target(tarball DEPENDS ${filename})
opentrack_module(opentrack-api opentrack)
opentrack_qt(opentrack-api)
add_library(opentrack-api STATIC ${opentrack-api-all})
+opentrack_compat(opentrack-api)
target_link_libraries(opentrack-api ${MY_QT_LIBS})
if(NOT WIN32)
@@ -221,31 +235,36 @@ if(SDK_XPLANE)
endif()
add_library(opentrack-compat STATIC ${opentrack-compat-c})
+opentrack_compat(opentrack-compat) # uh...
if(NOT WIN32 AND NOT APPLE)
target_link_libraries(opentrack-compat rt)
endif()
opentrack_module(opentrack-csv csv)
add_library(opentrack-csv STATIC ${opentrack-csv-c})
+opentrack_compat(opentrack-csv)
target_link_libraries(opentrack-csv ${MY_QT_LIBS})
opentrack_module(opentrack-pose-widget pose-widget)
opentrack_qt(opentrack-pose-widget)
add_library(opentrack-pose-widget STATIC ${opentrack-pose-widget-all})
+opentrack_compat(opentrack-pose-widget)
target_include_directories(opentrack-pose-widget PUBLIC pose-widget/) # else Qt moc breaks
target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS})
opentrack_module(opentrack-spline-widget qfunctionconfigurator)
opentrack_qt(opentrack-spline-widget)
add_library(opentrack-spline-widget STATIC ${opentrack-spline-widget-all})
+opentrack_compat(opentrack-spline-widget)
target_include_directories(opentrack-spline-widget PUBLIC qfunctionconfigurator/)
target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS})
-add_library(opentrack-version STATIC opentrack/version.C)
+add_library(opentrack-version STATIC opentrack/version.cc)
+opentrack_compat(opentrack-version)
set_target_properties(opentrack-version PROPERTIES
COMPILE_DEFINITIONS
- "IN_VERSION_UNIT;OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"")
+ "OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"")
opentrack_library(opentrack-filter-accela ftnoir_filter_accela)
target_link_libraries(opentrack-filter-accela opentrack-spline-widget)
@@ -256,7 +275,12 @@ opentrack_library(opentrack-proto-fgfs ftnoir_protocol_fg)
if(SDK_VJOY)
opentrack_library(opentrack-proto-vjoy ftnoir_protocol_vjoy GNU-LINK "-Wl,--enable-stdcall-fixup")
- target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} ${SDK_VJOY}/VJoy.dll)
+ if(MSVC)
+ set(ext .lib)
+ else()
+ set(ext .dll)
+ endif()
+ target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} ${SDK_VJOY}/VJoy${ext})
target_include_directories(opentrack-proto-vjoy SYSTEM PUBLIC ${SDK_VJOY})
endif()
@@ -272,6 +296,9 @@ if(SDK_FSUIPC)
opentrack_library(opentrack-proto-fsuipc ftnoir_protocol_fsuipc)
target_link_libraries(opentrack-proto-fsuipc ${SDK_FSUIPC}/FSUIPC_User.lib)
target_include_directories(opentrack-proto-fsuipc SYSTEM PUBLIC ${SDK_FSUIPC})
+ if(MSVC)
+ set_target_properties(opentrack-proto-fsuipc PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBC.lib")
+ endif()
#target_link_directories(${SDK_FSUIPC})
endif()
@@ -362,7 +389,14 @@ if(SDK_RIFT)
opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK ${link-flags} COMPILE ${c-flags})
target_include_directories(opentrack-tracker-rift SYSTEM PUBLIC ${SDK_RIFT}/Include ${SDK_RIFT}/Src)
if(WIN32)
- target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a winmm setupapi ws2_32 imagehlp wbemuuid)
+ if(MSVC)
+ set(ext lib)
+ set(p)
+ else()
+ set(ext a)
+ set(p lib)
+ endif()
+ target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/${p}LibOVR.${ext} winmm setupapi ws2_32 imagehlp wbemuuid)
else()
if(NOT APPLE)
target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a udev Xinerama)
@@ -376,9 +410,16 @@ if(SDK_HYDRA)
opentrack_library(opentrack-tracker-hydra ftnoir_tracker_hydra)
target_include_directories(opentrack-tracker-hydra SYSTEM PUBLIC ${SDK_HYDRA}/include ${SDK_HYDRA}/include/sixense_utils)
if(WIN32)
+ if(MSVC)
+ set(dir lib)
+ set(ext lib)
+ else()
+ set(dir bin)
+ set(ext dll)
+ endif()
target_link_libraries(opentrack-tracker-hydra
- "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll"
- #"${SDK_HYDRA}/bin/win32/release_dll/sixense_utils.dll"
+ "${SDK_HYDRA}/${dir}/win32/release_dll/sixense.${ext}"
+ #"${SDK_HYDRA}/${dir}/win32/release_dll/sixense_utils.${ext}"
)
install(FILES "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll"
#"${SDK_HYDRA}/bin/win32/release_dll/sixense_utils.dll"
@@ -439,7 +480,7 @@ if(UNIX OR APPLE)
endif()
opentrack_qt(opentrack)
add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all})
-
+opentrack_compat(opentrack)
if(NOT WIN32)
set_target_properties(opentrack PROPERTIES SUFFIX ".bin")
endif()
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index 2e08c8ba..6d29e3b5 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -77,13 +77,17 @@ int main(int argc, char** argv)
if (use_profile)
MainWindow::set_profile(profile);
- MainWindow w;
+ auto w = std::make_shared<MainWindow>();
if (use_profile)
- w.startTracker();
+ w->startTracker();
- w.show();
+ w->show();
app.exec();
+ // on MSVC crashes in atexit
+#ifdef _MSC_VER
+ TerminateProcess(GetCurrentProcess(), 0);
+#endif
return 0;
}
diff --git a/ftnoir_protocol_sc/ftnoir-protocol-sc.rc b/ftnoir_protocol_sc/ftnoir-protocol-sc.rc
index 80b6c12c..c89eb9a7 100644
--- a/ftnoir_protocol_sc/ftnoir-protocol-sc.rc
+++ b/ftnoir_protocol_sc/ftnoir-protocol-sc.rc
@@ -1,4 +1,4 @@
#include <winuser.h>
142 RT_MANIFEST scserver.manifest
-143 RT_MANIFEST scserver-sp2.manifest
-144 RT_MANIFEST scserver-acceleration.manifest \ No newline at end of file
+143 RT_MANIFEST scserver_sp2.manifest
+144 RT_MANIFEST scserver_acceleration.manifest \ No newline at end of file
diff --git a/ftnoir_protocol_sc/scserver-acceleration.manifest b/ftnoir_protocol_sc/scserver_acceleration.manifest
index 06459587..06459587 100644
--- a/ftnoir_protocol_sc/scserver-acceleration.manifest
+++ b/ftnoir_protocol_sc/scserver_acceleration.manifest
diff --git a/ftnoir_protocol_sc/scserver-sp2.manifest b/ftnoir_protocol_sc/scserver_sp2.manifest
index 19b123ba..3020d16c 100644
--- a/ftnoir_protocol_sc/scserver-sp2.manifest
+++ b/ftnoir_protocol_sc/scserver_sp2.manifest
@@ -1,13 +1,13 @@
-<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
-<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect ' version='10.0.60905.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' />
- </dependentAssembly>
- </dependency>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
- </dependentAssembly>
- </dependency>
-</assembly>
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect ' version='10.0.60905.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' />
+ </dependentAssembly>
+ </dependency>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
+ </dependentAssembly>
+ </dependency>
+</assembly>
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
index 73496fba..a9e8ed6e 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
@@ -96,6 +96,13 @@ typedef struct _JOYSTICK_STATE
UINT32 Buttons; // 32 Buttons
} JOYSTICK_STATE, * PJOYSTICK_STATE;
+#ifndef _MSC_VER
EXTERN_C BOOL __stdcall VJoy_Initialize(PCHAR name, PCHAR serial);
EXTERN_C VOID __stdcall VJoy_Shutdown();
EXTERN_C BOOL __stdcall VJoy_UpdateJoyState(int id, PJOYSTICK_STATE pJoyState);
+#else
+#define VJOY_API __declspec(dllimport)
+VJOY_API BOOL __stdcall VJoy_Initialize(PCHAR name, PCHAR serial);
+VJOY_API VOID __stdcall VJoy_Shutdown();
+VJOY_API BOOL __stdcall VJoy_UpdateJoyState(int id, PJOYSTICK_STATE pJoyState);
+#endif
diff --git a/opentrack/version.C b/opentrack/version.C
deleted file mode 100644
index 0ef4ec14..00000000
--- a/opentrack/version.C
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifdef IN_VERSION_UNIT
-# define IN_CRAPOLA_COMPILE_UNIT
-volatile const char* opentrack_version = OPENTRACK_VERSION;
-#else
-#endif
diff --git a/opentrack/version.cc b/opentrack/version.cc
new file mode 100644
index 00000000..026ad057
--- /dev/null
+++ b/opentrack/version.cc
@@ -0,0 +1,9 @@
+#include "opentrack/export.hpp"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+OPENTRACK_EXPORT
+volatile const char* opentrack_version;
+
+volatile const char* opentrack_version = OPENTRACK_VERSION;