2016-02-01 22:26:01 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.5)
|
2015-08-05 22:23:15 +00:00
|
|
|
|
2016-02-01 22:26:01 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
|
|
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
|
|
|
endif()
|
2015-08-05 22:23:15 +00:00
|
|
|
|
2015-11-24 22:01:37 +00:00
|
|
|
project(zig CXX)
|
2015-08-05 22:23:15 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
|
|
|
|
2015-08-05 22:46:40 +00:00
|
|
|
set(ZIG_VERSION_MAJOR 0)
|
2015-08-05 22:23:15 +00:00
|
|
|
set(ZIG_VERSION_MINOR 0)
|
|
|
|
set(ZIG_VERSION_PATCH 0)
|
|
|
|
set(ZIG_VERSION "${ZIG_VERSION_MAJOR}.${ZIG_VERSION_MINOR}.${ZIG_VERSION_PATCH}")
|
|
|
|
message("Configuring zig version ${ZIG_VERSION}")
|
|
|
|
|
2016-02-11 08:33:27 +00:00
|
|
|
set(ZIG_LIBC_LIB_DIR "" CACHE STRING "Default native target libc directory where crt1.o can be found")
|
|
|
|
set(ZIG_LIBC_STATIC_LIB_DIR "" CACHE STRING "Default native target libc directory where crtbeginT.o can be found")
|
|
|
|
set(ZIG_LIBC_INCLUDE_DIR "/usr/include" CACHE STRING "Default native target libc include directory")
|
|
|
|
set(ZIG_DYNAMIC_LINKER "" CACHE STRING "Override dynamic linker for native target")
|
2017-03-13 17:11:55 +00:00
|
|
|
set(ZIG_EACH_LIB_RPATH off CACHE BOOL "Add each dynamic library to rpath for native target")
|
2016-02-11 08:33:27 +00:00
|
|
|
|
2016-04-23 16:57:38 +00:00
|
|
|
option(ZIG_TEST_COVERAGE "Build Zig with test coverage instrumentation" OFF)
|
|
|
|
|
2016-02-11 08:33:27 +00:00
|
|
|
|
|
|
|
|
2015-08-05 22:23:15 +00:00
|
|
|
find_package(llvm)
|
2016-02-15 22:50:06 +00:00
|
|
|
include_directories(${LLVM_INCLUDE_DIR})
|
2015-11-25 18:23:25 +00:00
|
|
|
link_directories(${LLVM_LIBDIRS})
|
2015-08-05 22:23:15 +00:00
|
|
|
|
2016-01-19 04:28:54 +00:00
|
|
|
find_package(clang)
|
2016-01-27 07:01:49 +00:00
|
|
|
include_directories(${CLANG_INCLUDE_DIRS})
|
2016-01-19 04:28:54 +00:00
|
|
|
|
2017-03-13 15:54:56 +00:00
|
|
|
find_package(lld)
|
|
|
|
include_directories(${LLD_INCLUDE_DIRS})
|
|
|
|
|
2017-03-30 05:18:12 +00:00
|
|
|
find_package(Threads)
|
|
|
|
|
2015-08-05 22:46:40 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
)
|
|
|
|
|
2015-08-05 22:23:15 +00:00
|
|
|
set(ZIG_SOURCES
|
2016-09-30 06:21:21 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/analyze.cpp"
|
2016-01-28 04:10:38 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/ast_render.cpp"
|
2016-01-21 10:02:25 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/bignum.cpp"
|
2016-09-30 06:21:21 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/buffer.cpp"
|
2016-04-21 22:48:13 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/c_tokenizer.cpp"
|
2015-12-01 02:58:53 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/codegen.cpp"
|
2016-09-30 06:21:21 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/errmsg.cpp"
|
2015-11-05 07:05:25 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/error.cpp"
|
2016-12-18 21:56:50 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/ir.cpp"
|
2016-10-01 00:12:00 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/ir_print.cpp"
|
2016-09-30 06:21:21 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/link.cpp"
|
2015-11-05 07:05:25 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/main.cpp"
|
2015-12-01 02:58:53 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/os.cpp"
|
2016-09-30 06:21:21 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/parser.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/src/target.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/src/tokenizer.cpp"
|
2015-11-05 07:05:25 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/util.cpp"
|
2016-12-19 00:40:26 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/parseh.cpp"
|
2015-11-24 20:00:38 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/zig_llvm.cpp"
|
2015-08-05 22:23:15 +00:00
|
|
|
)
|
|
|
|
|
2015-11-26 08:29:52 +00:00
|
|
|
set(TEST_SOURCES
|
|
|
|
"${CMAKE_SOURCE_DIR}/src/buffer.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/src/util.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/src/os.cpp"
|
2016-02-18 03:23:56 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/src/error.cpp"
|
2015-11-28 00:11:03 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/test/run_tests.cpp"
|
2015-11-26 08:29:52 +00:00
|
|
|
)
|
|
|
|
|
2015-12-09 00:51:59 +00:00
|
|
|
set(C_HEADERS
|
2017-02-06 08:10:32 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/Intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/__stddef_max_align_t.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/__wmmintrin_aes.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/__wmmintrin_pclmul.h"
|
2015-12-09 00:51:59 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/adxintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/ammintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/arm_acle.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx2intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512bwintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512cdintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512dqintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512erintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512fintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512vlbwintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512vldqintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avx512vlintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/avxintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/bmi2intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/bmiintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/cpuid.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/cuda_builtin_vars.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/emmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/f16cintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/float.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/fma4intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/fmaintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/fxsrintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/htmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/htmxlintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/ia32intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/immintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/inttypes.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/iso646.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/limits.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/lzcntintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/mm3dnow.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/mm_malloc.h"
|
2017-02-06 08:10:32 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/mmintrin.h"
|
2015-12-09 00:51:59 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/nmmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/pmmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/popcntintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/prfchwintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/rdseedintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/rtmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/s390intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/shaintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/smmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stdalign.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stdarg.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stdatomic.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stdbool.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stddef.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stdint.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/stdnoreturn.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/tbmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/tgmath.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/tmmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/unwind.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/vadefs.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/varargs.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/vecintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/wmmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/x86intrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/xmmintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/xopintrin.h"
|
|
|
|
"${CMAKE_SOURCE_DIR}/c_headers/xtestintrin.h"
|
|
|
|
)
|
2015-11-26 08:29:52 +00:00
|
|
|
|
2016-02-16 03:56:52 +00:00
|
|
|
|
|
|
|
set(ZIG_HOST_LINK_VERSION)
|
|
|
|
if (APPLE)
|
|
|
|
set(LD_V_OUTPUT)
|
|
|
|
execute_process(
|
|
|
|
COMMAND sh -c "${CMAKE_LINKER} -v 2>&1 | head -1"
|
|
|
|
RESULT_VARIABLE HAD_ERROR
|
|
|
|
OUTPUT_VARIABLE LD_V_OUTPUT
|
|
|
|
)
|
|
|
|
if (NOT HAD_ERROR)
|
|
|
|
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
|
|
|
|
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" ZIG_HOST_LINK_VERSION ${LD_V_OUTPUT})
|
|
|
|
elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
|
|
|
|
string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" ZIG_HOST_LINK_VERSION ${LD_V_OUTPUT})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2015-12-09 00:51:59 +00:00
|
|
|
set(C_HEADERS_DEST "lib/zig/include")
|
2015-12-10 22:34:38 +00:00
|
|
|
set(ZIG_STD_DEST "lib/zig/std")
|
2015-08-05 22:23:15 +00:00
|
|
|
set(CONFIGURE_OUT_FILE "${CMAKE_BINARY_DIR}/config.h")
|
|
|
|
configure_file (
|
|
|
|
"${CMAKE_SOURCE_DIR}/src/config.h.in"
|
|
|
|
${CONFIGURE_OUT_FILE}
|
|
|
|
)
|
|
|
|
|
2015-11-26 08:29:52 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
"${CMAKE_SOURCE_DIR}/src"
|
|
|
|
)
|
|
|
|
|
2016-02-17 03:21:37 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror -Wall")
|
2015-08-05 22:23:15 +00:00
|
|
|
|
2016-02-17 03:34:45 +00:00
|
|
|
|
|
|
|
if(MINGW)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-error=format= -Wno-error=format -Wno-error=format-extra-args")
|
|
|
|
endif()
|
|
|
|
|
2017-01-13 22:33:19 +00:00
|
|
|
set(EXE_CFLAGS "-std=c++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__USE_MINGW_ANSI_STDIO -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces")
|
2016-04-23 16:57:38 +00:00
|
|
|
set(EXE_LDFLAGS " ")
|
|
|
|
if(ZIG_TEST_COVERAGE)
|
|
|
|
set(EXE_CFLAGS "${EXE_CFLAGS} -fprofile-arcs -ftest-coverage")
|
|
|
|
set(EXE_LDFLAGS "-fprofile-arcs -ftest-coverage")
|
|
|
|
endif()
|
2015-08-05 22:23:15 +00:00
|
|
|
|
|
|
|
add_executable(zig ${ZIG_SOURCES})
|
|
|
|
set_target_properties(zig PROPERTIES
|
2016-04-23 16:57:38 +00:00
|
|
|
COMPILE_FLAGS ${EXE_CFLAGS}
|
|
|
|
LINK_FLAGS ${EXE_LDFLAGS}
|
|
|
|
)
|
2015-08-05 22:23:15 +00:00
|
|
|
target_link_libraries(zig LINK_PUBLIC
|
2016-01-27 07:01:49 +00:00
|
|
|
${CLANG_LIBRARIES}
|
2017-03-13 15:54:56 +00:00
|
|
|
${LLD_LIBRARIES}
|
2016-02-02 05:38:55 +00:00
|
|
|
${LLVM_LIBRARIES}
|
2017-03-30 05:18:12 +00:00
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
2015-08-05 22:23:15 +00:00
|
|
|
)
|
|
|
|
install(TARGETS zig DESTINATION bin)
|
2015-11-04 05:31:27 +00:00
|
|
|
|
2015-12-09 00:51:59 +00:00
|
|
|
install(FILES ${C_HEADERS} DESTINATION ${C_HEADERS_DEST})
|
2016-03-02 02:00:03 +00:00
|
|
|
|
2017-03-31 09:48:15 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/build.zig" DESTINATION "${ZIG_STD_DEST}")
|
2017-03-23 06:59:58 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/c/darwin.zig" DESTINATION "${ZIG_STD_DEST}/c")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/c/index.zig" DESTINATION "${ZIG_STD_DEST}/c")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/c/linux.zig" DESTINATION "${ZIG_STD_DEST}/c")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/c/windows.zig" DESTINATION "${ZIG_STD_DEST}/c")
|
2016-05-07 17:52:52 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/cstr.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-08-18 03:11:04 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/debug.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-08-26 00:25:18 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/dwarf.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-08-18 03:11:04 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/elf.zig" DESTINATION "${ZIG_STD_DEST}")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/empty.zig" DESTINATION "${ZIG_STD_DEST}")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/endian.zig" DESTINATION "${ZIG_STD_DEST}")
|
2017-03-10 00:12:15 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/fmt.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-08-18 03:11:04 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/hash_map.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-03-02 02:00:03 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/index.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-08-18 03:11:04 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/io.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-05-08 08:34:00 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/list.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-08-18 03:11:04 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/math.zig" DESTINATION "${ZIG_STD_DEST}")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/mem.zig" DESTINATION "${ZIG_STD_DEST}")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/net.zig" DESTINATION "${ZIG_STD_DEST}")
|
2017-04-04 04:17:24 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/child_process.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
2017-03-26 10:39:28 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/darwin.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/darwin_x86_64.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/errno.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/index.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux_i386.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/linux_x86_64.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/os/windows.zig" DESTINATION "${ZIG_STD_DEST}/os")
|
2016-08-18 03:11:04 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/rand.zig" DESTINATION "${ZIG_STD_DEST}")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/rand_test.zig" DESTINATION "${ZIG_STD_DEST}")
|
2016-11-03 07:01:40 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/sort.zig" DESTINATION "${ZIG_STD_DEST}")
|
2017-03-26 10:39:28 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/special/bootstrap.zig" DESTINATION "${ZIG_STD_DEST}/special")
|
2017-03-31 09:48:15 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/special/build_runner.zig" DESTINATION "${ZIG_STD_DEST}/special")
|
2017-03-26 10:39:28 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/special/builtin.zig" DESTINATION "${ZIG_STD_DEST}/special")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt.zig" DESTINATION "${ZIG_STD_DEST}/special")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/special/test_runner.zig" DESTINATION "${ZIG_STD_DEST}/special")
|
2017-03-27 01:07:07 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/special/zigrt.zig" DESTINATION "${ZIG_STD_DEST}/special")
|
2017-03-26 10:39:28 +00:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/std/target.zig" DESTINATION "${ZIG_STD_DEST}")
|
2015-12-09 00:51:59 +00:00
|
|
|
|
2015-11-26 08:29:52 +00:00
|
|
|
add_executable(run_tests ${TEST_SOURCES})
|
|
|
|
target_link_libraries(run_tests)
|
|
|
|
set_target_properties(run_tests PROPERTIES
|
|
|
|
COMPILE_FLAGS ${EXE_CFLAGS}
|
2016-04-23 16:57:38 +00:00
|
|
|
LINK_FLAGS ${EXE_LDFLAGS}
|
2015-11-26 08:29:52 +00:00
|
|
|
)
|
2016-04-23 16:57:38 +00:00
|
|
|
|
|
|
|
if (ZIG_TEST_COVERAGE)
|
|
|
|
add_custom_target(coverage
|
|
|
|
DEPENDS run_tests
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
COMMAND lcov --directory . --zerocounters --rc lcov_branch_coverage=1
|
|
|
|
COMMAND ./run_tests
|
|
|
|
COMMAND lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1
|
|
|
|
COMMAND lcov --remove coverage.info '/usr/*' --output-file coverage.info.cleaned --rc lcov_branch_coverage=1
|
|
|
|
COMMAND genhtml -o coverage coverage.info.cleaned --rc lcov_branch_coverage=1
|
|
|
|
COMMAND rm coverage.info coverage.info.cleaned
|
|
|
|
)
|
|
|
|
endif()
|