Skip to content

Commit

Permalink
clang-format / space in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonov548 committed Jun 1, 2024
1 parent 3fc4529 commit ff1a65d
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 316 deletions.
22 changes: 22 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Language: Cpp

BasedOnStyle: Google
BreakBeforeBraces: Custom
AllowShortIfStatementsOnASingleLine: Never
AllowAllConstructorInitializersOnNextLine: false
BreakConstructorInitializers: BeforeComma
KeepEmptyLinesAtTheStartOfBlocks: true
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
BeforeCatch: true
BeforeElse: true
SplitEmptyFunction: false
SplitEmptyNamespace: false
SplitEmptyRecord: false
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
run: |
set -e
cd podofo-js
emcmake cmake -S. -Bbuild -DOPENSSL_CRYPTO_LIBRARY=/usr/local/libx32/libcrypto.a -DOPENSSL_SSL_LIBRARY=/usr/local/libx32/libssl.a -DOPENSSL_INCLUDE_DIR=/usr/local/include/ -DLIBXML2_LIBRARY=/usr/local/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/usr/local/include/libxml2/ -DPODOFO_BUILD_STATIC=ON
emcmake cmake -S. -Bbuild -DOPENSSL_CRYPTO_LIBRARY=/usr/local/libx32/libcrypto.a -DOPENSSL_SSL_LIBRARY=/usr/local/libx32/libssl.a -DOPENSSL_INCLUDE_DIR=/usr/local/include/ -DLIBXML2_LIBRARY=/usr/local/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/usr/local/include/libxml2/
cmake --build build
cmake --build build --target test
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@ cmake_minimum_required(VERSION 3.16)

project(podofo.js)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

include(Misc)

option(ENABLE_TESTS "Enable tests" ON)

set(ALL_SOURCES
src/bind.cpp
)

set(PODOFO_BUILD_TEST OFF)
set(PODOFO_BUILD_STATIC ON)
add_subdirectory(podofo)

add_subdirectory(src)

add_subdirectory(tests)
if (ENABLE_TESTS)
add_subdirectory(tests)
endif()

add_clang_format_target()
17 changes: 17 additions & 0 deletions cmake/Misc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# clang-format support
function(add_clang_format_target)
if(NOT ${PROJECT_NAME}_CLANG_FORMAT_BINARY)
find_program(${PROJECT_NAME}_CLANG_FORMAT_BINARY clang-format)
endif()

message(STATUS ${ALL_SOURCES} ${ALL_HEADERS})

if(${PROJECT_NAME}_CLANG_FORMAT_BINARY)
add_custom_target(clang-format
COMMAND ${${PROJECT_NAME}_CLANG_FORMAT_BINARY} --verbose
-i ${ALL_SOURCES} ${ALL_HEADERS}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})

message(STATUS "Format the project using the `clang-format` target (i.e: cmake --build build --target clang-format).\n")
endif()
endfunction()
Loading

0 comments on commit ff1a65d

Please sign in to comment.