diff --git a/CMakeLists.txt b/CMakeLists.txt index 48a45e4b8..2036b9c7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,18 @@ endif() string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*" CMAKE_NLE_VERSION "${NLE_VERSION}") project(nle VERSION ${CMAKE_NLE_VERSION}) +# Only enable ccache if this is the main project, not a sub-dependency. +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + find_program(CCACHE_EXECUTABLE ccache) + if(CCACHE_EXECUTABLE) + message(STATUS "ccache found, enabling for C and C++") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + else() + message(STATUS "ccache not found, proceeding without it") + endif() +endif() + if(CMAKE_BUILD_TYPE MATCHES Debug) message("Debug build.") # Unclear if this is even necessary. `dsymutil rlmain -o rlmain.dSYM` seems to diff --git a/pyproject.toml b/pyproject.toml index d1ff3031e..f6d9640f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,8 @@ cmake.build-type = "Release" cmake.args = ["-DHACKDIR=nle/nethackdir", "-DPYTHON_PACKAGE_NAME=nle"] minimum-version = "build-system.requires" metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" +build-dir = "build/{wheel_tag}" +editable.rebuild = true generate = [ { path = "nle/version.py", template = '__version__ = "${version}"' }, ]