From 0c710654a5000083f11a069689340d2662f6443c Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 7 Oct 2022 23:53:12 +0300 Subject: [PATCH 1/5] Add CMake support --- .gitignore | 2 + CMakeLists.txt | 188 +++++++++++++++++++++++++++++++++++++++++ cmake/BuildTypes.cmake | 54 ++++++++++++ cmake/GitVars.cmake | 22 +++++ tests/CMakeLists.txt | 0 5 files changed, 266 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/BuildTypes.cmake create mode 100644 cmake/GitVars.cmake create mode 100644 tests/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 841237a10ea..23b28c178d8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ sync.sh main stream *.o +.cache +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..e45c4c3955b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,188 @@ +cmake_minimum_required (VERSION 3.0) +project(whisper.cpp VERSION 0.1.0) + +set(CMAKE_EXPORT_COMPILE_COMMANDS "on") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(WHISPER_STANDALONE ON) + include(cmake/GitVars.cmake) + include(cmake/BuildTypes.cmake) +else() + set(WHISPER_STANDALONE OFF) +endif() + +# options + +option(WHISPER_ALL_WARNINGS "whisper: enable all compiler warnings" ON) +option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF) + +option(WHISPER_SANITIZE_THREAD "whisper: enable thread sanitizer" OFF) +option(WHISPER_SANITIZE_ADDRESS "whisper: enable address sanitizer" OFF) +option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF) + +option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE}) + +option(WHISPER_SUPPORT_SDL2 "whisper: support for libSDL2" OFF) + +# sanitizers + +if (WHISPER_SANITIZE_THREAD) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread") +endif() + +if (WHISPER_SANITIZE_ADDRESS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") +endif() + +if (WHISPER_SANITIZE_UNDEFINED) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") +endif() + +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math") +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") + +# dependencies + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 11) + +find_package(Threads REQUIRED) + +if (WHISPER_SUPPORT_SDL2) + # SDL2 + + find_package(SDL2 REQUIRED) + + string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) + + message(STATUS "SDL2_INCLUDE_DIRS = ${SDL2_INCLUDE_DIRS}") + message(STATUS "SDL2_LIBRARIES = ${SDL2_LIBRARIES}") +endif() + +# main + +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo") +endif () + +if (WHISPER_ALL_WARNINGS) + if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ + -Wall \ + -Wextra \ + -Wpedantic \ + -Wshadow \ + -Wcast-qual \ + -Wstrict-prototypes \ + -Wpointer-arith \ + ") + else() + # todo : windows + endif() +endif() + +# compiler flags + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla") +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -ffinite-math-only -funsafe-math-optimizations") + +message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") + +if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") + message(STATUS "ARM detected") +else() + message(STATUS "x86 detected") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx -mavx2 -mfma -mf16c") +endif() + +# ggml + +set(TARGET ggml) + +add_library(${TARGET} STATIC + ggml.c + ) + +target_include_directories(${TARGET} PUBLIC + . + ) + +target_link_libraries(${TARGET} PRIVATE m ${CMAKE_THREAD_LIBS_INIT}) + +if (BUILD_SHARED_LIBS) + target_link_libraries(${TARGET} PUBLIC + ${CMAKE_DL_LIBS} + ) + + target_compile_definitions(${TARGET} PUBLIC + WHISPER_SHARED + ) +endif() + +target_compile_definitions(${TARGET} PUBLIC + ${WHISPER_EXTRA_FLAGS} + ) + +# whisper + +set(TARGET whisper) + +add_library(${TARGET} SHARED + whisper.cpp + ) + +target_include_directories(${TARGET} PUBLIC + . + ) + +target_link_libraries(${TARGET} PRIVATE ggml ${CMALE_THREAD_LIBS_INIT}) + +if (BUILD_SHARED_LIBS) + target_link_libraries(${TARGET} PUBLIC + ${CMAKE_DL_LIBS} + ) + + target_compile_definitions(${TARGET} PUBLIC + WHISPER_SHARED + ) +endif() + +target_compile_definitions(${TARGET} PUBLIC + ${WHISPER_EXTRA_FLAGS} + ) + +install(TARGETS ${TARGET} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static + ) + +# main + +set(TARGET main) + +add_executable(${TARGET} main.cpp) + +target_link_libraries(${TARGET} PRIVATE whisper) + +# stream + +set(TARGET stream) + +add_executable(${TARGET} stream.cpp) + +target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS}) + +target_link_libraries(${TARGET} PRIVATE whisper ${SDL2_LIBRARIES}) + +# tests + +if (WHISPER_BUILD_TESTS) + enable_testing() + add_subdirectory(tests) +endif () diff --git a/cmake/BuildTypes.cmake b/cmake/BuildTypes.cmake new file mode 100644 index 00000000000..a9c7b6c91ec --- /dev/null +++ b/cmake/BuildTypes.cmake @@ -0,0 +1,54 @@ +# Add new build types + +# ReleaseGG - Release with enabled asserts + +SET(CMAKE_CXX_FLAGS_RELEASEGG + "-O3" + CACHE STRING "Flags used by the c++ compiler during release builds with enabled asserts." + FORCE ) +SET(CMAKE_C_FLAGS_RELEASEGG + "-O3" + CACHE STRING "Flags used by the compiler during release builds with enabled asserts." + FORCE ) +SET(CMAKE_EXE_LINKER_FLAGS_RELEASEGG + "" + CACHE STRING "Flags used for linking binaries during release builds with enabled asserts." + FORCE ) +SET(CMAKE_SHARED_LINKER_FLAGS_RELEASEGG + "" + CACHE STRING "Flags used by the shared libraries linker during release builds with enabled asserts." + FORCE ) +MARK_AS_ADVANCED( + CMAKE_CXX_FLAGS_RELEASEGG + CMAKE_C_FLAGS_RELEASEGG + CMAKE_EXE_LINKER_FLAGS_RELEASEGG + CMAKE_SHARED_LINKER_FLAGS_RELEASEGG ) + +# RelWithDebInfoGG - RelWithDebInfo with enabled asserts + +SET(CMAKE_CXX_FLAGS_RELWITHDEBINFOGG + "-O2 -g" + CACHE STRING "Flags used by the c++ compiler during release builds with debug symbols and enabled asserts." + FORCE ) +SET(CMAKE_C_FLAGS_RELWITHDEBINFOGG + "-O2 -g" + CACHE STRING "Flags used by the compiler during release builds with debug symbols and enabled asserts." + FORCE ) +SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFOGG + "" + CACHE STRING "Flags used for linking binaries during release builds with debug symbols and enabled asserts." + FORCE ) +SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFOGG + "" + CACHE STRING "Flags used by the shared libraries linker during release builds with debug symbols and enabled asserts." + FORCE ) +MARK_AS_ADVANCED( + CMAKE_CXX_FLAGS_RELWITHDEBINFOGG + CMAKE_C_FLAGS_RELWITHDEBINFOGG + CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFOGG + CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFOGG ) + +if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ReleaseGG" "RelWithDebInfoGG") +endif() diff --git a/cmake/GitVars.cmake b/cmake/GitVars.cmake new file mode 100644 index 00000000000..1a4c24ebf6a --- /dev/null +++ b/cmake/GitVars.cmake @@ -0,0 +1,22 @@ +find_package(Git) + +# the commit's SHA1 +execute_process(COMMAND + "${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=8 + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_SHA1 + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + +# the date of the commit +execute_process(COMMAND + "${GIT_EXECUTABLE}" log -1 --format=%ad --date=local + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_DATE + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + +# the subject of the commit +execute_process(COMMAND + "${GIT_EXECUTABLE}" log -1 --format=%s + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_COMMIT_SUBJECT + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000000..e69de29bb2d From 90513c3ac44453fddefbab7b5f1aafb688e8e979 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 8 Oct 2022 00:14:05 +0300 Subject: [PATCH 2/5] whisper : fix bug in token sampling logic Could overflow buffer --- whisper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whisper.cpp b/whisper.cpp index 9913ab6abc2..cb15b986844 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2470,7 +2470,7 @@ int whisper_full( result_all.push_back({ t0, t1, text }); } text = ""; - while (result_cur[i].id > whisper_token_beg(ctx) && i < (int) result_cur.size()) { + while (i < (int) result_cur.size() && result_cur[i].id > whisper_token_beg(ctx)) { i++; } i--; From 76bc3fecb224e40573d97aa3d2293d9a8d3f2b20 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 8 Oct 2022 00:14:34 +0300 Subject: [PATCH 3/5] ci : add cmake builds --- .github/workflows/build.yml | 79 ++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a91f8f49c4..effa8db3226 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: run: | sudo apt-get update sudo apt-get install build-essential - sudo apt-get install libsdl2-dev; + sudo apt-get install libsdl2-dev - name: Build run: | @@ -36,3 +36,80 @@ jobs: run: | make make stream + + ubuntu-latest-gcc: + runs-on: ubuntu-latest + + strategy: + matrix: + build: [Debug, Release] + + steps: + - name: Clone + uses: actions/checkout@v1 + + - name: Dependencies + run: | + sudo apt-get update + sudo apt-get install build-essential + sudo apt-get install cmake + sudo apt-get install libsdl2-dev + + - name: Configure + run: cmake . -DWHISPER_SUPPORT_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} + + - name: Build + run: | + make + ctest --output-on-failure + + ubuntu-latest-clang: + runs-on: ubuntu-latest + + strategy: + matrix: + build: [Debug, Release] + + steps: + - name: Clone + uses: actions/checkout@v1 + + - name: Dependencies + run: | + sudo apt-get update + sudo apt-get install build-essential + sudo apt-get install cmake + sudo apt-get install libsdl2-dev + + - name: Configure + run: cmake . -DWHISPER_SUPPORT_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang + + - name: Build + run: | + make + ctest --output-on-failure + + ubuntu-latest-gcc-sanitized: + runs-on: ubuntu-latest + + strategy: + matrix: + sanitizer: [ADDRESS, THREAD, UNDEFINED] + + steps: + - name: Clone + uses: actions/checkout@v1 + + - name: Dependencies + run: | + sudo apt-get update + sudo apt-get install build-essential + sudo apt-get install cmake + + - name: Configure + run: cmake . -DCMAKE_BUILD_TYPE=Debug -DWHISPER_SANITIZE_${{ matrix.sanitizer }}=ON + + - name: Build + run: | + make + ctest --output-on-failure From 378d3e8a74c2f3901704b6b8898ecc60f8d8c500 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 8 Oct 2022 00:21:16 +0300 Subject: [PATCH 4/5] cmake : fixes --- CMakeLists.txt | 72 ++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e45c4c3955b..7f238aca32a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,39 +101,12 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx -mavx2 -mfma -mf16c") endif() -# ggml - -set(TARGET ggml) - -add_library(${TARGET} STATIC - ggml.c - ) - -target_include_directories(${TARGET} PUBLIC - . - ) - -target_link_libraries(${TARGET} PRIVATE m ${CMAKE_THREAD_LIBS_INIT}) - -if (BUILD_SHARED_LIBS) - target_link_libraries(${TARGET} PUBLIC - ${CMAKE_DL_LIBS} - ) - - target_compile_definitions(${TARGET} PUBLIC - WHISPER_SHARED - ) -endif() - -target_compile_definitions(${TARGET} PUBLIC - ${WHISPER_EXTRA_FLAGS} - ) - # whisper set(TARGET whisper) add_library(${TARGET} SHARED + ggml.c whisper.cpp ) @@ -141,7 +114,7 @@ target_include_directories(${TARGET} PUBLIC . ) -target_link_libraries(${TARGET} PRIVATE ggml ${CMALE_THREAD_LIBS_INIT}) +target_link_libraries(${TARGET} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) if (BUILD_SHARED_LIBS) target_link_libraries(${TARGET} PUBLIC @@ -162,27 +135,22 @@ install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/static ) -# main - -set(TARGET main) - -add_executable(${TARGET} main.cpp) - -target_link_libraries(${TARGET} PRIVATE whisper) - -# stream - -set(TARGET stream) - -add_executable(${TARGET} stream.cpp) - -target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS}) - -target_link_libraries(${TARGET} PRIVATE whisper ${SDL2_LIBRARIES}) - -# tests - -if (WHISPER_BUILD_TESTS) - enable_testing() - add_subdirectory(tests) +if (WHISPER_STANDALONE) + # main + set(TARGET main) + add_executable(${TARGET} main.cpp) + target_link_libraries(${TARGET} PRIVATE whisper ${CMAKE_THREAD_LIBS_INIT}) + + if (WHISPER_SUPPORT_SDL2) + # stream + set(TARGET stream) + add_executable(${TARGET} stream.cpp) + target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(${TARGET} PRIVATE whisper ${SDL2_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + endif () + + if (WHISPER_BUILD_TESTS) + enable_testing() + add_subdirectory(tests) + endif () endif () From abb73fc9af6a1994da11f3439e2948f9836b4885 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 8 Oct 2022 09:00:59 +0300 Subject: [PATCH 5/5] Cleanup CMakeLists.txt --- CMakeLists.txt | 17 ++++++------- cmake/BuildTypes.cmake | 54 ------------------------------------------ cmake/GitVars.cmake | 22 ----------------- 3 files changed, 7 insertions(+), 86 deletions(-) delete mode 100644 cmake/BuildTypes.cmake delete mode 100644 cmake/GitVars.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f238aca32a..e494e7c0e32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.0) -project(whisper.cpp VERSION 0.1.0) +project(whisper.cpp VERSION 1.0.0) set(CMAKE_EXPORT_COMPILE_COMMANDS "on") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -7,8 +7,6 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(WHISPER_STANDALONE ON) - include(cmake/GitVars.cmake) - include(cmake/BuildTypes.cmake) else() set(WHISPER_STANDALONE OFF) endif() @@ -22,7 +20,7 @@ option(WHISPER_SANITIZE_THREAD "whisper: enable thread sanitizer" OFF) option(WHISPER_SANITIZE_ADDRESS "whisper: enable address sanitizer" OFF) option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF) -option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE}) +option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE}) option(WHISPER_SUPPORT_SDL2 "whisper: support for libSDL2" OFF) @@ -55,7 +53,6 @@ find_package(Threads REQUIRED) if (WHISPER_SUPPORT_SDL2) # SDL2 - find_package(SDL2 REQUIRED) string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) @@ -64,7 +61,7 @@ if (WHISPER_SUPPORT_SDL2) message(STATUS "SDL2_LIBRARIES = ${SDL2_LIBRARIES}") endif() -# main +# compiler flags if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) @@ -87,8 +84,6 @@ if (WHISPER_ALL_WARNINGS) endif() endif() -# compiler flags - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla") #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -ffinite-math-only -funsafe-math-optimizations") @@ -101,11 +96,11 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx -mavx2 -mfma -mf16c") endif() -# whisper +# whisper - this is the main library of the project set(TARGET whisper) -add_library(${TARGET} SHARED +add_library(${TARGET} ggml.c whisper.cpp ) @@ -135,6 +130,8 @@ install(TARGETS ${TARGET} ARCHIVE DESTINATION lib/static ) +# programs, examples and tests + if (WHISPER_STANDALONE) # main set(TARGET main) diff --git a/cmake/BuildTypes.cmake b/cmake/BuildTypes.cmake deleted file mode 100644 index a9c7b6c91ec..00000000000 --- a/cmake/BuildTypes.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Add new build types - -# ReleaseGG - Release with enabled asserts - -SET(CMAKE_CXX_FLAGS_RELEASEGG - "-O3" - CACHE STRING "Flags used by the c++ compiler during release builds with enabled asserts." - FORCE ) -SET(CMAKE_C_FLAGS_RELEASEGG - "-O3" - CACHE STRING "Flags used by the compiler during release builds with enabled asserts." - FORCE ) -SET(CMAKE_EXE_LINKER_FLAGS_RELEASEGG - "" - CACHE STRING "Flags used for linking binaries during release builds with enabled asserts." - FORCE ) -SET(CMAKE_SHARED_LINKER_FLAGS_RELEASEGG - "" - CACHE STRING "Flags used by the shared libraries linker during release builds with enabled asserts." - FORCE ) -MARK_AS_ADVANCED( - CMAKE_CXX_FLAGS_RELEASEGG - CMAKE_C_FLAGS_RELEASEGG - CMAKE_EXE_LINKER_FLAGS_RELEASEGG - CMAKE_SHARED_LINKER_FLAGS_RELEASEGG ) - -# RelWithDebInfoGG - RelWithDebInfo with enabled asserts - -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFOGG - "-O2 -g" - CACHE STRING "Flags used by the c++ compiler during release builds with debug symbols and enabled asserts." - FORCE ) -SET(CMAKE_C_FLAGS_RELWITHDEBINFOGG - "-O2 -g" - CACHE STRING "Flags used by the compiler during release builds with debug symbols and enabled asserts." - FORCE ) -SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFOGG - "" - CACHE STRING "Flags used for linking binaries during release builds with debug symbols and enabled asserts." - FORCE ) -SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFOGG - "" - CACHE STRING "Flags used by the shared libraries linker during release builds with debug symbols and enabled asserts." - FORCE ) -MARK_AS_ADVANCED( - CMAKE_CXX_FLAGS_RELWITHDEBINFOGG - CMAKE_C_FLAGS_RELWITHDEBINFOGG - CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFOGG - CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFOGG ) - -if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ReleaseGG" "RelWithDebInfoGG") -endif() diff --git a/cmake/GitVars.cmake b/cmake/GitVars.cmake deleted file mode 100644 index 1a4c24ebf6a..00000000000 --- a/cmake/GitVars.cmake +++ /dev/null @@ -1,22 +0,0 @@ -find_package(Git) - -# the commit's SHA1 -execute_process(COMMAND - "${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=8 - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - OUTPUT_VARIABLE GIT_SHA1 - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - -# the date of the commit -execute_process(COMMAND - "${GIT_EXECUTABLE}" log -1 --format=%ad --date=local - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - OUTPUT_VARIABLE GIT_DATE - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - -# the subject of the commit -execute_process(COMMAND - "${GIT_EXECUTABLE}" log -1 --format=%s - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - OUTPUT_VARIABLE GIT_COMMIT_SUBJECT - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)