Skip to content
Permalink
Browse files

Merge pull request #3337 from sanssecours/🦚

Style: Reformat Code With cmake-format 0.6.3
  • Loading branch information
mpranj committed Dec 16, 2019
2 parents b4622ad + ca7b28f commit 3999d9250cea48880698f067373152bff2dddf2b
@@ -164,7 +164,7 @@ mac_task:
brew install python@2; brew link --overwrite python@2
brew install python || brew upgrade python
- | # Install Python packages
pip install cmake-format[yaml]==0.6
pip install cmake-format[yaml]==0.6.3
- | # Install Ruby (We use the Homebrew version of Ruby to install gems, since compiling `ronn` fails with the macOs version of Ruby.)
brew install ruby@2.6
export PATH="/usr/local/opt/ruby@2.6/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"
@@ -238,7 +238,7 @@ before_install:
sudo apt-get install libzmq3-dev
sudo apt-get install libxerces-c-dev
sudo apt-get install moreutils # contains `sponge` required by `reformat-cmake`
sudo pip install cmake-format[yaml]==0.6
sudo pip install cmake-format[yaml]==0.6.3
fi
#
@@ -190,7 +190,7 @@ apt-get install clang-format-6.0
For the basic use cases you can use `clang-format` directly. To do that, just call the tool using the option `-i` and specify the name of the files you want to reformat. For example, if you want to reformat the file `src/bindings/cpp/include/kdb.hpp` you can use the following command:

