Skip to content

Commit

Permalink
Windows: fix cmake-based build problems & optimization of release build
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybernstein committed Feb 19, 2022
1 parent f03fc26 commit df9c524
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ if (APPLE)
endif ()

if (WIN32)
add_definitions(-DUNICODE)
add_definitions(-DUNICODE -D_UNICODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(LIBS user32.lib)
endif ()


Expand Down
17 changes: 10 additions & 7 deletions reaper_automidireset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "reaper_plugin_functions.h"
#include <cstdio>

#define VERSION_STRING "1.2-beta.2"
#define VERSION_STRING "1.2-beta.3"

static int commandId = 0;

Expand Down Expand Up @@ -343,13 +343,16 @@ DWORD WINAPI window_thread(LPVOID params)
wndClass.hInstance = (HINSTANCE) GetModuleHandle(NULL);

if (params == kMidiDeviceType) {
wndClass.lpfnWndProc = (WNDPROC) midi_hardware_status_callback;
wndClass.lpfnWndProc = (WNDPROC)midi_hardware_status_callback;
wndClass.lpszClassName = WND_CLASS_MIDI_NAME;
assert(RegisterClassEx(&wndClass) && "error registering dummy window");
hDummyWindow = CreateWindow(WND_CLASS_MIDI_NAME, L"midi window", WS_ICONIC,
0, 0, CW_USEDEFAULT, 0, NULL, NULL, wndClass.hInstance, NULL);
assert((hDummyWindow != NULL) && "failed to create window");
ShowWindow(hDummyWindow, SW_HIDE);
ATOM registered = RegisterClassEx(&wndClass);
if (registered) {
hDummyWindow = CreateWindow(WND_CLASS_MIDI_NAME, L"midi window", WS_ICONIC,
0, 0, CW_USEDEFAULT, 0, NULL, NULL, wndClass.hInstance, NULL);
if (hDummyWindow) {
ShowWindow(hDummyWindow, SW_HIDE);
}
}
}

PostMessage(hDummyWindow, WM_MIDI_INIT, 0, 0); // call initLists();
Expand Down

0 comments on commit df9c524

Please sign in to comment.