2019-07-21 23:39:56 +00:00
|
|
|
if(NOT WIN32)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2019-04-29 23:48:43 +00:00
|
|
|
enable_language(RC)
|
|
|
|
|
2019-07-21 16:05:51 +00:00
|
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
2019-07-28 23:31:07 +00:00
|
|
|
|
|
|
|
if(NOT MSVC_VERSION)
|
2019-05-06 02:33:19 +00:00
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
|
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-cast-function-type>)
|
|
|
|
# unlike unix where you get a *single* compiler ID string in .comment
|
|
|
|
# GNU ld sees fit to merge *all* the .ident sections in object files
|
|
|
|
# to .r[o]data section one after the other!
|
2019-07-28 23:31:07 +00:00
|
|
|
add_compile_options(-fno-ident -Wa,-mbig-obj)
|
2019-12-11 22:02:01 +00:00
|
|
|
link_libraries( -lws2_32 -lshlwapi -ldbghelp -luser32 -liphlpapi -lpsapi -luserenv )
|
2020-06-24 14:17:43 +00:00
|
|
|
# zmq requires windows xp or higher
|
2020-09-16 19:47:35 +00:00
|
|
|
add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501)
|
2019-05-06 02:33:19 +00:00
|
|
|
endif()
|
2019-10-06 23:23:30 +00:00
|
|
|
|
|
|
|
if(EMBEDDED_CFG)
|
|
|
|
link_libatomic()
|
2019-08-29 13:59:04 +00:00
|
|
|
endif()
|
2019-10-06 23:23:30 +00:00
|
|
|
|
2020-02-26 02:47:50 +00:00
|
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32)
|
2019-04-29 23:48:43 +00:00
|
|
|
|
2020-05-17 19:41:48 +00:00
|
|
|
if (NOT STATIC_LINK AND NOT MSVC)
|
2019-04-29 23:48:43 +00:00
|
|
|
message("must ship compiler runtime libraries with this build: libwinpthread-1.dll, libgcc_s_dw2-1.dll, and libstdc++-6.dll")
|
2020-05-17 19:41:48 +00:00
|
|
|
message("for release builds, turn on STATIC_LINK in cmake options")
|
2019-07-17 19:35:49 +00:00
|
|
|
endif()
|
2019-12-11 21:05:40 +00:00
|
|
|
|
2020-05-17 19:41:48 +00:00
|
|
|
if (STATIC_LINK)
|
2019-12-11 21:05:40 +00:00
|
|
|
set(LIBUV_USE_STATIC ON)
|
2020-05-19 02:11:37 +00:00
|
|
|
if (WOW64_CROSS_COMPILE)
|
|
|
|
link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--large-address-aware,--dynamicbase,--pic-executable,-e,_mainCRTStartup,--subsystem,console:5.00 )
|
|
|
|
else()
|
2020-05-30 04:37:12 +00:00
|
|
|
link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--dynamicbase,--pic-executable,-e,mainCRTStartup )
|
2020-05-19 02:11:37 +00:00
|
|
|
endif()
|
2019-12-11 21:05:40 +00:00
|
|
|
endif()
|
|
|
|
|
2020-10-28 22:26:43 +00:00
|
|
|
# win32 is the last platform for which we grab libuv manually.
|
|
|
|
# If you want to run on older hardware try github.com/despair86/libuv.git and then:
|
|
|
|
# cmake .. -G Ninja -DLIBUV_ROOT=/path/to/libuv
|
|
|
|
# Otherwise we'll try either a system one (if not under BUILD_STATIC_DEPS) or else use the submodule
|
|
|
|
# in external/libuv.
|
|
|
|
add_library(libuv INTERFACE)
|
|
|
|
if(NOT LIBUV_ROOT AND NOT BUILD_STATIC_DEPS)
|
|
|
|
find_package(LibUV 1.28.0)
|
2019-12-11 21:05:40 +00:00
|
|
|
endif()
|
|
|
|
|
2020-10-28 22:26:43 +00:00
|
|
|
if(LibUV_FOUND)
|
|
|
|
message(STATUS "using system libuv")
|
|
|
|
target_link_libraries(libuv INTERFACE ${LIBUV_LIBRARIES})
|
|
|
|
target_include_directories(libuv INTERFACE ${LIBUV_INCLUDE_DIRS})
|
|
|
|
else()
|
|
|
|
if(LIBUV_ROOT)
|
|
|
|
add_subdirectory(${LIBUV_ROOT})
|
|
|
|
else()
|
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/external/libuv)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(libuv INTERFACE uv_a)
|
|
|
|
target_compile_definitions(libuv INTERFACE _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64)
|
|
|
|
endif()
|