Skip to content

Commit

Permalink
修正 Windows 编译问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wasphin committed Jul 27, 2022
1 parent 310b602 commit 8cb73e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 3rdpart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ endif()
add_library(zltoolkit STATIC ${ToolKit_SRC_LIST})
add_library(ZLMediaKit::ToolKit ALIAS zltoolkit)
target_compile_definitions(zltoolkit
PRIVATE ${COMPILE_DEFINITIONS})
PUBLIC ${COMPILE_DEFINITIONS})
target_compile_options(zltoolkit
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
target_include_directories(zltoolkit
Expand Down
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ message(STATUS "编译类型: ${CMAKE_BUILD_TYPE}")
# 方便排查编译问题, 需要 FORCE CACHE, 否则需要命令行设置才生效
set(CMAKE_VERBOSE_MAKEFILE ON CACHE INTERNAL "" FORCE)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
# TODO: include 当前目录会导致 server 编译出错, 待排除
set(CMAKE_INCLUDE_CURRENT_DIR OFF)

# 安装路径
if(NOT CMAKE_INSTALL_PREFIX)
Expand Down Expand Up @@ -170,8 +171,16 @@ if(UNIX)
"-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable"
"-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits")
elseif(WIN32)
# TODO: /wd4819 应该是不会生效
set(COMPILE_OPTIONS_DEFAULT "/wd4566;/wd4819")
set(COMPILE_OPTIONS_DEFAULT
# TODO: /wd4819 应该是不会生效
"/wd4566;/wd4819"
# warning C4530: C++ exception handler used, but unwind semantics are not enabled.
"/EHsc")
if (MSVC)
# disable Windows logo
list(APPEND COMPILE_OPTIONS_DEFAULT "/nologo")
list(APPEND CMAKE_STATIC_LINKER_FLAGS "/nologo")
endif()
endif()

# mediakit 以及各个 runtime 依赖
Expand Down

0 comments on commit 8cb73e1

Please sign in to comment.