Skip to content

Commit

Permalink
style(autofix.ci): automated formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Oct 17, 2023
1 parent 9e56d53 commit 00302db
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 78 deletions.
53 changes: 27 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ cmake_minimum_required(VERSION 3.21)

project(CataclysmBN)

list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMakeModules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
if (NOT VCPKG_MANIFEST_MODE)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMakeModules/Find)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/Find)
endif ()

include(AstyleFormatSource)

Expand Down Expand Up @@ -117,9 +115,9 @@ include(CheckCXXCompilerFlag)
#SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -m32")

if (NOT DYNAMIC_LINKING)
if(NOT MSVC)
if (NOT MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dll.a")
endif()
endif ()
set(BUILD_SHARED_LIBRARIES OFF)
check_cxx_compiler_flag(-static HAVE_STATIC_FLAG)
if (HAVE_STATIC_FLAG)
Expand Down Expand Up @@ -221,10 +219,8 @@ else ()
AND NOT WIN32
AND USE_PREFIX_DATA_DIR)
add_definitions(-DPREFIX=${CMAKE_INSTALL_PREFIX})
configure_file(
"${CMAKE_SOURCE_DIR}/src/prefix.h.in"
"${CMAKE_SOURCE_DIR}/src/prefix.h"
@ONLY)
configure_file("${CMAKE_SOURCE_DIR}/src/prefix.h.in" "${CMAKE_SOURCE_DIR}/src/prefix.h"
@ONLY)
add_definitions(-DDATA_DIR_PREFIX)
endif ()
endif ()
Expand Down Expand Up @@ -271,11 +267,11 @@ else ()
-Wunused-macros \
-Wzero-as-null-pointer-constant \
-Wno-range-loop-analysis")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CATA_WARNINGS "${CATA_WARNINGS} -Wno-unknown-warning-option")
else()
set(CATA_WARNINGS "${CATA_WARNINGS} -Wno-unknown-warning")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CATA_WARNINGS "${CATA_WARNINGS} -Wno-unknown-warning-option")
else ()
set(CATA_WARNINGS "${CATA_WARNINGS} -Wno-unknown-warning")
endif ()
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(CATA_WARNINGS "${CATA_WARNINGS} -Wredundant-decls")
endif ()
Expand Down Expand Up @@ -330,7 +326,10 @@ if (TILES)

