Skip to content

Commit

Permalink
Don't build languages in unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopey committed Nov 4, 2024
1 parent bf50680 commit 7fd5bbb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
-DUSE_TESTS=On \
-DUSE_SANITIZERS=On \
-DUSE_TOOLS=On \
-DBUILD_LANGUAGES=Off \
..
make -j $(getconf _NPROCESSORS_ONLN)
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OPTION(USE_TOOLS "Build tools" OFF)
OPTION(USE_SANITIZERS "Enable Asan and Ubsan" OFF)
OPTION(USE_TIDY "Use clang-tidy for checks" OFF)
OPTION(USE_FORMAT "Use clang-format for checks" OFF)
OPTION(BUILD_LANGUAGES "Build Language Files" ON)

set(USE_PCH ON)
# clang-tidy only works with clang when PCH is enabled
Expand Down Expand Up @@ -238,9 +239,10 @@ add_dependencies(openomf copy_shaders)

# Build tools if requested
set(TOOL_TARGET_NAMES)
# always build languagetool, for BuildLanguages.cmake
add_executable(languagetool tools/languagetool/main.c)
list(APPEND TOOL_TARGET_NAMES languagetool)
if(BUILD_LANGUAGES OR USE_TOOLS)
add_executable(languagetool tools/languagetool/main.c)
list(APPEND TOOL_TARGET_NAMES languagetool)
endif()
if (USE_TOOLS)
add_executable(bktool tools/bktool/main.c
tools/shared/animation_misc.c
Expand Down
13 changes: 10 additions & 3 deletions cmake-scripts/BuildLanguages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ file(WRITE "${BASE_TXT}" "${BASETXT_CONTENTS}")
message(STATUS "BuildLanguages LANG2_STR_COUNT: ${LANG2_STR_COUNT}")



if(NOT BUILD_LANGUAGES)
# early out, having written generated_languages.h
return()
endif()


if(WIN32)
set(LANGUAGE_INSTALL_PATH "openomf/resources/")
else()
Expand All @@ -58,7 +65,7 @@ foreach(LANG ${OMF_LANGS})
set(LNG "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.LNG")
find_file("${LANG}_DAT" "${LANG}.DAT" PATHS "${CMAKE_CURRENT_BINARY_DIR}/resources" "${PROJECT_SOURCE_DIR}/resources" REQUIRED)
set(BASE_DAT "${${LANG}_DAT}")
list(APPEND BUILD_LANG_SORUCES "${TXT2}")
list(APPEND BUILD_LANG_SOURCES "${TXT2}")
list(APPEND BUILD_LANG_COMMANDS
DEPENDS "${TXT2}"
BYPRODUCTS "${LNG}"
Expand All @@ -72,7 +79,7 @@ foreach(LANG ${OPENOMF_LANGS})
set(TXT2 "${PROJECT_SOURCE_DIR}/resources/${LANG}2.TXT")
set(DAT "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.DAT")
set(LNG "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.LNG")
list(APPEND BUILD_LANG_SORUCES "${TXT}" "${TXT2}")
list(APPEND BUILD_LANG_SOURCES "${TXT}" "${TXT2}")
list(APPEND BUILD_LANG_COMMANDS
DEPENDS "${TXT}" "${TXT2}"
BYPRODUCTS "${DAT}" "{LNG}"
Expand All @@ -91,6 +98,6 @@ add_custom_target(build_languages
${BUILD_LANG_COMMANDS}
COMMAND ${CMAKE_COMMAND} -E echo "done"
)
target_sources(build_languages PRIVATE ${BUILD_LANG_SORUCES})
target_sources(build_languages PRIVATE ${BUILD_LANG_SOURCES})
add_dependencies(openomf build_languages)
add_dependencies(build_languages languagetool)

0 comments on commit 7fd5bbb

Please sign in to comment.