CMake: make compile with mingw-w64 and Qt6

This commit is contained in:
oltolm 2024-01-07 12:13:26 +01:00 committed by Vicki Pfau
parent 49d9b70e6f
commit cf54ddd864
4 changed files with 29 additions and 1 deletions

4
.gitignore vendored
View File

@ -20,6 +20,10 @@
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles
CMakeSettings.json CMakeSettings.json
CMakeUserPresets.json
compile_commands.json
/.cache
/.vscode
cmake_install.cmake cmake_install.cmake
hle-bios.bin hle-bios.bin
version.c version.c

View File

@ -217,13 +217,15 @@ endif()
# Platform support # Platform support
if(WIN32) if(WIN32)
set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}") set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}")
add_definitions(-D_WIN32_WINNT=0x0600)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(MSVC) if(MSVC)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
add_definitions(-D_UNICODE -DUNICODE) add_definitions(-D_UNICODE -DUNICODE)
else() else()
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_compile_definitions(_FILE_OFFSET_BITS=64)
endif()
endif() endif()
list(APPEND OS_LIB ws2_32 shlwapi) list(APPEND OS_LIB ws2_32 shlwapi)
list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/vfs-w32.c) list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/vfs-w32.c)

21
CMakePresets.json Normal file
View File

@ -0,0 +1,21 @@
{
"version": 3,
"configurePresets": [
{
"name": "clang",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "gcc",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
}
]
}

View File

@ -125,6 +125,7 @@ target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OP
if(NOT WIN32) if(NOT WIN32)
set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME}) set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})
else() else()
target_compile_definitions(${BINARY_NAME}-sdl PRIVATE _WIN32_WINNT=0x0600)
set_target_properties(${BINARY_NAME}-sdl PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set_target_properties(${BINARY_NAME}-sdl PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif() endif()
install(TARGETS ${BINARY_NAME}-sdl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-sdl) install(TARGETS ${BINARY_NAME}-sdl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-sdl)