File: CMakeLists.txt

package info (click to toggle)
simdutf 8.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,524 kB
  • sloc: cpp: 64,498; ansic: 15,347; python: 3,592; sh: 366; makefile: 12
file content (47 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

cmake_minimum_required(VERSION 3.15)

project(simdutf_demo_install VERSION 0.1.0 LANGUAGES CXX)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)

FetchContent_Declare(
  simdutf
  GIT_REPOSITORY git@github.com:simdutf/simdutf.git
  GIT_SHALLOW TRUE
  GIT_TAG tags/v3.2.7
  )
FetchContent_MakeAvailable(simdutf)

file(WRITE main.cpp "
#include <iostream>
#include \"simdutf.h\"
int main(int argc, char *argv[]) {
   const char * ascii = \"1234\";
   bool validutf8 = simdutf::validate_utf8(ascii, 4);
   if(validutf8) {
       std::cout << \"valid UTF-8\" << std::endl;
   } else {
       std::cout << \"invalid UTF-8\" << std::endl;
       return EXIT_FAILURE;
   }
   char16_t utf16_output[4];
   // convert to UTF-16LE
   size_t utf16words = simdutf::convert_utf8_to_utf16le(ascii, 4, utf16_output);
   std::cout << \"wrote \" << utf16words << \" UTF-16 code units.\" << std::endl;
   // It wrote utf16words * sizeof(char16_t) bytes.
   //
   // convert it back:
   char buffer[4];
   size_t utf8words = simdutf::convert_utf16le_to_utf8(utf16_output, utf16words, buffer);
   std::cout << \"wrote \" << utf8words << \" UTF-8 code units.\" << std::endl;
   return EXIT_SUCCESS;
}")



add_executable(repro main.cpp)
target_link_libraries(repro PUBLIC simdutf::simdutf)