xref: /reactos/sdk/tools/wpp/CMakeLists.txt (revision 3e1f4074)
1
2if(MSVC)
3    if(MSVC_VERSION LESS 1900)
4        add_definitions(
5            -Dsnprintf=_snprintf
6            -Dstrtoull=_strtoui64
7            -Dstrtoll=_strtoi64)
8
9        # Add this definition for WDK only, VS 9 doesn't like that
10        if(DEFINED ENV{DDKBUILDENV})
11            add_definitions(-Dvsnprintf=_vsnprintf)
12        endif()
13    endif()
14
15    # Disable warnings
16    add_compile_options(
17        /wd4146  # "unary minus operator applied to unsigned type, result still unsigned"
18        /wd4244) # "'=': conversion from 'a' to 'b', possible loss of data"
19
20endif()
21
22if(CMAKE_CROSSCOMPILING)
23    add_definitions(
24        -D_DLL -D__USE_CRTIMP
25        -D__NO_ISOCEXT
26        -Dstrtoull=_strtoui64
27        -Dstrtoll=_strtoi64
28        -Dopen=_open
29        -Dclose=_close)
30    include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
31endif()
32
33FLEX_TARGET(pp_scanner ppl.l ${CMAKE_CURRENT_BINARY_DIR}/ppl.yy.c)
34BISON_TARGET(pp_parser ppy.y ${CMAKE_CURRENT_BINARY_DIR}/ppy.tab.c COMPILE_FLAGS "-p ppy_")
35ADD_FLEX_BISON_DEPENDENCY(pp_scanner pp_parser)
36
37list(APPEND SOURCE
38    preproc.c
39    wpp.c)
40
41if(CMAKE_CROSSCOMPILING)
42    add_library(wpp ${SOURCE} ${FLEX_pp_scanner_OUTPUT_SOURCE} ${BISON_pp_parser_OUTPUT_SOURCE})
43else()
44    add_library(wpphost ${SOURCE} ${FLEX_pp_scanner_OUTPUTS} ${BISON_pp_parser_OUTPUTS})
45    target_link_libraries(wpphost PRIVATE host_includes)
46endif()
47