修正无法在win平台构建助手的问题。

dev
Apex Liu 2021-03-08 01:13:00 +08:00
parent 47c2fdcff4
commit 9abde183f9
6 changed files with 22 additions and 3 deletions

View File

@ -320,11 +320,12 @@ def qt_build(prj_path, prj_name, bit_path, target_path):
if env.is_win: if env.is_win:
tmp_path = os.path.join(env.root_path, 'out', '_tmp_', prj_name, bit_path) tmp_path = os.path.join(env.root_path, 'out', '_tmp_', prj_name, bit_path)
makedirs(tmp_path)
# C:\Windows\System32\cmd.exe /A /Q /K C:\Qt\Qt5.12.0\5.12.0\msvc2017\bin\qtenv2.bat # C:\Windows\System32\cmd.exe /A /Q /K C:\Qt\Qt5.12.0\5.12.0\msvc2017\bin\qtenv2.bat
cmd = 'C:\\Windows\\System32\\cmd.exe /A /Q /C ""{}\\qt-helper.bat" "{}\\bin\\qtenv2.bat" "{}VC\\Auxiliary\\Build\\vcvarsall.bat" {} "{}" "{}" {}"'.format(env.build_path, env.qt, env.visual_studio_path, bit_path, tmp_path, prj_path, target_path) cmd = 'C:\\Windows\\System32\\cmd.exe /A /Q /C ""{}\\qt-helper.bat" "{}\\bin\\qtenv2.bat" "{}VC\\Auxiliary\\Build\\vcvarsall.bat" {} "{}" "{}" {}"'.format(env.build_path, env.qt, env.visual_studio_path, bit_path, tmp_path, prj_path, target_path)
ret, _ = sys_exec(cmd) ret, _ = sys_exec(cmd)
if ret != 0: if ret != 0:
raise RuntimeError('build XCode project `{}` failed.'.format(prj_name)) raise RuntimeError('build Qt project `{}` failed.'.format(prj_name))
elif env.is_macos: elif env.is_macos:
qmake = os.path.join(env.qt, 'qmake') qmake = os.path.join(env.qt, 'qmake')
pro_file = prj_name + '.pro' pro_file = prj_name + '.pro'

View File

@ -16,6 +16,6 @@ echo %target%
call %qtenv% call %qtenv%
call %vcvarsall% %bits% call %vcvarsall% %bits%
cd %tmp_path% cd /D %tmp_path%
qmake %prj_path% qmake %prj_path%
nmake %target% nmake %target%

View File

@ -147,17 +147,25 @@ public:
~ExEvent() ~ExEvent()
{ {
#ifdef EX_OS_WIN32
#else
pthread_mutex_destroy(&m_mutex); pthread_mutex_destroy(&m_mutex);
pthread_cond_destroy(&m_cond); pthread_cond_destroy(&m_cond);
#endif
} }
void wait() void wait()
{ {
#ifdef EX_OS_WIN32
#else
pthread_cond_wait(&m_cond, &m_mutex); pthread_cond_wait(&m_cond, &m_mutex);
#endif
} }
void wait_timeout_ms(int timeout_ms) void wait_timeout_ms(int timeout_ms)
{ {
#ifdef EX_OS_WIN32
#else
// timeval.tv_usec ==== ms // timeval.tv_usec ==== ms
// timespec.tv_nsec === nano-second // timespec.tv_nsec === nano-second
struct timeval now = { 0 }; struct timeval now = { 0 };
@ -169,11 +177,15 @@ public:
out_time.tv_nsec = (long)((abs_time_ms % 1000ll) * 1000ll); out_time.tv_nsec = (long)((abs_time_ms % 1000ll) * 1000ll);
pthread_cond_timedwait(&m_cond, &m_mutex, &out_time); pthread_cond_timedwait(&m_cond, &m_mutex, &out_time);
#endif
} }
void signal() void signal()
{ {
#ifdef EX_OS_WIN32
#else
pthread_cond_signal(&m_cond); pthread_cond_signal(&m_cond);
#endif
} }
private: private:

View File

@ -501,6 +501,7 @@ bool ExLogger::write_a(const char* buf) {
return false; return false;
#ifdef EX_OS_WIN32 #ifdef EX_OS_WIN32
DWORD dwWritten = 0;
WriteFile(m_file, buf, len, &dwWritten, nullptr); WriteFile(m_file, buf, len, &dwWritten, nullptr);
m_filesize += len; m_filesize += len;
FlushFileBuffers(m_file); FlushFileBuffers(m_file);

View File

@ -22,7 +22,12 @@ void *ExThreadBase::_thread_func(void *pParam)
_this->_on_stopped(); _this->_on_stopped();
EXLOGV("[thread] - `%s` exit.\n", _this->m_thread_name.c_str()); EXLOGV("[thread] - `%s` exit.\n", _this->m_thread_name.c_str());
#ifdef EX_OS_WIN32
return 0;
#else
return nullptr; return nullptr;
#endif
} }
ExThreadBase::ExThreadBase(const char *thread_name) : ExThreadBase::ExThreadBase(const char *thread_name) :

View File

@ -139,7 +139,7 @@ elif [ ${SYS_NAME} = "Darw" ] ; then
export CFG_FILE=config.macos.json export CFG_FILE=config.macos.json
build_macos $@ build_macos $@
elif [ ${SYS_NAME} == "MSYS" ] ; then elif [ ${SYS_NAME} == "MSYS" ] ; then
export CFG_FILE=config.win.json export CFG_FILE=config.windows.json
build_win $@ build_win $@
else else
on_error_begin "Unsupported platform." on_error_begin "Unsupported platform."