diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore index 520b10a..12b2bae 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ docs/_build .svn msvc src/test/test_data/input/mickey_material_fields +.cache diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..42fb9fe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "cmake.sourceDirectory": "/home/l5cui/projects/Cleaver/src", + "clangd.arguments": [ + "-background-index", + "-compile-commands-dir=${workspaceFolder}/build", + "-j=4", + "-log=verbose", + "-clang-tidy", + "--enable-config", + ], +} \ No newline at end of file diff --git a/docs/build.md b/docs/build.md index 500065c..a20e0e3 100644 --- a/docs/build.md +++ b/docs/build.md @@ -32,10 +32,10 @@ Users of the Cleaver command line tool or graphical interface may not need to bu The table below describes some of build options available when configuring Cleaver using CMake. -| Option | Description | Default | -|-------------|-------------|---------| -| `BUILD_CLI` | Build Cleaver Command Line Tool (CLI) application | `OFF` | -| `BUILD_GUI` | Build Cleaver Graphical Interface (GUI) application | `OFF` | +| Option | Description | Default | +| ----------- | --------------------------------------------------- | ------- | +| `BUILD_CLI` | Build Cleaver Command Line Tool (CLI) application | `OFF` | +| `BUILD_GUI` | Build Cleaver Graphical Interface (GUI) application | `OFF` | :::{tip} By default, when both `BUILD_CLI` and `BUILD_GUI` are `OFF`, only the is built. @@ -51,10 +51,10 @@ By default, when both `BUILD_CLI` and `BUILD_GUI` are `OFF`, only the 32 bits)") try_run(DUMMY ${VARIABLE} - ${CMAKE_BINARY_DIR} + ${CLEAVER2_BINARY_DIR} ${LOCAL_TEST_DIR}/CheckBigBitfield.c OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) set(HAVE_${VARIABLE} TRUE CACHE INTERNAL " ") message(STATUS "Checking to see if this platform supports large bit-fields (>32 bits) - yes") - file(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeOutput.log "Checking to see if this platform supports large bit-fields (>32 bits) passed with " "the following output:\n${OUTPUT}\n\n") else() message(STATUS "Checking to see if this platform supports large bit-fields (>32 bits) - no") - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "Checking to see if this platform supports large bit-fields (>32 bits) failed with " "the following output:\n${OUTPUT}\n\n") endif() diff --git a/src/lib/teem/CMake/TestNO_ICC_IDYNAMIC_NEEDED.cmake b/src/lib/teem/CMake/TestNO_ICC_IDYNAMIC_NEEDED.cmake index 2b3370a..8f7ed7f 100644 --- a/src/lib/teem/CMake/TestNO_ICC_IDYNAMIC_NEEDED.cmake +++ b/src/lib/teem/CMake/TestNO_ICC_IDYNAMIC_NEEDED.cmake @@ -29,25 +29,25 @@ macro(TESTNO_ICC_IDYNAMIC_NEEDED VARIABLE LOCAL_TEST_DIR) if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") try_run(${VARIABLE} HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} + ${CLEAVER2_BINARY_DIR} ${LOCAL_TEST_DIR}/TestNO_ICC_IDYNAMIC_NEEDED.cxx OUTPUT_VARIABLE OUTPUT) message(STATUS "Check if using the Intel icc compiler, and if -i_dynamic is needed... COMPILE_RESULT...${HAVE_${VARIABLE}} RUN_RESULT...${VARIABLE}\n") if(HAVE_${VARIABLE}) #Test compiled, either working intel w/o -i_dynamic, or another compiler if(${VARIABLE}) #Intel icc compiler, -i_dynamic not needed - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "-i_dynamic not needed, (Not Intel icc, or this version of Intel icc does not conflict with OS glibc.") message(STATUS "-i_dynamic not needed, (Not Intel icc, or this version of Intel icc does not conflict with OS glibc.") else() #The compiler is not Intel icc - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "The compiler ERROR--This should never happen") message(STATUS "The compiler ERROR--This should never happen") endif() else() #Test did not compile, either badly broken compiler, or intel -i_dynamic needed - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "\tThe -i_dynamic compiler flag is needed for the Intel icc compiler on this platform.\n") message("The -i_dynamic compiler flag is needed for the Intel icc compiler on this platform.") endif() - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log "TestNO_ICC_IDYNAMIC_NEEDED produced following output:\n${OUTPUT}\n\n") + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "TestNO_ICC_IDYNAMIC_NEEDED produced following output:\n${OUTPUT}\n\n") endif() endmacro() diff --git a/src/lib/teem/CMake/TestQnanhibit.cmake b/src/lib/teem/CMake/TestQnanhibit.cmake index d2902cf..9fe9fa8 100644 --- a/src/lib/teem/CMake/TestQnanhibit.cmake +++ b/src/lib/teem/CMake/TestQnanhibit.cmake @@ -31,7 +31,7 @@ macro(TEST_QNANHIBIT VARIABLE LOCAL_TEST_DIR) if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") try_run(${VARIABLE} HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} + ${CLEAVER2_BINARY_DIR} ${LOCAL_TEST_DIR}/TestQnanhibit.c OUTPUT_VARIABLE OUTPUT) message(STATUS "Check the value of the 22nd bit of a 32-bit quiet-NaN") @@ -40,19 +40,19 @@ macro(TEST_QNANHIBIT VARIABLE LOCAL_TEST_DIR) message(ERROR " A test (qnanhibit.c) necessary for NrrdIO configuration returned error code. NrrdIO may not properly handle NaN's.") endif() if(${VARIABLE}) - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "Value of the 22nd bit of a 32-bit quiet-NaN is 1") message(STATUS "Check the value of the 22nd bit of a 32-bit quiet-NaN - 1") else() - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "Value of the 22nd bit of a 32-bit quiet-NaN is 0") message(STATUS "Check the value of the 22nd bit of a 32-bit quiet-NaN - 0") endif() else() - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "\tFailed to compile a test (TestQnanhibit.c) necessary to configure for proper handling of IEEE floating point NaN's.\n") message(STATUS "Failed to compile a test (TestQnanhibit.c) necessary to configure for proper handling of IEEE floating point NaN's") endif() - file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log "TestQnanhibit.c produced following output:\n${OUTPUT}\n\n") + file(APPEND ${CLEAVER2_BINARY_DIR}/CMakeError.log "TestQnanhibit.c produced following output:\n${OUTPUT}\n\n") endif() endmacro() diff --git a/src/lib/teem/CMakeLists.txt b/src/lib/teem/CMakeLists.txt index 8be233d..6b5ca1b 100644 --- a/src/lib/teem/CMakeLists.txt +++ b/src/lib/teem/CMakeLists.txt @@ -60,8 +60,8 @@ include (CMakeBackwardCompatibilityC) #----------------------------------------------------------------------------- # Output directories. -set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.") -set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.") +# set (LIBRARY_OUTPUT_PATH ${CLEAVER2_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.") +# set (EXECUTABLE_OUTPUT_PATH ${CLEAVER2_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.") #output directory for installing all include files.") mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) set(Teem_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}") @@ -279,16 +279,16 @@ foreach(header_file ${Teem_HEADER_FILES}) #message(STATUS "Copy header file: ${header_file}") get_filename_component(file_no_path "${header_file}" NAME) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/${header_file}" - "${CMAKE_BINARY_DIR}/include/teem/${file_no_path}" COPYONLY IMMEDIATE) + "${CLEAVER2_BINARY_DIR}/include/teem/${file_no_path}" COPYONLY IMMEDIATE) set(Teem_INSTALLED_HEADER_FILES ${Teem_INSTALLED_HEADER_FILES} - "${CMAKE_BINARY_DIR}/include/teem/${file_no_path}") + "${CLEAVER2_BINARY_DIR}/include/teem/${file_no_path}") endforeach() #--- # Include directory include_directories( - "${CMAKE_BINARY_DIR}/include/" + "${CLEAVER2_BINARY_DIR}/include/" "${Teem_SOURCE_DIR}/include/" ) diff --git a/src/lib/teem/DartConfig.cmake b/src/lib/teem/DartConfig.cmake index a3f538f..61fea43 100755 --- a/src/lib/teem/DartConfig.cmake +++ b/src/lib/teem/DartConfig.cmake @@ -20,7 +20,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # -include(${CMAKE_SOURCE_DIR}/CTestConfig.cmake) +include(${CLEAVER2_SOURCE_DIR}/CTestConfig.cmake) set(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}") set(DROP_METHOD "${CTEST_DROP_METHOD}") set(DROP_SITE "${CTEST_DROP_SITE}") diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 9dbf903..4e8a624 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -1,5 +1,5 @@ # gtest external download -set(EXTERNAL_DIR "${CMAKE_BINARY_DIR}/externals") +set(EXTERNAL_DIR "${CLEAVER2_BINARY_DIR}/externals") set(GTEST_INSTALL_DIR "${EXTERNAL_DIR}/googletest") if(WIN32) set(GTEST_SHARED_ARG ON) @@ -46,6 +46,9 @@ ExternalProject_Add(googletest BINARY_DIR "${GTEST_INSTALL_DIR}/lib" INSTALL_COMMAND "" ${_ep_arg_build_byproducts} + CMAKE_ARGS + -DCMAKE_CXX_FLAGS=-Wno-error=maybe-uninitialized + -DCMAKE_C_FLAGS=-Wno-error=maybe-uninitialized ) # Copy and Specify Include Directory @@ -95,7 +98,7 @@ add_dependencies(${GMOCK_MAIN_LIBRARY} ${GTEST_LIBRARY}) # Definitions for Tests -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CLEAVER2_BINARY_DIR}/test/bin) #test macro function(NEWTEST name) add_executable(${name} ${name}.cpp ${ARGN})