compile_commands.json

This commit is contained in:
2025-10-03 19:41:47 -07:00
parent 056cd02375
commit 7a2a23c51c
2 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
cmake-build-debug/
build/
.cache/
.idea
roms/

View File

@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.25)
project(GameBoy++)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
@@ -18,4 +19,14 @@ add_executable(GameBoy++ src/main.cpp
src/testing.hpp
src/joypad.cpp
)
target_link_libraries(GameBoy++ ${SDL2_LIBRARIES})
target_link_libraries(GameBoy++ ${SDL2_LIBRARIES})
if(CMAKE_EXPORT_COMPILE_COMMANDS)
add_custom_target(copy_compile_commands ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_SOURCE_DIR}/compile_commands.json
DEPENDS ${CMAKE_BINARY_DIR}/compile_commands.json
COMMENT "Copying compile_commands.json to project root")
endif()