move compile_commands.json to project root directory
This commit is contained in:
parent
859ae8f91e
commit
fa85fb8dd1
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,6 +18,8 @@
|
||||
build/
|
||||
out/
|
||||
|
||||
compile_commands.json
|
||||
|
||||
# this is created when using Conan
|
||||
CMakeUserPresets.json
|
||||
|
||||
|
@ -16,7 +16,7 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
endif ()
|
||||
|
||||
set(TOWNENGINE_TARGET townengine CACHE INTERNAL "")
|
||||
set(TOWNENGINE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
|
||||
set(TOWNENGINE_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
|
||||
|
||||
option(TOWNENGINE_HOT_RELOAD "Enable hot reloading support" TRUE)
|
||||
add_compile_options($<$<BOOL:${TOWNENGINE_HOT_RELOAD}>:-fPIC>)
|
||||
@ -60,7 +60,7 @@ set(TOWNENGINE_SOURCE_FILES
|
||||
|
||||
${SYSTEM_SOURCE_FILES})
|
||||
|
||||
list(TRANSFORM TOWNENGINE_SOURCE_FILES PREPEND ${TOWNENGINE_DIR}/)
|
||||
list(TRANSFORM TOWNENGINE_SOURCE_FILES PREPEND ${TOWNENGINE_ROOT_DIR}/)
|
||||
|
||||
# base engine code, reused for games and tools
|
||||
if (TOWNENGINE_HOT_RELOAD)
|
||||
@ -68,7 +68,7 @@ if (TOWNENGINE_HOT_RELOAD)
|
||||
else ()
|
||||
add_library(${TOWNENGINE_TARGET} STATIC ${TOWNENGINE_SOURCE_FILES})
|
||||
endif ()
|
||||
source_group(TREE ${TOWNENGINE_DIR} FILES ${TOWNENGINE_SOURCE_FILES})
|
||||
source_group(TREE ${TOWNENGINE_ROOT_DIR} FILES ${TOWNENGINE_SOURCE_FILES})
|
||||
|
||||
set_target_properties(${TOWNENGINE_TARGET} PROPERTIES
|
||||
C_STANDARD 11
|
||||
@ -176,11 +176,11 @@ function(include_deps target)
|
||||
third-party/stb
|
||||
third-party/x-watcher)
|
||||
|
||||
list(TRANSFORM THIRD_PARTY_INCLUDES PREPEND ${TOWNENGINE_DIR}/)
|
||||
list(TRANSFORM THIRD_PARTY_INCLUDES PREPEND ${TOWNENGINE_ROOT_DIR}/)
|
||||
target_include_directories(${target} SYSTEM PRIVATE ${THIRD_PARTY_INCLUDES})
|
||||
|
||||
# allow access to headers from any point in source tree
|
||||
target_include_directories(${target} PRIVATE ${TOWNENGINE_DIR})
|
||||
target_include_directories(${target} PRIVATE ${TOWNENGINE_ROOT_DIR})
|
||||
endfunction()
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ function(use_townengine target sources output_directory data_dir)
|
||||
target_link_libraries(${target}_game PUBLIC SDL2::SDL2)
|
||||
|
||||
# launcher binary, loads game and engine shared library
|
||||
add_executable(${target}_app ${TOWNENGINE_DIR}/townengine/null.c)
|
||||
add_executable(${target}_app ${TOWNENGINE_ROOT_DIR}/townengine/null.c)
|
||||
set_target_properties(${target}_app PROPERTIES
|
||||
OUTPUT_NAME launcher
|
||||
LIBRARY_OUTPUT_DIRECTORY ${output_directory})
|
||||
@ -261,6 +261,11 @@ if (${CMAKE_PROJECT_NAME} MATCHES townengine)
|
||||
add_subdirectory(apps/testgame)
|
||||
endif ()
|
||||
|
||||
# move compie_commands.json into root directory so that it plays nicer with editors
|
||||
add_custom_command(TARGET ${TOWNENGINE_TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/compile_commands.json
|
||||
${TOWNENGINE_ROOT_DIR})
|
||||
|
||||
# zip up assets
|
||||
# currently, you must run cmake from the project root dir for this to work correctly
|
||||
#file(ARCHIVE_CREATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data.${PACKAGE_EXTENSION}
|
||||
|
Loading…
Reference in New Issue
Block a user