Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan.Pakulski authored and Bryan.Pakulski committed Nov 2, 2023
1 parent 15ad75c commit 0945e08
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ else()
set(CMAKE_CXX_FLAGS "/Wall")
set(CMAKE_CXX_FLAGS_DEBUG "/Z7")
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
include(C:/vcpkg/scripts/buildsystems/vcpkg.cmake)
endif()


Expand Down
2 changes: 1 addition & 1 deletion scripts/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo "Building ThirdParty libs..."
call .\src\ThirdParty\XMP\build_xmp_libraries.bat > build\XMP_build.log

pushd build
cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE=%vcpkg_location%/scripts/buildsystems/vcpkg.cmake > build.log
cmake -B . -S .. > build.log

if "%1"=="-r" (
cmake --build . --config Release >> build.log
Expand Down
11 changes: 10 additions & 1 deletion src/Helpers/QLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#ifdef _WIN32
#define stat _stat
#define NOMINMAX
#include <Windows.h>
#include <processthreadsapi.h>
#endif

enum class LOGLEVEL { DBG1, DBG2, DBG3, DBG4, TRACE, INFO, WARN, ERR };
Expand All @@ -40,7 +43,13 @@ class QLogger {
* Construct the log as a string and push to the logging queue
*/
template <typename T, typename... Args> void Log(LOGLEVEL logLevel, T message, Args... args) {
unsigned long thread_id = pthread_self();

#ifdef _WIN32
unsigned long thread_id = GetCurrentThreadId();
#else
unsigned long thread_id = pthread_self();
#endif


std::thread([this, thread_id, logLevel, message, args...]() {
std::ostringstream log_buffer;
Expand Down
11 changes: 6 additions & 5 deletions src/ThirdParty/XMP/build_xmp_libraries.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ if not exist "XMP-Toolkit-SDK\" (
:: Setup zlib
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.zlib.net/current/zlib.tar.gz', 'zlib.tar.gz')"
:: Extract and copy .c and .h files
tar -xzvf zlib.tar.gz
move zlib.tar.gz\*.c XMP-Toolkit-SDK\third-party\zlib
move zlib.tar.gz\*.h XMP-Toolkit-SDK\third-party\zlib
del zlib.tar.gz.tar.gz
rmdir zlib* /s /q
mkdir zlib
tar -xzvf zlib.tar.gz -C zlib --strip-components=1
move zlib\*.c XMP-Toolkit-SDK\third-party\zlib
move zlib\*.h XMP-Toolkit-SDK\third-party\zlib
del zlib.tar.gz
rmdir zlib /s /q

:: Set up libexpat
git clone https://github.com/libexpat/libexpat
Expand Down

0 comments on commit 0945e08

Please sign in to comment.