```sh
# On some systems such as Debian the `cmake-format` executable also contains
# On some systems such as Debian the `clang-format` executable also contains
# the version number. For those systems, please replace `clang-format`,
# with `clang-format-6.0` or `clang-format-7` in the command below.
clang-format -i src/bindings/cpp/include/kdb.hpp
@@ -264,15 +264,15 @@ cmake-format CMakeLists.txt | unexpand | sponge CMakeLists.txt
Since `cmake-format` is written in [Python](https://www.python.org) you usually install it via Python’s package manager `pip`:

```sh
# Install cmake format `0.6` with support for YAML config files
pip install cmake-format[yaml]==0.6
# Install cmake format `0.6.3` with support for YAML config files
pip install cmake-format[yaml]==0.6.3
```

. Please make sure, that you install the correct version (`0.6.0`) of cmake format:
. Please make sure, that you install the correct version (`0.6.3`) of cmake format:

```sh
cmake-format --version
#> 0.6.0
#> 0.6.3
```

, since otherwise the formatted code might look quite different.
@@ -123,7 +123,7 @@ you up to date with the multi-language support provided by Elektra.
## Scripts

- The [fish completion script](../../scripts/completion/kdb.fish) now recognizes the new names of subcommands (e.g. `meta-set` instead of `setmeta` ) introduced with Elektra `0.9.1`. _(René Schwaiger)_
- <<TODO>>
- The script [cmake-format](../../scripts/dev/reformat-cmake) now reformats the code with `cmake-format` 0.6.3. _(René Schwaiger)_
- <<TODO>>

## Documentation
@@ -128,23 +128,25 @@ if (XercesC_FOUND)
endif ()
if (EXISTS "${XercesC_LIBRARY}")
set_target_properties (XercesC::XercesC PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION
"${XercesC_LIBRARY}")
"${XercesC_LIBRARY}")
endif ()
if (EXISTS "${XercesC_LIBRARY_DEBUG}")
set_property (
TARGET XercesC::XercesC
APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties (XercesC::XercesC PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}")
set_target_properties (
XercesC::XercesC PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" IMPORTED_LOCATION_DEBUG
"${XercesC_LIBRARY_DEBUG}")
endif ()
if (EXISTS "${XercesC_LIBRARY_RELEASE}")
set_property (
TARGET XercesC::XercesC
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties (XercesC::XercesC PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}")
set_target_properties (
XercesC::XercesC PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" IMPORTED_LOCATION_RELEASE
"${XercesC_LIBRARY_RELEASE}")
endif ()
endif ()
endif ()
@@ -55,7 +55,10 @@ function (add_lib name)
"-Wl,--version-script='${CMAKE_BINARY_DIR}/src/libs/symbols.map'")
endif ()

install (TARGETS elektra-${name} DESTINATION lib${LIB_SUFFIX} EXPORT ElektraTargetsLibelektra)
install (
TARGETS elektra-${name}
DESTINATION lib${LIB_SUFFIX}
EXPORT ElektraTargetsLibelektra)
endif (BUILD_SHARED)

endfunction ()
@@ -13,10 +13,10 @@ SCRIPTS_DIR=$(dirname "$0")
# before we save the output of the command.
CMAKE_FORMAT="$(which cmake-format)" && CMAKE_FORMAT_VERSION="$("$CMAKE_FORMAT" 2>&1 --version)"

if [ -z "${CMAKE_FORMAT}" ] || [ "$CMAKE_FORMAT_VERSION" != "0.6.0" ]; then
if [ -z "${CMAKE_FORMAT}" ] || [ "$CMAKE_FORMAT_VERSION" != "0.6.3" ]; then
printf >&2 'cmake-format: %s\n' "$CMAKE_FORMAT"
printf >&2 'Version: %s\n' "$CMAKE_FORMAT_VERSION"
printf >&2 'Please install `cmake-format` version 0.6.0\n'
printf >&2 'Please install `cmake-format` version 0.6.3\n'
exit 1
fi

@@ -121,7 +121,7 @@ RUN mkdir -p "${SHFMT_PATH}" \
&& chmod a+x shfmt

# cmake-format
RUN pip install cmake-format[yaml]==0.6
RUN pip install cmake-format[yaml]==0.6.3

# Coveralls
ENV COVERALLS_VIRTUALENV_PATH=/home/jenkins/coveralls
@@ -63,7 +63,7 @@ RUN apt-get update && apt-get -y install \
# Update cache for shared libraries
RUN ldconfig

RUN pip install cmake-format[yaml]==0.6
RUN pip install cmake-format[yaml]==0.6.3

# Google Test
ENV GTEST_ROOT=/opt/gtest
@@ -161,7 +161,7 @@ RUN mkdir -p "${SHFMT_PATH}" \
&& chmod a+x shfmt

# cmake-format
RUN pip install cmake-format[yaml]==0.6
RUN pip install cmake-format[yaml]==0.6.3

# Coveralls
ENV COVERALLS_VIRTUALENV_PATH=/home/jenkins/coveralls
@@ -82,7 +82,7 @@ Vagrant.configure("2") do |config|
apt-get -y upgrade
apt-get -y install curl build-essential autotools-dev automake cmake pkg-config doxygen graphviz bison ruby-dev python-dev python3-dev liblua5.2-dev tclcl-dev libaugeas-dev libyajl-dev libgit2-dev libboost-all-dev libssl-dev libcurl4-gnutls-dev libdbus-1-dev libpcre3-dev libpcre++-dev checkinstall vim valgrind clang-5.0 clang-format-5.0 htop zlib1g-dev git openjdk-8-jdk python-pip locales bison libpython3-dev liblua5.3-dev libxerces-c-dev swig
pip install cmake-format[yaml]==0.6
pip install cmake-format[yaml]==0.6.3
mkdir -p /opt/gtest \
&& cd /tmp \
@@ -14,16 +14,9 @@ target_link_libraries (elektraintercept-env elektra-kdb elektra-meta) # must be

set_target_properties (
elektraintercept-env
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION_GETENV}
CLEAN_DIRECT_OUTPUT
1
LINKER_LANGUAGE
CXX)
PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H" VERSION ${KDB_VERSION} SOVERSION ${SO_VERSION_GETENV} CLEAN_DIRECT_OUTPUT 1

LINKER_LANGUAGE CXX)

install (TARGETS elektraintercept-env DESTINATION lib${LIB_SUFFIX})

@@ -89,16 +89,9 @@ if (BUILD_SHARED)
set (elektra-all_LIBRARIES elektra-core elektra-kdb ${elektra-extension_LIBRARIES})
set_target_properties (
${elektra-all_LIBRARIES}
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION}
CLEAN_DIRECT_OUTPUT
1
LINK_DEPENDS
"${__symbols_file}")
PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H" VERSION ${KDB_VERSION} SOVERSION ${SO_VERSION} CLEAN_DIRECT_OUTPUT 1

LINK_DEPENDS "${__symbols_file}")

if (${LD_ACCEPTS_VERSION_SCRIPT})
set_target_properties (${elektra-all_LIBRARIES} PROPERTIES LINK_FLAGS "-Wl,--version-script='${__symbols_file}'")
@@ -113,7 +106,10 @@ if (BUILD_SHARED)
set (ELEKTRA_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${TARGET_PLUGIN_FOLDER}")
set_target_properties (${elektra-all_LIBRARIES} PROPERTIES INSTALL_RPATH "${ELEKTRA_RPATH}")

install (TARGETS elektra-core elektra-kdb DESTINATION lib${LIB_SUFFIX} EXPORT ElektraTargetsLibelektra)
install (
TARGETS elektra-core elektra-kdb
DESTINATION lib${LIB_SUFFIX}
EXPORT ElektraTargetsLibelektra)

list (APPEND targets_built ${elektra-all_LIBRARIES})
endif (BUILD_SHARED)
@@ -142,24 +138,16 @@ if (BUILD_FULL)
target_link_libraries (elektra-full ${elektra-full_LIBRARIES})

set_target_properties (
elektra-full
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H;ELEKTRA_STATIC"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION}
CLEAN_DIRECT_OUTPUT
1
LINKER_LANGUAGE
CXX
LINK_DEPENDS
"${__symbols_file}")
elektra-full PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H;ELEKTRA_STATIC" VERSION ${KDB_VERSION}
SOVERSION ${SO_VERSION} CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE CXX LINK_DEPENDS "${__symbols_file}")
if (${LD_ACCEPTS_VERSION_SCRIPT})
set_target_properties (elektra-full PROPERTIES LINK_FLAGS "-Wl,--version-script='${__symbols_file}'")
endif ()

install (TARGETS elektra-full DESTINATION lib${LIB_SUFFIX} EXPORT ElektraTargetsLibelektra)
install (
TARGETS elektra-full
DESTINATION lib${LIB_SUFFIX}
EXPORT ElektraTargetsLibelektra)

list (APPEND targets_built elektra-full)
endif (BUILD_FULL)
@@ -173,23 +161,17 @@ if (BUILD_STATIC)

set_target_properties (
elektra-static
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H;ELEKTRA_STATIC"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION}
CLEAN_DIRECT_OUTPUT
1
LINKER_LANGUAGE
CXX
LINK_DEPENDS
"${__symbols_file}")
PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H;ELEKTRA_STATIC" VERSION ${KDB_VERSION} SOVERSION ${SO_VERSION}

CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE CXX LINK_DEPENDS "${__symbols_file}")
if (${LD_ACCEPTS_VERSION_SCRIPT})
set_target_properties (elektra-static PROPERTIES LINK_FLAGS "-Wl,--version-script='${__symbols_file}'")
endif ()

install (TARGETS elektra-static DESTINATION lib${LIB_SUFFIX} EXPORT ElektraTargetsLibelektra)
install (
TARGETS elektra-static
DESTINATION lib${LIB_SUFFIX}
EXPORT ElektraTargetsLibelektra)

list (APPEND targets_built elektra-static)
endif (BUILD_STATIC)
@@ -27,16 +27,9 @@ if (BUILD_SHARED)

set_target_properties (
elektratools
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H;ELEKTRA_SHARED"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION_TOOLS}
CLEAN_DIRECT_OUTPUT
1
LINKER_LANGUAGE
CXX)
PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H;ELEKTRA_SHARED" VERSION ${KDB_VERSION} SOVERSION ${SO_VERSION_TOOLS}

CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE CXX)

if (${LD_ACCEPTS_VERSION_SCRIPT})
set_target_properties (elektratools PROPERTIES LINK_FLAGS "-Wl,--version-script='${__symbols_file}'")
@@ -52,16 +45,9 @@ if (BUILD_FULL)

set_target_properties (
elektratools-full
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H;ELEKTRA_STATIC"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION_TOOLS}
CLEAN_DIRECT_OUTPUT
1
LINKER_LANGUAGE
CXX)
PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H;ELEKTRA_STATIC" VERSION ${KDB_VERSION} SOVERSION ${SO_VERSION_TOOLS}

CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE CXX)

if (${LD_ACCEPTS_VERSION_SCRIPT})
set_target_properties (elektratools-full PROPERTIES LINK_FLAGS "-Wl,--version-script='${__symbols_file}'")
@@ -77,16 +63,9 @@ if (BUILD_STATIC)

set_target_properties (
elektratools-static
PROPERTIES COMPILE_DEFINITIONS
"HAVE_KDBCONFIG_H;ELEKTRA_STATIC"
VERSION
${KDB_VERSION}
SOVERSION
${SO_VERSION_TOOLS}
CLEAN_DIRECT_OUTPUT
1
LINKER_LANGUAGE
CXX)
PROPERTIES COMPILE_DEFINITIONS "HAVE_KDBCONFIG_H;ELEKTRA_STATIC" VERSION ${KDB_VERSION} SOVERSION ${SO_VERSION_TOOLS}

CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE CXX)

set_target_properties (elektratools-static PROPERTIES LINKER_LANGUAGE CXX)
if (${LD_ACCEPTS_VERSION_SCRIPT})
@@ -67,17 +67,20 @@ endmacro (do_test)
add_custom_target (
run_all
COMMAND "${CMAKE_BINARY_DIR}/scripts/dev/run_all" "$<CONFIGURATION>"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" USES_TERMINAL)
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
USES_TERMINAL)

add_custom_target (
run_checkshell
COMMAND "${CMAKE_BINARY_DIR}/scripts/dev/run_checkshell" "$<CONFIGURATION>"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" USES_TERMINAL)
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
USES_TERMINAL)

add_custom_target (
run_nocheckshell
COMMAND "${CMAKE_BINARY_DIR}/scripts/dev/run_nocheckshell" "$<CONFIGURATION>"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" USES_TERMINAL)
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
USES_TERMINAL)

add_custom_target (
run_nokdbtests

0 comments on commit 3999d92

Please sign in to comment.
You can’t perform that action at this time.