diff --git a/CMakeLists.txt b/CMakeLists.txt index ea81b5b..7dfb4b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ if(WIN32) else() # Linux-specific targets add_subdirectory(linux) - # Protocol tests (Linux only - tests not needed on Windows) add_subdirectory(protocol/test) -endif() \ No newline at end of file +endif() diff --git a/README.md b/README.md index d4e14b9..48fa96b 100644 --- a/README.md +++ b/README.md @@ -174,12 +174,12 @@ The GUI provides live feedback on: ``` #### 🛠️ Building the ASIO Driver -3. Install [CMake](https://cmake.org/download/) and a supported compiler (e.g., Visual Studio). +3. Install [CMake](https://cmake.org/download/) and a supported compiler (e.g., Visual Studio or MinGW). 4. Open a terminal and run: ```powershell mkdir build cd build - cmake .. -G "Visual Studio 17 2022" # or your version + cmake .. -G "Visual Studio 17 2022" # or "MingGW Makefiles" cmake --build . --config Release ``` 5. The ASIO driver DLL will be in `build/windows/asio/PWARASIO.dll`. diff --git a/windows/asio/CMakeLists.txt b/windows/asio/CMakeLists.txt index 8a476bc..73f5923 100644 --- a/windows/asio/CMakeLists.txt +++ b/windows/asio/CMakeLists.txt @@ -21,8 +21,25 @@ add_library(PWARASIO SHARED ${PWARASIO_SOURCES}) # Set output name to PWARASIO.dll set_target_properties(PWARASIO PROPERTIES OUTPUT_NAME "PWARASIO") -# Add the .def file for proper symbol exports -set_target_properties(PWARASIO PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/pwarASIO.def") +if (MSVC) + # # Add the .def file for proper symbol exports + set_target_properties(PWARASIO PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/pwarASIO.def") +else() + set_target_properties(PWARASIO PROPERTIES + PREFIX "" + OUTPUT_NAME "pwarASIO" + WINDOWS_EXPORT_ALL_SYMBOLS FALSE + ) + + # explicit exports + set_property(TARGET PWARASIO PROPERTY + LINK_FLAGS "-Wl,--export-all-symbols -Wl,--add-stdcall-alias" + ) + + target_sources(PWARASIO PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/pwarASIO.rc) + + target_link_libraries(PWARASIO PRIVATE ws2_32 avrt) +endif() target_include_directories(PWARASIO PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} @@ -33,8 +50,3 @@ target_compile_definitions(PWARASIO PRIVATE WIN32 _WINDOWS _CRT_SECURE_NO_DEPREC target_link_libraries(PWARASIO PRIVATE odbc32 odbccp32 winmm) -add_custom_command(TARGET PWARASIO POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - $ - Z:/music_production/PWAR/ -) diff --git a/windows/asio/pwarASIO.cpp b/windows/asio/pwarASIO.cpp index 0ff6488..56cef54 100644 --- a/windows/asio/pwarASIO.cpp +++ b/windows/asio/pwarASIO.cpp @@ -57,7 +57,7 @@ STDMETHODIMP pwarASIO::NonDelegatingQueryInterface(REFIID riid, void** ppv) { extern LONG RegisterAsioDriver(CLSID, char*, char*, char*, char*); extern LONG UnregisterAsioDriver(CLSID, char*, char*); -HRESULT _stdcall DllRegisterServer() { +extern "C" __declspec(dllexport) HRESULT _stdcall DllRegisterServer() { LONG rc = RegisterAsioDriver(IID_ASIO_DRIVER, "PWARASIO.dll", "PWAR ASIO Driver", "PWAR ASIO", "Apartment"); if (rc) { char errstr[128] = {0}; @@ -68,7 +68,7 @@ HRESULT _stdcall DllRegisterServer() { return S_OK; } -HRESULT _stdcall DllUnregisterServer() { +extern "C" __declspec(dllexport) HRESULT _stdcall DllUnregisterServer() { LONG rc = UnregisterAsioDriver(IID_ASIO_DRIVER, "PWARASIO.dll", "PWAR ASIO Driver"); if (rc) { char errstr[128] = {0}; @@ -77,7 +77,7 @@ HRESULT _stdcall DllUnregisterServer() { return -1; } return S_OK; -} +} pwarASIO::pwarASIO(LPUNKNOWN pUnk, HRESULT* phr) : CUnknown("PWARASIO", pUnk, phr), diff --git a/windows/asio/pwarASIO.rc b/windows/asio/pwarASIO.rc new file mode 100755 index 0000000..93386d5 --- /dev/null +++ b/windows/asio/pwarASIO.rc @@ -0,0 +1,12 @@ +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "FileDescription", "PipeWire ASIO Relay\0" + END + END +END