diff --git a/.gitignore b/.gitignore index 2e3e62783..024d14db9 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ cmake-build-*/ # Dependencies from .gitmodules core/deps/breakpad/ core/deps/glslang/ +.cache/ +compile_commands.json +CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index c07d1047c..0aaa4b5ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,7 +364,8 @@ if(USE_OPENMP) find_package(OpenMP) if(OpenMP_CXX_FOUND) if(MINGW) - target_link_libraries(${PROJECT_NAME} PRIVATE "-static -lgomp -lpthread") + target_link_libraries(${PROJECT_NAME} PRIVATE -lpthread) + target_link_options(${PROJECT_NAME} PRIVATE -fopenmp -static) target_compile_options(${PROJECT_NAME} PRIVATE -fopenmp) elseif(ANDROID) # Reference: https://android.googlesource.com/platform/ndk/+/refs/heads/master/tests/device/openmp/CMakeLists.txt @@ -1959,3 +1960,7 @@ if(${CMAKE_GENERATOR} MATCHES "^Xcode.*|^Visual Studio.*") file(GLOB_RECURSE SRC_FILES *.h *.cpp *.c *.cc *.mm) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC_FILES}) endif() + +if(WIN32) + target_link_libraries(${PROJECT_NAME} PRIVATE Psapi) +endif() diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..1dd117887 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,23 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "clang", + "generator": "Ninja", + "binaryDir": "build-clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "gcc", + "generator": "Ninja", + "binaryDir": "build-gcc", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + } + ] +}