Merge pull request #675 from jroweboy/windows-build-fixes

Windows build fixes
This commit is contained in:
Yuri Kunde Schlesner 2015-05-14 20:55:58 -07:00
commit a188e0fa57
3 changed files with 52 additions and 19 deletions

View file

@ -15,25 +15,32 @@ else()
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo CACHE STRING "" FORCE)
# Tweak optimization settings
# As far as I can tell, there's no way to override the CMake defaults while leaving user
# changes intact, so we'll just clobber everything and say sorry.
message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.")
# /MP - Multi-threaded compilation
# /MD - Multi-threaded runtime
# /Ox - Full optimization
# /O2 - Optimization level 2
# /Oy- - Don't omit frame pointer
# /GR- - Disable RTTI
# /GS- - No stack buffer overflow checks
# /EHsc - C++-only exception handling semantics
set(optimization_flags "/MP /MD /Ox /Oy- /GR- /GS- /EHsc")
set(optimization_flags "/O2 /Oy- /GR- /GS- /EHsc")
# /MP - Multi-threaded compilation
# /Zi - Output debugging information
# /Zo - enahnced debug info for optimized builds
set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${optimization_flags} /Zi /Zo" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${optimization_flags} /Zi /Zo" CACHE STRING "" FORCE)
# /MDd - Multi-threaded Debug Runtime DLL
set(CMAKE_C_FLAGS_DEBUG "/MP /MDd /Zi" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "/MP /MDd /Zi" CACHE STRING "" FORCE)
# /MD - Multi-threaded runtime DLL
set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /MP /MD" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${optimization_flags} /MP /MD" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${optimization_flags} /MP /MD /Zi /Zo" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${optimization_flags} /MP /MD /Zi /Zo" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG" CACHE STRING "" FORCE)
endif()
add_definitions(-DSINGLETHREADED)

View file

@ -25,17 +25,7 @@ before_build:
- cd ..
after_build:
# copy the qt dlls
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\icudt53.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\icuin53.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\icuuc53.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\Qt5Core.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\Qt5Gui.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\Qt5OpenGL.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_64_opengl\bin\Qt5Widgets.dll build\bin\release
- mkdir build\bin\release\platforms\
- copy C:\Qt\5.4\msvc2013_64_opengl\plugins\platforms\qwindows.dll build\bin\release\platforms
# copying the needed QT Dlls is now done post build. See the CMakeLists.txt file in the citra-qt folder
- ps: >
if (!"$env:APPVEYOR_PULL_REQUEST_TITLE" -and ("$env:APPVEYOR_REPO_BRANCH" -eq "master"))
{

View file

@ -74,3 +74,39 @@ target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})
if (Qt5_FOUND AND MSVC)
set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin")
set(Qt5_PLATFORMS_DIR "${Qt5_DIR}/../../../plugins/platforms/")
set(Qt5_DLLS
icudt*.dll
icuin*.dll
icuuc*.dll
Qt5Core$<$<CONFIG:Debug>:d>.*
Qt5Gui$<$<CONFIG:Debug>:d>.*
Qt5OpenGL$<$<CONFIG:Debug>:d>.*
Qt5Widgets$<$<CONFIG:Debug>:d>.*
)
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
set(PLATFORMS ${DLL_DEST}platforms/)
# windows commandline expects the / to be \ so switch them
string(REPLACE "/" "\\" Qt5_DLL_DIR ${Qt5_DLL_DIR})
string(REPLACE "/" "\\" Qt5_PLATFORMS_DIR ${Qt5_PLATFORMS_DIR})
string(REPLACE "/" "\\" DLL_DEST ${DLL_DEST})
string(REPLACE "/" "\\" PLATFORMS ${PLATFORMS})
# /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
# cmake adds an extra check for command success which doesn't work too well with robocopy
# so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
add_custom_command(TARGET citra-qt POST_BUILD
COMMAND robocopy ${Qt5_DLL_DIR} ${DLL_DEST} ${Qt5_DLLS} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
COMMAND if not exist ${PLATFORMS} mkdir ${PLATFORMS} 2> nul
COMMAND robocopy ${Qt5_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.* /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
)
unset(Qt5_DLLS)
unset(Qt5_DLL_DIR)
unset(Qt5_PLATFORMS_DIR)
unset(DLL_DEST)
unset(PLATFORMS)
endif()