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
CMakeFiles
CMakeSettings.json
CMakeUserPresets.json
compile_commands.json
/.cache
/.vscode
cmake_install.cmake
hle-bios.bin
version.c

View File

@ -217,13 +217,15 @@ endif()
# Platform support
if(WIN32)
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)
if(MSVC)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
add_definitions(-D_UNICODE -DUNICODE)
else()
add_definitions(-D_GNU_SOURCE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_compile_definitions(_FILE_OFFSET_BITS=64)
endif()
endif()
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)

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)
set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})
else()
target_compile_definitions(${BINARY_NAME}-sdl PRIVATE _WIN32_WINNT=0x0600)
set_target_properties(${BINARY_NAME}-sdl PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif()
install(TARGETS ${BINARY_NAME}-sdl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-sdl)