From 7c4b6dd4188dfafd9269ff4db885d00cb6d45a8e Mon Sep 17 00:00:00 2001 From: Anthony Rabine Date: Sun, 24 Dec 2023 14:41:14 +0100 Subject: [PATCH] fix windows build, changed github actions to remove Qt steps --- .../workflows/build_story_editor_windows.yml | 20 +------------------ story-editor/CMakeLists.txt | 19 +++++++++--------- story-editor/src/main_window.cpp | 3 ++- story-editor/src/resources_window.cpp | 2 +- 4 files changed, 13 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build_story_editor_windows.yml b/.github/workflows/build_story_editor_windows.yml index dc6099a..fd9a2fc 100644 --- a/.github/workflows/build_story_editor_windows.yml +++ b/.github/workflows/build_story_editor_windows.yml @@ -5,9 +5,6 @@ on: push: branches: - main -env: - QT_VERSION: 6.5.1 - jobs: build_win: runs-on: windows-latest @@ -15,36 +12,21 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - uses: ilammy/msvc-dev-cmd@v1 - - uses: actions/setup-python@v2 - with: - python-version: '3.8' - name: install_deps run : | choco install wget -y choco install nsis -y choco install ninja -y - choco install cmake -y - pip install aqtinstall - - name: install_qt - run : | - python3 -m aqt install-qt -m qtmultimedia -O ${{ github.workspace }}/Qt/ windows desktop ${{ env.QT_VERSION }} win64_msvc2019_64 - echo "${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/msvc2019_64/bin/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: build working-directory: ./story-editor run : | mkdir build cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ github.workspace }}\Qt\${{ env.QT_VERSION }}\msvc2019_64 -DQT_DIR=${{ github.workspace }}\Qt\6.5.1\msvc2019_64\lib\cmake\Qt6 -G Ninja .. + cmake -DCMAKE_BUILD_TYPE=Release -G Ninja .. ninja ls mkdir story-editor cp story-editor.exe story-editor - windeployqt story-editor/story-editor.exe --release - copy C:\Windows\System32\vccorlib140.dll story-editor\ - copy C:\Windows\System32\msvcp140.dll story-editor\ - copy C:\Windows\System32\vcruntime140.dll story-editor\ - ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/msvc2019_64/bin/windeployqt.exe --release --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler story-editor\story-editor.exe - name: package_setup working-directory: ./story-editor run : | diff --git a/story-editor/CMakeLists.txt b/story-editor/CMakeLists.txt index a42339d..f073ba3 100644 --- a/story-editor/CMakeLists.txt +++ b/story-editor/CMakeLists.txt @@ -12,11 +12,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # set(CMAKE_VERBOSE_MAKEFILE on) -if (MSVC) - add_compile_options("/FS") -endif (MSVC) - - if(POLICY CMP0072) cmake_policy(SET CMP0072 NEW) endif() @@ -167,7 +162,7 @@ set(SRCS if(WIN32) list(APPEND SRCS - manolab/icon.rc + icon.rc ) endif() @@ -207,13 +202,17 @@ target_link_libraries(${STORY_EDITOR_PROJECT} SDL2 ) elseif(WIN32) + +target_compile_features("-Wl,-subsystem,windows") + target_link_libraries(${STORY_EDITOR_PROJECT} - icl OpenGL::GL +# SDL2::SDL2main + SDL2::SDL2-static ws2_32.lib psapi.lib setupapi.lib cfgmgr32.lib advapi32.lib Dbghelp.lib ) -set_target_properties(${STORY_EDITOR_PROJECT} PROPERTIES -LINK_FLAGS /SUBSYSTEM:CONSOLE -) +#set_target_properties(${STORY_EDITOR_PROJECT} PROPERTIES +#LINK_FLAGS /SUBSYSTEM:CONSOLE +#) endif() diff --git a/story-editor/src/main_window.cpp b/story-editor/src/main_window.cpp index b193011..ab3eba3 100644 --- a/story-editor/src/main_window.cpp +++ b/story-editor/src/main_window.cpp @@ -426,7 +426,8 @@ void MainWindow::NewProjectPopup() if (valid) { - m_project.Initialize(std::filesystem::path(projdir) / "project.json"); + auto p = std::filesystem::path(projdir) / std::filesystem::path("project.json"); + m_project.Initialize(p.generic_string()); if (display_item_current_idx == 0) { diff --git a/story-editor/src/resources_window.cpp b/story-editor/src/resources_window.cpp index 20ff73e..bfe7ce8 100644 --- a/story-editor/src/resources_window.cpp +++ b/story-editor/src/resources_window.cpp @@ -44,7 +44,7 @@ void ResourcesWindow::ChooseFile() std::filesystem::path p(filePathName); - std::filesystem::path p2 = m_project.BuildFullAssetsPath( p.filename()); + std::filesystem::path p2 = m_project.BuildFullAssetsPath( p.filename().generic_string()); std::filesystem::copy(p, p2, std::filesystem::copy_options::overwrite_existing); auto res = std::make_shared();