diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 08d4522ff..aa0368735 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -84,7 +84,7 @@ jobs: - uses: actions/upload-artifact@v2 with: name: '86Box-${{ matrix.build.name }}-MSYS2-${{ matrix.environment.msystem }}-${{ github.sha }}' - path: build/artifacts/bin/** + path: build/artifacts/** vs2019: name: VS2019 ${{ matrix.build.name }} ${{ matrix.target-arch }} build (${{ matrix.toolset }}) @@ -130,7 +130,7 @@ jobs: - uses: actions/upload-artifact@v2 with: name: '86Box-${{ matrix.build.name }}-VS2019-${{ matrix.target-arch }}-${{ matrix.toolset }}-${{ github.sha }}' - path: build/artifacts/bin/** + path: build/artifacts/** linux: name: "Linux GCC 11" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 00d369aff..db1470f3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -143,10 +143,11 @@ if(MINITRACE) target_link_libraries(86Box minitrace) endif() -if(APPLE) - # `install` fails on Mac if the destination is omitted - install(TARGETS 86Box DESTINATION "bin") +if(WIN32 OR APPLE) + # Copy the binary to the root of the install prefix on Windows and macOS + install(TARGETS 86Box DESTINATION ".") else() + # On Linux we want to copy the binary to the `bin` folder. install(TARGETS 86Box) endif() @@ -155,20 +156,30 @@ if(APPLE) install(CODE " include(BundleUtilities) get_filename_component(CMAKE_INSTALL_PREFIX_ABSOLUTE \${CMAKE_INSTALL_PREFIX} ABSOLUTE) - fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/bin/86Box.app\" \"\" \"\")" + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/86Box.app\" \"\" \"\")" COMPONENT Runtime) endif() # Install our dependencies if using vcpkg if(VCPKG_TOOLCHAIN) - x_vcpkg_install_local_dependencies(TARGETS 86Box DESTINATION "bin") + x_vcpkg_install_local_dependencies(TARGETS 86Box DESTINATION ".") endif() -# Install the PDB file on MSVC builds (i.e. LLVM on Windows+vcpkg) +# Install the PDB file on Windows builds if(MSVC) + # CMake fully supports PDB files on MSVC-compatible compilers install(FILES $ CONFIGURATIONS Debug RelWithDebInfo - DESTINATION "bin") + DESTINATION ".") +elseif(WIN32) + # Other compilers/linkers (such as Clang in GCC-compatible mode) also + # emit PDB files when targeting Windows, however, CMake only supports + # the relevant properties with MSVC and clones. Try to install + # the PDB file assuming it's in the same path as the EXE. + install(FILES "$/$.pdb" + CONFIGURATIONS Debug RelWithDebInfo + DESTINATION "." + OPTIONAL) endif() add_subdirectory(device)