From 71899ef9faaae04d8a44362dcd4ee0dc63b30ad7 Mon Sep 17 00:00:00 2001 From: Simone Coco Date: Sat, 17 Sep 2022 20:16:25 +0200 Subject: [PATCH] Statically link on windows, copy resources folder in CI --- .github/workflows/build.yml | 4 ++-- external/imgui/CMakeLists.txt | 9 ++++++++- external/parallel-rdp/CMakeLists.txt | 9 ++++++++- src/CMakeLists.txt | 4 ++-- src/frontend/imgui/CMakeLists.txt | 10 +++++++++- src/n64/core/CMakeLists.txt | 2 +- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df9dc512..7930c4cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Collect artifacts run: | mkdir upload - cp build/natsukashii upload + cp -r build/{natsukashii,resources} upload - name: Upload artifacts uses: actions/upload-artifact@v2 with: @@ -50,7 +50,7 @@ jobs: - name: Collect artifacts run: | mkdir upload - cp build/natsukashii.exe upload + cp -r build/{natsukashii.exe,resources} upload - name: Upload artifacts uses: actions/upload-artifact@v2 with: diff --git a/external/imgui/CMakeLists.txt b/external/imgui/CMakeLists.txt index 1e0b5faa..3e11133a 100644 --- a/external/imgui/CMakeLists.txt +++ b/external/imgui/CMakeLists.txt @@ -17,5 +17,12 @@ add_library(imgui imgui/backends/imgui_impl_vulkan.h imgui/backends/imgui_impl_vulkan.cpp) +if(WIN32) + target_compile_options(imgui PUBLIC -mwindows) + set(LIBRARIES -static z stdc++ user32 gdi32 winmm Imm32 ole32 oleaut32 shell32 setupapi version uuid) +else() + set(LIBRARIES ) +endif() + target_include_directories(imgui PUBLIC ${SDL2_INCLUDE_DIRS} imgui imgui/backends) -target_link_libraries(imgui PUBLIC SDL2main SDL2) \ No newline at end of file +target_link_libraries(imgui PUBLIC SDL2main SDL2 ${LIBRARIES} ) \ No newline at end of file diff --git a/external/parallel-rdp/CMakeLists.txt b/external/parallel-rdp/CMakeLists.txt index 37ea87af..d48b2ded 100644 --- a/external/parallel-rdp/CMakeLists.txt +++ b/external/parallel-rdp/CMakeLists.txt @@ -74,7 +74,14 @@ target_include_directories(parallel-rdp PUBLIC . ) -target_link_libraries(parallel-rdp SDL2main SDL2) +if(WIN32) + target_compile_options(parallel-rdp PUBLIC -mwindows) + set(LIBRARIES -static z stdc++ user32 gdi32 winmm Imm32 ole32 oleaut32 shell32 setupapi version uuid) +else() + set(LIBRARIES ) +endif() + +target_link_libraries(parallel-rdp SDL2main SDL2 ${LIBRARIES}) if(WIN32) target_compile_definitions(parallel-rdp PUBLIC VK_USE_PLATFORM_WIN32_KHR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 88cd84f1..e5777927 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,7 @@ find_package(fmt REQUIRED) add_executable(natsukashii main.cpp) if (CMAKE_BUILD_TYPE MATCHES Debug) - set(OPTIMIZATIONS -g + set(OPTIMIZATIONS -g -O0 #-fsanitize=address -fsanitize=undefined ) #target_link_libraries(natsukashii PUBLIC -fsanitize=address -fsanitize=undefined) @@ -24,4 +24,4 @@ endif() target_link_libraries(natsukashii PUBLIC frontend n64 fmt) target_include_directories(natsukashii PUBLIC . ../external) -target_compile_options(natsukashii PUBLIC ${OPTIMIZATIONS} -Wpedantic -Wimplicit-fallthrough -Wextra -Wall) +target_compile_options(natsukashii PUBLIC ${OPTIMIZATIONS}) diff --git a/src/frontend/imgui/CMakeLists.txt b/src/frontend/imgui/CMakeLists.txt index 4f4b3c0d..09505835 100644 --- a/src/frontend/imgui/CMakeLists.txt +++ b/src/frontend/imgui/CMakeLists.txt @@ -26,4 +26,12 @@ target_include_directories(frontend-imgui PUBLIC ../../../external/parallel-rdp/parallel-rdp-standalone/vulkan ../../../external/parallel-rdp/parallel-rdp-standalone/util ../../../external/parallel-rdp/parallel-rdp-standalone/volk) -target_link_libraries(frontend-imgui PUBLIC SDL2main SDL2 imgui nfd fmt) \ No newline at end of file + +if(WIN32) + target_compile_options(frontend-imgui PUBLIC -mwindows) + set(LIBRARIES -static z stdc++ user32 gdi32 winmm Imm32 ole32 oleaut32 shell32 setupapi version uuid) +else() + set(LIBRARIES ) +endif() + +target_link_libraries(frontend-imgui PUBLIC SDL2main SDL2 ${LIBRARIES} imgui nfd fmt) \ No newline at end of file diff --git a/src/n64/core/CMakeLists.txt b/src/n64/core/CMakeLists.txt index bec6fca3..07dc5535 100644 --- a/src/n64/core/CMakeLists.txt +++ b/src/n64/core/CMakeLists.txt @@ -53,4 +53,4 @@ target_include_directories(core PUBLIC ../../../external/imgui/imgui/backends mmio) -target_link_libraries(core PUBLIC capstone SDL2main SDL2 fmt cpu parallel-rdp) +target_link_libraries(core PUBLIC capstone fmt cpu parallel-rdp)