diff options
author | Andrea Mattavelli <andreamattavelli@users.noreply.github.com> | 2017-04-03 22:28:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-03 22:28:34 +0100 |
commit | 0c95b3ec029d467be1a1b03eca125c0506877201 (patch) | |
tree | 6bcbfcc350702282e1e956794f3d32d62e7aa0d6 | |
parent | 2a2e972e8d287e61ad40b1cc14165b5eff482fc4 (diff) | |
parent | 6a70f100c67ce9a0c2cd52d4af8fb9a7cfce22e2 (diff) | |
download | klee-0c95b3ec029d467be1a1b03eca125c0506877201.tar.gz |
Merge pull request #636 from delcypher/cmake_bitcode_build_system_fixes
[CMake] bitcode build system fixes
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | README-CMake.md | 1 | ||||
-rw-r--r-- | runtime/CMakeLists.txt | 11 | ||||
-rw-r--r-- | runtime/Makefile.cmake.bitcode.rules | 9 |
4 files changed, 25 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 97c51a2e..ff55ad23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,13 @@ else() set(ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG "") endif() +if (("${CMAKE_VERSION}" VERSION_EQUAL "3.4") OR ("${CMAKE_VERSION}" VERSION_GREATER "3.4")) + # In CMake >= 3.4 ExternalProject_Add_Step() supports a `USES_TERMINAL` argument + set(EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG "USES_TERMINAL" "1") +else() + set(EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG "") +endif() + ################################################################################ # Sanity check - Disallow building in source. # Otherwise we would overwrite the Makefiles of the old build system. diff --git a/README-CMake.md b/README-CMake.md index c2893004..2d438546 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -7,6 +7,7 @@ its autoconf/Makefile based build system. * `check` - Build and run all tests. * `clean` - Clean the build tree. Note this won't clean the runtime build. +* `clean_runtime` - Clean the runtime build tree. * `docs` - Build documentation * `edit_cache` - Show cmake/ccmake/cmake-gui interface for chaning configure options. * `help` - Show list of top level targets diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 1e680e5d..c90cbda0 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -111,10 +111,17 @@ ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode all ALWAYS ${EXTERNAL_PROJECT_BUILD_ALWAYS_ARG} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ${EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG} ) -# FIXME: Invoke `make clean` in the bitcode build system -# when the `clean` target is invoked. +# Target for cleaning the bitcode build system +# FIXME: Invoke `make clean` does not invoke this target. It's also weird +# that `ExternalProject` provides no way to do a clean. +add_custom_target(clean_runtime + COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode clean + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ${ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG} +) ############################################################################### # Runtime install diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules index 8261ce99..2737eb80 100644 --- a/runtime/Makefile.cmake.bitcode.rules +++ b/runtime/Makefile.cmake.bitcode.rules @@ -70,8 +70,15 @@ else all:: build_at_level # Compute the directory to find sources -DIR_SUFFIX := $(subst $(RUNTIME_CMAKE_BINARY_DIR),,$(CURRENT_DIR)) +# Note: Use of $(realpath) is to resolve any symlinks +DIR_SUFFIX := $(subst $(realpath $(RUNTIME_CMAKE_BINARY_DIR)),,$(realpath $(CURRENT_DIR))) SRC_DIR := $(abspath $(ROOT_SRC)/$(DIR_SUFFIX)) +# Sanity check +ifeq ($(realpath $(SRC_DIR)),) +$(error SRC_DIR "$(SRC_DIR)" does not exist) +endif + +# Compute the directory to put build files LOCAL_BUILD_DIR := $(abspath $(ROOT_OBJ)/$(DIR_SUFFIX)) C_SRCS := $(shell echo $(SRC_DIR)/*.c) |