microsoft / microsoft/SPTAG

cmake: build executables, libraries and bindings files on `obj` dir

Open
#207 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
5k
Forks
622
Avg merge
8h 37m
Merged PRs (30d)
5

Description

After building SPTAG and then running make clean and deleting the obj directory, the files generated by the build (including swig bindings files) are still present.

None
None/sptag-indexbuilder
None/sptag-server
None/sptag-client
None/_SPTAG.so
None/SPTAG.py
None/test
None/sptag-aggregator
None/SPTAGClient.py
None/libSPTAGLib.so
None/_SPTAGClient.so
None/libSPTAGLibStatic.a
None/sptag-indexsearcher
None/libDistanceUtils.a
Wrappers/inc/ClientInterface_pwrap.cpp
Wrappers/inc/CoreInterface_pwrap.cpp
Wrappers/inc/SPTAG.py
Wrappers/inc/SPTAGClient.py

The .gitignore file already ignores some of these files:

/Wrappers/inc/*wrap.*
/Wrappers/inc/*.py
/Wrappers/inc/*.java

Since these files are generated during the build, they should be output to the build dir (usually obj).

I noticed that on Windows, the CMakeLists.txt

$ grep -C4 CMAKE_BINARY_DIR CMakeLists.txt
if (WIN32)
    set(Boost_USE_STATIC_LIBS ON)

    set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

    set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR})
    set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR})
else()
    set (LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/")
    set (EXECUTABLE_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/")
endif()

I suggest that the output directories be set to ${CMAKE_BINARY_DIR} and that the swig bindings be built in ${CMAKE_BINARY_DIR} too.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CMakeLists.txt and trace the output-directory settings for executables, libraries, archives, and SWIG-generated bindings. Reproduce the build, make clean, and obj-directory removal, then verify that generated artifacts are placed under the build directory and are removed without leaving files in the source tree.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.