message(STATUS "Searching for SDL2_TTF library --")
find_package(SDL2_ttf)
if (NOT (SDL2_TTF_FOUND OR TARGET SDL2_ttf::SDL2_ttf OR TARGET SDL2_ttf::SDL2_ttf-static))
if (NOT
(SDL2_TTF_FOUND
OR TARGET SDL2_ttf::SDL2_ttf
OR TARGET SDL2_ttf::SDL2_ttf-static))
message(
FATAL_ERROR
"This project requires SDL2_ttf to be installed to be compiled in graphical mode. \
Expand All @@ -340,11 +339,11 @@ if (TILES)
endif ()

message(STATUS "Searching for SDL2_image library --\n")
if(VCPKG_MANIFEST_MODE)
if (VCPKG_MANIFEST_MODE)
find_package(sdl2-image)
else()
else ()
find_package(SDL2_image)
endif()
endif ()
if (NOT (SDL2_IMAGE_FOUND OR TARGET SDL2::SDL2_image))
message(
FATAL_ERROR
Expand Down Expand Up @@ -387,21 +386,23 @@ if (SOUND)
# Sound requires SDL_mixer library
message(STATUS "Searching for SDL2_mixer library --\n")
find_package(SDL2_mixer)
if(VCPKG_MANIFEST_MODE)
if (VCPKG_MANIFEST_MODE)
if (NOT TARGET SDL2_mixer::SDL2_mixer-static) # TODO x64-mingw-static
message(FATAL_ERROR
message(
FATAL_ERROR
"You need the SDL2_mixer development library \
to be able to compile with sound enabled. \
See CMake compiling guide for details and more info.")
endif()
else()
endif ()
else ()
if (NOT SDL2_MIXER_FOUND)
message(FATAL_ERROR
message(
FATAL_ERROR
"You need the SDL2_mixer development library \
to be able to compile with sound enabled. \
See CMake compiling guide for details and more info.")
endif ()
endif()
endif ()
endif ()

if (BACKTRACE)
Expand Down
15 changes: 6 additions & 9 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ if (SOUND)
set(CATACLYSM_DATA_DIRS ${CATACLYSM_DATA_DIRS} ${CMAKE_SOURCE_DIR}/data/sound)
endif ()

set(CATACLYSM_DATA_FILES
${CMAKE_SOURCE_DIR}/data/changelog.txt
${CMAKE_SOURCE_DIR}/data/cataicon.ico)
set(CATACLYSM_DATA_FILES ${CMAKE_SOURCE_DIR}/data/changelog.txt
${CMAKE_SOURCE_DIR}/data/cataicon.ico)

if (RELEASE)
install(DIRECTORY ${CATACLYSM_DATA_DIRS} DESTINATION ${DATA_PREFIX})
install(FILES ${CATACLYSM_DATA_FILES} DESTINATION ${DATA_PREFIX})
install(FILES
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/LICENSE.txt
${CMAKE_SOURCE_DIR}/LICENSE-OFL-Terminus-Font.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/LICENSE.txt
${CMAKE_SOURCE_DIR}/LICENSE-OFL-Terminus-Font.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc DESTINATION ${CMAKE_INSTALL_PREFIX})
if (TILES)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/gfx DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
endif ()
endif ()
57 changes: 25 additions & 32 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ if (TILES)
target_link_libraries(cataclysm-tiles cataclysm-tiles-common)
target_compile_definitions(cataclysm-tiles-common PUBLIC TILES)

if(NOT "${CMAKE_EXPORT_COMPILE_COMMANDS}")
if (NOT "${CMAKE_EXPORT_COMPILE_COMMANDS}")
target_precompile_headers(cataclysm-tiles-common PUBLIC
${CMAKE_SOURCE_DIR}/pch/main-pch.hpp)
${CMAKE_SOURCE_DIR}/pch/main-pch.hpp)
endif ()

if (CMAKE_USE_PTHREADS_INIT)
Expand All @@ -74,43 +74,36 @@ if (TILES)

if (NOT DYNAMIC_LINKING)
# SDL, SDL_Image, SDL_ttf deps are required for static build
target_include_directories(cataclysm-tiles-common PUBLIC
${FREETYPE_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${JPEG_INCLUDE_DIR}
${BZIP2_INCLUDE_DIR})
target_link_libraries(cataclysm-tiles-common PUBLIC
${FREETYPE_LIBRARIES}
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${BZIP2_LIBRARIES})
target_include_directories(
cataclysm-tiles-common PUBLIC ${FREETYPE_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS}
${JPEG_INCLUDE_DIR} ${BZIP2_INCLUDE_DIR})
target_link_libraries(cataclysm-tiles-common PUBLIC ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES}
${JPEG_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(cataclysm-tiles-common PUBLIC SDL2::SDL2-static)
endif ()
target_include_directories(cataclysm-tiles-common PUBLIC
${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIRS}
${SDL2_TTF_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS})
target_link_libraries(cataclysm-tiles-common PUBLIC
${SDL2_LIBRARY}
${SDL2_IMAGE_LIBRARIES}
${SDL2_TTF_LIBRARIES}
${ZLIB_LIBRARIES})
if(TARGET SDL2::SDL2)
target_link_libraries(cataclysm-tiles-common PUBLIC SDL2::SDL2
SDL2::SDL2main
SDL2::SDL2_image
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>)
endif()
target_include_directories(
cataclysm-tiles-common PUBLIC ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS}
${SDL2_TTF_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(cataclysm-tiles-common PUBLIC ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARIES}
${SDL2_TTF_LIBRARIES} ${ZLIB_LIBRARIES})
if (TARGET SDL2::SDL2)
target_link_libraries(
cataclysm-tiles-common
PUBLIC
SDL2::SDL2
SDL2::SDL2main
SDL2::SDL2_image
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
)
endif ()
if (SOUND)
if (VCPKG_MANIFEST_MODE)
find_package(Ogg REQUIRED)
find_package(Vorbis REQUIRED)
target_link_libraries(cataclysm-tiles-common PUBLIC SDL2_mixer::SDL2_mixer-static
Ogg::ogg
Vorbis::vorbis)
endif()
target_compile_definitions(cataclysm-tiles-common PUBLIC SDL_SOUND )
Ogg::ogg Vorbis::vorbis)
endif ()
target_compile_definitions(cataclysm-tiles-common PUBLIC SDL_SOUND)
target_include_directories(cataclysm-tiles-common PUBLIC ${OGGVORBIS_INCLUDE_DIR})
target_link_libraries(cataclysm-tiles-common PUBLIC ${OGG_LIBRARY})
target_link_libraries(cataclysm-tiles-common PUBLIC ${VORBIS_LIBRARY})
Expand Down
17 changes: 6 additions & 11 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ if (BUILD_TESTING)
add_definitions(-DCATCH_CONFIG_ENABLE_BENCHMARKING)

# TODO: build MO files required for tests
if(MSVC)
find_program(GETTEXT_MSGFMT_EXECUTABLE
msgfmt.exe
HINTS
C:\\msys64\\usr\\bin
C:\\Prorogram\ Files\\Git\\mingw64\\bin
REQUIRED
)
else()
set(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
endif()
if (MSVC)
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt.exe
HINTS C:\\msys64\\usr\\bin C:\\Prorogram\ Files\\Git\\mingw64\\bin REQUIRED)
else ()
set(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
endif ()

if (TILES)
add_executable(cata_test-tiles ${CATACLYSM_BN_TEST_SOURCES})
Expand Down

0 comments on commit 00302db

Please sign in to comment.