mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 05:45:38 +00:00
Build: Use bin directory for cmake, fix Windows/cmake build
This commit is contained in:
parent
a937a09b5c
commit
47c2b29395
|
@ -19,10 +19,12 @@ if(WIN32)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2.lib")
|
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2.lib")
|
||||||
set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2main.lib")
|
set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2main.lib")
|
||||||
|
set(SDL2_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/bin64/SDL2.dll")
|
||||||
set(Qt5_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/5.14.0/msvc2017_64/lib/cmake/Qt5")
|
set(Qt5_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/5.14.0/msvc2017_64/lib/cmake/Qt5")
|
||||||
else()
|
else()
|
||||||
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2.lib")
|
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2.lib")
|
||||||
set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2main.lib")
|
set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2main.lib")
|
||||||
|
set(SDL2_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/bin32/SDL2.dll")
|
||||||
set(Qt5_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/5.14.0/msvc2017_32/lib/cmake/Qt5")
|
set(Qt5_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/5.14.0/msvc2017_32/lib/cmake/Qt5")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -111,6 +113,15 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Write binaries to a seperate directory.
|
||||||
|
if(WIN32)
|
||||||
|
# For Windows, use the source directory.
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CPU_ARCH}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Enable threads everywhere.
|
# Enable threads everywhere.
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
|
@ -46,7 +46,7 @@ done
|
||||||
|
|
||||||
${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
||||||
--appdir=${BUILD_DIR}/AppDir-duckstation-qt \
|
--appdir=${BUILD_DIR}/AppDir-duckstation-qt \
|
||||||
--executable=${BUILD_DIR}/src/duckstation-qt/duckstation-qt \
|
--executable=${BUILD_DIR}/bin/duckstation-qt \
|
||||||
--desktop-file=${APPIMAGE_RESOURCES_DIR}/duckstation-qt.desktop \
|
--desktop-file=${APPIMAGE_RESOURCES_DIR}/duckstation-qt.desktop \
|
||||||
${ICONS_QT[@]/#/--icon-file=} \
|
${ICONS_QT[@]/#/--icon-file=} \
|
||||||
--plugin=qt \
|
--plugin=qt \
|
||||||
|
@ -55,7 +55,7 @@ ${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
||||||
|
|
||||||
${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
||||||
--appdir=${BUILD_DIR}/AppDir-duckstation-sdl \
|
--appdir=${BUILD_DIR}/AppDir-duckstation-sdl \
|
||||||
--executable=${BUILD_DIR}/src/duckstation-sdl/duckstation-sdl \
|
--executable=${BUILD_DIR}/bin/duckstation-sdl \
|
||||||
--desktop-file=${APPIMAGE_RESOURCES_DIR}/duckstation-sdl.desktop \
|
--desktop-file=${APPIMAGE_RESOURCES_DIR}/duckstation-sdl.desktop \
|
||||||
${ICONS_SDL[@]/#/--icon-file=} \
|
${ICONS_SDL[@]/#/--icon-file=} \
|
||||||
--output=appimage \
|
--output=appimage \
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c61fdc2a064825b39be394c6f2b7808df35f3398
|
Subproject commit 6afb5f4a3e77dcb1b09059adc839a2813d0ea1dc
|
|
@ -61,6 +61,29 @@ if(WIN32)
|
||||||
d3d11hostdisplay.h
|
d3d11hostdisplay.h
|
||||||
)
|
)
|
||||||
target_link_libraries(duckstation-qt PRIVATE d3d11.lib dxgi.lib)
|
target_link_libraries(duckstation-qt PRIVATE d3d11.lib dxgi.lib)
|
||||||
|
|
||||||
|
# We want a Windows subsystem application not console.
|
||||||
|
set_target_properties(duckstation-qt PROPERTIES
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
DEBUG_POSTFIX "-debug")
|
||||||
|
|
||||||
|
# Copy in Qt DLLs. Borrowed from Dolphin.
|
||||||
|
get_target_property(MOC_EXECUTABLE_LOCATION Qt5::moc IMPORTED_LOCATION)
|
||||||
|
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
|
||||||
|
find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
|
||||||
|
add_custom_command(TARGET duckstation-qt POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E env PATH="${QT_BINARY_DIRECTORY}"
|
||||||
|
"${WINDEPLOYQT_EXE}" --libdir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
|
||||||
|
--plugindir="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/QtPlugins"
|
||||||
|
$<IF:$<CONFIG:Debug>,--debug,--release>
|
||||||
|
--no-translations
|
||||||
|
--no-compiler-runtime
|
||||||
|
--no-angle
|
||||||
|
"$<TARGET_FILE:duckstation-qt>"
|
||||||
|
)
|
||||||
|
add_custom_command(TARGET duckstation-qt POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf.win" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
if(OpenGL_GLX_FOUND)
|
if(OpenGL_GLX_FOUND)
|
||||||
target_compile_definitions(duckstation-qt PRIVATE "HAS_GLX")
|
target_compile_definitions(duckstation-qt PRIVATE "HAS_GLX")
|
||||||
|
|
2
src/duckstation-qt/qt.conf.win
Normal file
2
src/duckstation-qt/qt.conf.win
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[Paths]
|
||||||
|
Plugins = ./QtPlugins
|
|
@ -19,5 +19,10 @@ if(WIN32)
|
||||||
duckstation-sdl.manifest
|
duckstation-sdl.manifest
|
||||||
)
|
)
|
||||||
target_link_libraries(duckstation-sdl PRIVATE d3d11.lib dxgi.lib ${SDL2MAIN_LIBRARIES})
|
target_link_libraries(duckstation-sdl PRIVATE d3d11.lib dxgi.lib ${SDL2MAIN_LIBRARIES})
|
||||||
|
|
||||||
|
# We want a Windows subsystem application not console.
|
||||||
|
set_target_properties(duckstation-sdl PROPERTIES
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
DEBUG_POSTFIX "-debug")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,20 @@ if(SDL2_FOUND)
|
||||||
target_compile_definitions(frontend-common PRIVATE "WITH_SDL2=1")
|
target_compile_definitions(frontend-common PRIVATE "WITH_SDL2=1")
|
||||||
target_include_directories(frontend-common PRIVATE ${SDL2_INCLUDE_DIRS})
|
target_include_directories(frontend-common PRIVATE ${SDL2_INCLUDE_DIRS})
|
||||||
target_link_libraries(frontend-common PRIVATE ${SDL2_LIBRARIES})
|
target_link_libraries(frontend-common PRIVATE ${SDL2_LIBRARIES})
|
||||||
|
|
||||||
|
# Copy bundled SDL2 to output on Windows.
|
||||||
|
if(WIN32)
|
||||||
|
add_custom_command(TARGET frontend-common POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SDL2.dll")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_DISCORD_PRESENCE)
|
if(ENABLE_DISCORD_PRESENCE)
|
||||||
target_compile_definitions(frontend-common PUBLIC -DWITH_DISCORD_PRESENCE=1)
|
target_compile_definitions(frontend-common PUBLIC -DWITH_DISCORD_PRESENCE=1)
|
||||||
target_link_libraries(frontend-common PRIVATE discord-rpc)
|
target_link_libraries(frontend-common PRIVATE discord-rpc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Copy the provided data directory to the output directory.
|
||||||
|
add_custom_command(TARGET frontend-common POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/data" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
|
||||||
|
)
|
|
@ -1,7 +1,10 @@
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_custom_command(OUTPUT scmversion.cpp COMMAND "cmd /k gen_scmversion.bat" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
add_custom_command(OUTPUT scmversion.cpp
|
||||||
|
COMMAND cmd /k "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.bat"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
else()
|
else()
|
||||||
add_custom_command(OUTPUT scmversion.cpp COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.sh")
|
add_custom_command(OUTPUT scmversion.cpp
|
||||||
|
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.sh")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(scmversion
|
add_library(scmversion
|
||||||
|
|
Loading…
Reference in a new issue