提交 98478b68 编写于 作者: J Jim

Merge pull request #68 from BtbN/fixes

Some bundled dependency cmake related fixes
......@@ -4,9 +4,4 @@ if(WIN32)
endif()
add_subdirectory(glad)
set(BUILD_DOCS FALSE CACHE INTERNAL "" FORCE)
set(STATIC_CRT TRUE CACHE INTERNAL "" FORCE)
set(BUILD_SHARED_LIBS TRUE CACHE INTERNAL "" FORCE)
set(WITHOUT_TESTS TRUE CACHE INTERNAL "" FORCE)
add_subdirectory(jansson)
......@@ -50,15 +50,6 @@ cmake_minimum_required (VERSION 2.8)
# required for exports? cmake_minimum_required (VERSION 2.8.6)
project (jansson C)
# Options
OPTION (BUILD_SHARED_LIBS "Build shared libraries." OFF)
if (MSVC)
# This option must match the settings used in your program, in particular if you
# are linking statically
OPTION( STATIC_CRT "Link the static CRT libraries" OFF )
endif ()
# Set some nicer output dirs.
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
......@@ -95,7 +86,8 @@ if (MSVC)
# Turn off Microsofts "security" warnings.
add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
if (STATIC_CRT)
# Disabled by OBS, options already set by top level CMakeLists
if (FALSE)
set(CMAKE_C_FLAGS_RELEASE "/MT")
set(CMAKE_C_FLAGS_DEBUG "/MTd")
endif()
......@@ -273,7 +265,8 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}/private_include)
# Add the lib sources.
file (GLOB C_FILES src/*.c)
if (BUILD_SHARED_LIBS)
# Disabled by OBS, we use it as a static library
if (FALSE)
add_library (jansson SHARED ${C_FILES} src/jansson.def)
......@@ -305,8 +298,9 @@ endif ()
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# For building Documentation (uses Sphinx)
OPTION (BUILD_DOCS "Build documentation (uses python-sphinx)." ON)
if (BUILD_DOCS)
# OPTION (BUILD_DOCS "Build documentation (uses python-sphinx)." ON)
# Disabled by OBS
if (FALSE)
find_package(Sphinx)
if (NOT SPHINX_FOUND)
......@@ -390,10 +384,8 @@ if (BUILD_DOCS)
endif()
endif ()
OPTION (WITHOUT_TESTS "Don't build tests ('make test' to execute tests)" OFF)
if (NOT WITHOUT_TESTS)
# Disabled by OBS, we don't test this.
if (FALSE)
OPTION (TEST_WITH_VALGRIND "Enable valgrind tests." OFF)
ENABLE_TESTING()
......@@ -479,10 +471,5 @@ if (NOT WITHOUT_TESTS)
DEPENDS json_process ${api_tests})
endif ()
file (COPY ${CMAKE_CURRENT_BINARY_DIR}/include/jansson_config.h
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/src/)
target_include_directories(jansson
PUBLIC src)
install_obs_core(jansson)
PUBLIC src "${CMAKE_CURRENT_BINARY_DIR}/include")
project(w32-pthreads)
add_definitions(-D__CLEANUP_C)
add_definitions(-DPTW32_BUILD)
set(w32-pthreads_SOURCES
pthread.c)
......@@ -15,6 +12,10 @@ set(w32-pthreads_HEADERS
add_library(w32-pthreads SHARED
${w32-pthreads_SOURCES}
${w32-pthreads_HEADERS})
target_compile_definitions(w32-pthreads
PRIVATE __CLEANUP_C PTW32_BUILD)
target_include_directories(w32-pthreads
PUBLIC .)
target_link_libraries(w32-pthreads)
install_obs_core(w32-pthreads)
......@@ -37,6 +37,8 @@
#include "pthread.h"
#include "implement.h"
#include <tchar.h>
/*
* Handle to quserex.dll
*/
......@@ -80,8 +82,8 @@ pthread_win32_process_attach_np ()
}
#else
/* strncat is secure - this is just to avoid a warning */
if(GetSystemDirectory(QuserExDLLPathBuf, sizeof(QuserExDLLPathBuf)) &&
0 == strncat_s(QuserExDLLPathBuf, sizeof(QuserExDLLPathBuf), "\\QUSEREX.DLL", 12))
if(GetSystemDirectory(QuserExDLLPathBuf, sizeof(QuserExDLLPathBuf) / sizeof(TCHAR)) &&
0 == _tcsncat_s(QuserExDLLPathBuf, sizeof(QuserExDLLPathBuf) / sizeof(TCHAR), TEXT("\\QUSEREX.DLL"), 12))
{
ptw32_h_quserex = LoadLibrary(QuserExDLLPathBuf);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册