Просмотр исходного кода

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

Windows build fixes
Yuri Kunde Schlesner 11 лет назад
Родитель
Сommit
a188e0fa57
3 измененных файлов с 52 добавлено и 19 удалено
  1. 15 8
      CMakeLists.txt
  2. 1 11
      appveyor.yml
  3. 36 0
      src/citra_qt/CMakeLists.txt

+ 15 - 8
CMakeLists.txt

@@ -15,25 +15,32 @@ else()
 
 
     # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
     # 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_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+    set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo CACHE STRING "" FORCE)
 
 
     # Tweak optimization settings
     # Tweak optimization settings
     # As far as I can tell, there's no way to override the CMake defaults while leaving user
     # 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.
     # 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.")
     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
     # /Oy- - Don't omit frame pointer
     # /GR- - Disable RTTI
     # /GR- - Disable RTTI
     # /GS- - No stack buffer overflow checks
     # /GS- - No stack buffer overflow checks
     # /EHsc - C++-only exception handling semantics
     # /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
     # /Zi - Output debugging information
     # /Zo - enahnced debug info for optimized builds
     # /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()
 endif()
 
 
 add_definitions(-DSINGLETHREADED)
 add_definitions(-DSINGLETHREADED)

+ 1 - 11
appveyor.yml

@@ -25,17 +25,7 @@ before_build:
   - cd ..
   - cd ..
 
 
 after_build:
 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: >
   - ps: >
         if (!"$env:APPVEYOR_PULL_REQUEST_TITLE" -and ("$env:APPVEYOR_REPO_BRANCH" -eq "master"))
         if (!"$env:APPVEYOR_PULL_REQUEST_TITLE" -and ("$env:APPVEYOR_REPO_BRANCH" -eq "master"))
           {
           {

+ 36 - 0
src/citra_qt/CMakeLists.txt

@@ -74,3 +74,39 @@ target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
 target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
 target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
 
 
 #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})
 #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()