• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cmake_minimum_required(VERSION 3.5)
2
3# Ensure that CMAKE_BUILD_TYPE has a value specified for single configuration generators.
4if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
5    set(CMAKE_BUILD_TYPE Release CACHE STRING
6        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.")
7endif()
8
9project(hiview_base
10     LANGUAGES CXX)
11set(CMAKE_CXX_STANDARD 17)
12set(CMAKE_CXX_STANDARD_REQUIRED ON)
13
14#---------build option-----------
15option(BUILD_SHARED_LIBS "Build hiview as a shared library." OFF)
16option(BUILD_WITH_HILOG "Build with Hilog" OFF)
17
18# Adhere to GNU filesystem layout conventions
19include(GNUInstallDirs)
20
21set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Archive output dir.")
22set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Library output dir.")
23set(CMAKE_PDB_OUTPUT_DIRECTORY     "${CMAKE_BINARY_DIR}/bin" CACHE PATH "PDB MSVC debug symbol output dir.")
24set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Executable/dll output dir.")
25
26if(WIN32)
27elseif(UNIX)
28     add_compile_options(
29            -Wall
30            -Wno-format
31            -Wdate-time
32            -Wextra
33            -Wno-sign-compare
34            -Wno-unused-parameter
35            -Wno-unused-result
36            -Wno-missing-field-initializers
37            -fno-common
38            -fno-strict-aliasing
39            -fvisibility=hidden
40            -Os -fPIC)
41endif()
42
43add_library(${PROJECT_NAME} STATIC)
44# in windows and linux default build with no hilog
45if(BUILD_WITH_HILOG)
46
47else()
48    target_compile_definitions(${PROJECT_NAME} PRIVATE __WITH_NO_HILOG__)
49endif(BUILD_WITH_HILOG)
50
51add_subdirectory(adapter)
52add_subdirectory(base)
53add_subdirectory(core)
54target_include_directories(${PROJECT_NAME} PUBLIC
55    ${CMAKE_CURRENT_SOURCE_DIR}/include
56)