Fix support for a static build of Epoxy. Add support building and running tests with CMake. Add support for linking with the static run-time library with MSVC.
parent
64e2ee2ca8
commit
44d51f2844
@ -1,50 +1,98 @@ |
|||||||
cmake_minimum_required (VERSION 3.0) |
cmake_minimum_required (VERSION 3.0) |
||||||
cmake_policy (VERSION 3.0) |
|
||||||
if (NOT CMAKE_VERSION VERSION_LESS "3.1") |
if (NOT CMAKE_VERSION VERSION_LESS "3.1") |
||||||
cmake_policy (SET CMP0054 NEW) |
cmake_policy (SET CMP0054 OLD) |
||||||
|
endif () |
||||||
|
if (NOT CMAKE_VERSION VERSION_LESS "3.3") |
||||||
|
cmake_policy (SET CMP0063 NEW) |
||||||
|
set (HONOR_VISIBILITY TRUE) |
||||||
|
else () |
||||||
|
set (HONOR_VISIBILITY FALSE) |
||||||
endif () |
endif () |
||||||
project (Epoxy VERSION 1.3.1 LANGUAGES C) |
project (Epoxy VERSION 1.3.1 LANGUAGES C) |
||||||
set (TARGET_NAME epoxy) |
set (EPOXY_TARGET_NAME epoxy) |
||||||
set (TARGET_VER 1.3.1_yaronct-4) |
set (TARGET_VER 1.3.1_yaronct-5) |
||||||
set (TARGET_ABI_VER 0) |
set (TARGET_ABI_VER 0) |
||||||
set (TARGET_OUTPUT_NAME "${TARGET_NAME}") |
set (TARGET_OUTPUT_NAME "${EPOXY_TARGET_NAME}") |
||||||
|
|
||||||
|
include (GNUInstallDirs) |
||||||
|
include (CMakeDependentOption) |
||||||
|
|
||||||
set (CMAKE_C_VISIBILITY_PRESET "hidden") |
set (COMPILER_ID_MSVC MSVC) |
||||||
|
set (COMPILER_ID_GCC GNU) |
||||||
|
set (COMPILER_ID_CLANG Clang) |
||||||
|
|
||||||
if ((CMAKE_C_COMPILER_ID STREQUAL "GNU") OR (CMAKE_C_COMPILER_ID STREQUAL "Clang")) |
if ((CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_GCC) OR (CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_CLANG)) |
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") |
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") |
||||||
elseif (NOT CMAKE_VERSION VERSION_LESS "3.1") |
elseif (NOT CMAKE_VERSION VERSION_LESS "3.1") |
||||||
set (CMAKE_C_STANDARD_REQUIRED TRUE) |
set (CMAKE_C_STANDARD_REQUIRED TRUE) |
||||||
set (CMAKE_C_STANDARD "99") |
set (CMAKE_C_STANDARD "99") |
||||||
endif () |
endif () |
||||||
|
|
||||||
if ((CMAKE_C_COMPILER_ID STREQUAL "GNU") OR (CMAKE_C_COMPILER_ID STREQUAL "Clang")) |
if ((CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_GCC) OR (CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_CLANG)) |
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -Wall -Wextra") |
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -Wall -Wextra") |
||||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC") |
elseif (CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_MSVC) |
||||||
if (NOT CMAKE_C_FLAGS MATCHES "/W[0-4]") |
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") |
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") |
|
||||||
endif () |
|
||||||
endif () |
endif () |
||||||
|
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") |
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") |
||||||
|
|
||||||
find_package (X11) |
find_package (X11) |
||||||
find_package (PythonInterp) |
find_package (PythonInterp) |
||||||
|
find_package (EGL) |
||||||
|
find_package (GLESv1) |
||||||
|
find_package (GLESv2) |
||||||
|
find_package (OpenGL) |
||||||
|
|
||||||
include (CMakeDependentOption) |
option (EPOXY_REBUILD_FROM_SPECS "Rebuild the auto-generated sources and headers from the specs" FALSE) |
||||||
|
|
||||||
option (EPOXY_REBUILD_FROM_SPECS "Whether to rebuild the auto-generated sources and headers from the specs" FALSE) |
|
||||||
if (EPOXY_REBUILD_FROM_SPECS AND NOT PYTHONINTERP_FOUND) |
if (EPOXY_REBUILD_FROM_SPECS AND NOT PYTHONINTERP_FOUND) |
||||||
message (FATAL_ERROR "You've set \"EPOXY_REBUILD_FROM_SPECS\" to \"TRUE\", which requires a python interpreter, but one couldn't be found.") |
message (FATAL_ERROR "You've set \"EPOXY_REBUILD_FROM_SPECS\" to \"TRUE\", which requires a python interpreter, but one couldn't be found.") |
||||||
endif () |
endif () |
||||||
|
|
||||||
option (EPOXY_SUPPORT_EGL "Whether to build with EGL support" TRUE) |
option (EPOXY_SUPPORT_EGL "Build with EGL support" ON) |
||||||
cmake_dependent_option (EPOXY_SUPPORT_WGL "Whether to build with WGL support" ON WIN32 OFF) |
cmake_dependent_option (EPOXY_SUPPORT_WGL "Build with WGL support" ON WIN32 OFF) |
||||||
cmake_dependent_option (EPOXY_SUPPORT_GLX "Whether to build with GLX support" "${X11_FOUND}" "NOT (WIN32 OR ANDROID)" OFF) |
|
||||||
|
if (X11_FOUND AND OPENGL_FOUND) |
||||||
|
set (EPOXY_GLX_FOUND TRUE) |
||||||
|
else () |
||||||
|
set (EPOXY_GLX_FOUND FALSE) |
||||||
|
endif () |
||||||
|
cmake_dependent_option (EPOXY_SUPPORT_GLX "Build with GLX support" |
||||||
|
"${EPOXY_GLX_FOUND}" "NOT (WIN32 OR ANDROID)" OFF) |
||||||
|
|
||||||
option (EPOXY_BUILD_SHARED "Whether to build a shared library" TRUE) |
option (EPOXY_BUILD_SHARED "Build a shared library" ON) |
||||||
option (EPOXY_BUILD_STATIC "Whether to build a static library" FALSE) |
option (EPOXY_BUILD_STATIC "Build a static library" OFF) |
||||||
|
|
||||||
|
if (DEFINED CMAKE_TOOLCHAIN_FILE) |
||||||
|
set (EPOXY_BUILD_TESTS_DEFAULT FALSE) |
||||||
|
else () |
||||||
|
set (EPOXY_BUILD_TESTS_DEFAULT TRUE) |
||||||
|
endif () |
||||||
|
option (EPOXY_BUILD_TESTS "Build tests" "${EPOXY_BUILD_TESTS_DEFAULT}") |
||||||
|
|
||||||
|
cmake_dependent_option (EPOXY_MSVC_USE_RUNTIME_LIBRARY_DLL "Link with MSVC Runtime Library DLL" ON |
||||||
|
"CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_MSVC" OFF) |
||||||
|
|
||||||
configure_file ("include/epoxy/config.h.in" "include/epoxy/config.h") |
configure_file ("include/epoxy/config.h.in" "include/epoxy/config.h") |
||||||
|
|
||||||
|
set (EPOXY_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" |
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/include" |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src") |
||||||
|
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL COMPILER_ID_MSVC |
||||||
|
AND NOT EPOXY_MSVC_USE_RUNTIME_LIBRARY_DLL) |
||||||
|
foreach (flags CMAKE_C_FLAGS |
||||||
|
CMAKE_C_FLAGS_DEBUG |
||||||
|
CMAKE_C_FLAGS_RELEASE |
||||||
|
CMAKE_C_FLAGS_MINSIZEREL |
||||||
|
CMAKE_C_FLAGS_RELWITHDEBINFO) |
||||||
|
string (REGEX REPLACE "/MDd" "/MTd" ${flags} "${${flags}}") |
||||||
|
string (REGEX REPLACE "/MD" "/MT" ${flags} "${${flags}}") |
||||||
|
endforeach () |
||||||
|
endif () |
||||||
|
|
||||||
add_subdirectory (src) |
add_subdirectory (src) |
||||||
|
|
||||||
|
if (EPOXY_BUILD_TESTS) |
||||||
|
enable_testing () |
||||||
|
add_subdirectory (test) |
||||||
|
endif () |
||||||
|
@ -0,0 +1,12 @@ |
|||||||
|
# Find EGL |
||||||
|
# |
||||||
|
# EGL_LIBRARY |
||||||
|
# EGL_FOUND |
||||||
|
|
||||||
|
set (EGL_NAMES ${EGL_NAMES} egl EGL libEGL) |
||||||
|
find_library (EGL_LIBRARY NAMES ${EGL_NAMES} PATHS /opt/vc/lib) |
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs) |
||||||
|
find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY) |
||||||
|
|
||||||
|
mark_as_advanced(EGL_LIBRARY) |
@ -0,0 +1,12 @@ |
|||||||
|
# Find GLESv1 |
||||||
|
# |
||||||
|
# GLESv1_LIBRARY |
||||||
|
# GLESv1_FOUND |
||||||
|
|
||||||
|
set(GLESv1_NAMES ${GLESv1_NAMES} GLESv1_CM libGLES_CM) |
||||||
|
find_library (GLESv1_LIBRARY NAMES ${GLESv1_NAMES} PATHS /opt/vc/lib) |
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs) |
||||||
|
find_package_handle_standard_args (GLESv1 DEFAULT_MSG GLESv1_LIBRARY) |
||||||
|
|
||||||
|
mark_as_advanced (GLESv1_LIBRARY) |
@ -0,0 +1,12 @@ |
|||||||
|
# Find GLESv2 |
||||||
|
# |
||||||
|
# GLESv2_LIBRARY |
||||||
|
# GLESv2_FOUND |
||||||
|
|
||||||
|
set (GLESv2_NAMES ${GLESv2_NAMES} GLESv2 libGLESv2) |
||||||
|
find_library (GLESv2_LIBRARY NAMES ${GLESv2_NAMES} PATHS /opt/vc/lib) |
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs) |
||||||
|
find_package_handle_standard_args (GLESv2 DEFAULT_MSG GLESv2_LIBRARY) |
||||||
|
|
||||||
|
mark_as_advanced (GLESv2_LIBRARY) |
@ -0,0 +1,17 @@ |
|||||||
|
cmake_minimum_required (VERSION 3.0) |
||||||
|
if (NOT CMAKE_VERSION VERSION_LESS "3.1") |
||||||
|
cmake_policy (SET CMP0054 OLD) |
||||||
|
endif () |
||||||
|
if (WIN32 AND DEFINED EPOXY_SHARED_LIB) |
||||||
|
get_filename_component (EPOXY_SHARED_LIB_DIR "${EPOXY_SHARED_LIB}" DIRECTORY) |
||||||
|
file (TO_NATIVE_PATH "${EPOXY_SHARED_LIB_DIR}" EPOXY_SHARED_LIB_DIR) |
||||||
|
if (NOT DEFINED ENV{PATH} OR ENV{PATH} STREQUAL "") |
||||||
|
set (ENV{PATH} "${EPOXY_SHARED_LIB_DIR}") |
||||||
|
else () |
||||||
|
set (ENV{PATH} "${EPOXY_SHARED_LIB_DIR};$ENV{PATH}") |
||||||
|
endif () |
||||||
|
endif () |
||||||
|
execute_process (COMMAND "${EPOXY_TEST_CMD}" RESULT_VARIABLE TEST_RETURN_VAL) |
||||||
|
if (NOT TEST_RETURN_VAL EQUAL 0 AND NOT TEST_RETURN_VAL EQUAL 77) |
||||||
|
message (FATAL_ERROR "Test has failed!") |
||||||
|
endif () |
@ -1,101 +0,0 @@ |
|||||||
/*
|
|
||||||
* Copyright © 2013 Intel Corporation |
|
||||||
* |
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a |
|
||||||
* copy of this software and associated documentation files (the "Software"), |
|
||||||
* to deal in the Software without restriction, including without limitation |
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the |
|
||||||
* Software is furnished to do so, subject to the following conditions: |
|
||||||
* |
|
||||||
* The above copyright notice and this permission notice (including the next |
|
||||||
* paragraph) shall be included in all copies or substantial portions of the |
|
||||||
* Software. |
|
||||||
* |
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
|
||||||
* IN THE SOFTWARE. |
|
||||||
*/ |
|
||||||
|
|
||||||
#if !defined _WIN32 |
|
||||||
#error This file should only be used in Windows. |
|
||||||
#endif |
|
||||||
|
|
||||||
#include "dispatch_common.h" |
|
||||||
|
|
||||||
/**
|
|
||||||
* This global symbol is apparently looked up by Windows when loading |
|
||||||
* a DLL, but it doesn't declare the prototype. |
|
||||||
*/ |
|
||||||
BOOL WINAPI |
|
||||||
DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved); |
|
||||||
|
|
||||||
BOOL WINAPI |
|
||||||
DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved) |
|
||||||
{ |
|
||||||
void *data; |
|
||||||
|
|
||||||
switch (reason) { |
|
||||||
case DLL_PROCESS_ATTACH: |
|
||||||
gl_tls_index = TlsAlloc(); |
|
||||||
if (gl_tls_index == TLS_OUT_OF_INDEXES) |
|
||||||
return FALSE; |
|
||||||
wgl_tls_index = TlsAlloc(); |
|
||||||
if (wgl_tls_index == TLS_OUT_OF_INDEXES) |
|
||||||
return FALSE; |
|
||||||
|
|
||||||
epoxy_first_context_current = false; |
|
||||||
|
|
||||||
/* FALLTHROUGH */ |
|
||||||
|
|
||||||
case DLL_THREAD_ATTACH: |
|
||||||
data = LocalAlloc(LPTR, gl_tls_size); |
|
||||||
TlsSetValue(gl_tls_index, data); |
|
||||||
|
|
||||||
data = LocalAlloc(LPTR, wgl_tls_size); |
|
||||||
TlsSetValue(wgl_tls_index, data); |
|
||||||
|
|
||||||
break; |
|
||||||
|
|
||||||
case DLL_THREAD_DETACH: |
|
||||||
case DLL_PROCESS_DETACH: |
|
||||||
data = TlsGetValue(gl_tls_index); |
|
||||||
LocalFree(data); |
|
||||||
|
|
||||||
data = TlsGetValue(wgl_tls_index); |
|
||||||
LocalFree(data); |
|
||||||
|
|
||||||
if (reason == DLL_PROCESS_DETACH) { |
|
||||||
TlsFree(gl_tls_index); |
|
||||||
TlsFree(wgl_tls_index); |
|
||||||
} |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
return TRUE; |
|
||||||
} |
|
||||||
|
|
||||||
#ifdef EPOXY_BUILDING_STATIC_LIB |
|
||||||
#ifdef __GNUC__ |
|
||||||
PIMAGE_TLS_CALLBACK dllmain_callback __attribute__((section(".CRT$XLB"))) = (PIMAGE_TLS_CALLBACK)DllMain; |
|
||||||
#else |
|
||||||
# ifdef _WIN64 |
|
||||||
# pragma comment(linker, "/INCLUDE:_tls_used") |
|
||||||
# pragma comment(linker, "/INCLUDE:dllmain_callback") |
|
||||||
# pragma const_seg(".CRT$XLB") |
|
||||||
extern const PIMAGE_TLS_CALLBACK dllmain_callback; |
|
||||||
const PIMAGE_TLS_CALLBACK dllmain_callback = DllMain; |
|
||||||
# pragma const_seg() |
|
||||||
# else |
|
||||||
# pragma comment(linker, "/INCLUDE:__tls_used") |
|
||||||
# pragma comment(linker, "/INCLUDE:_dllmain_callback") |
|
||||||
# pragma data_seg(".CRT$XLB") |
|
||||||
PIMAGE_TLS_CALLBACK dllmain_callback = DllMain; |
|
||||||
# pragma data_seg() |
|
||||||
# endif |
|
||||||
#endif |
|
||||||
#endif |
|
@ -0,0 +1,150 @@ |
|||||||
|
if (EPOXY_BUILD_TESTS) |
||||||
|
|
||||||
|
if (EPOXY_BUILD_SHARED) |
||||||
|
set (TESTS_TARGET_NAME "${EPOXY_TARGET_NAME}_shared") |
||||||
|
else () |
||||||
|
set (TESTS_TARGET_NAME "${EPOXY_TARGET_NAME}_static") |
||||||
|
endif () |
||||||
|
|
||||||
|
if (EPOXY_SUPPORT_EGL) |
||||||
|
if (EGL_FOUND) |
||||||
|
set (EPOXY_BUILD_EGL_TESTS TRUE) |
||||||
|
set (EPOXY_EGL_TESTS_COMMON egl_common.c egl_common.h) |
||||||
|
else () |
||||||
|
set (EPOXY_BUILD_EGL_TESTS FALSE) |
||||||
|
message (WARNING "EGL not found - EGL tests will not be built!") |
||||||
|
endif () |
||||||
|
endif () |
||||||
|
if (EPOXY_SUPPORT_GLX) |
||||||
|
set (EPOXY_GLX_TESTS_COMMON glx_common.c glx_common.h) |
||||||
|
endif () |
||||||
|
if (EPOXY_SUPPORT_WGL) |
||||||
|
set (EPOXY_WGL_TESTS_COMMON wgl_common.c wgl_common.h) |
||||||
|
endif () |
||||||
|
|
||||||
|
set (EPOXY_LINKAGE_TYPE_SHARED SHARED) |
||||||
|
set (EPOXY_LINKAGE_TYPE_STATIC STATIC) |
||||||
|
|
||||||
|
function (epoxy_add_test EPOXY_TEST_NAME EPOXY_TEST_CODE) |
||||||
|
# Additional optional arguments: "EPOXY_TEST_DEPS EPOXY_TEST_COMPILE_DEFS EPOXY_TEST_LINK_FLAGS" |
||||||
|
# "EPOXY_LINKAGE_TYPE" |
||||||
|
|
||||||
|
if (ARGC GREATER 2) |
||||||
|
set (EPOXY_TEST_DEPS "${ARGV2}") |
||||||
|
else () |
||||||
|
set (EPOXY_TEST_DEPS "") |
||||||
|
endif () |
||||||
|
if (ARGC GREATER 3) |
||||||
|
set (EPOXY_TEST_COMPILE_DEFS "${ARGV3}") |
||||||
|
else () |
||||||
|
set (EPOXY_TEST_COMPILE_DEFS "") |
||||||
|
endif () |
||||||
|
if (ARGC GREATER 4) |
||||||
|
set (EPOXY_TEST_LINK_FLAGS "${ARGV4}") |
||||||
|
else () |
||||||
|
set (EPOXY_TEST_LINK_FLAGS "") |
||||||
|
endif () |
||||||
|
if (ARGC GREATER 5) |
||||||
|
set (EPOXY_TEST_LINKAGE_TYPE "${ARGV5}") |
||||||
|
else () |
||||||
|
set (EPOXY_TEST_LINKAGE_TYPE BOTH) |
||||||
|
endif () |
||||||
|
|
||||||
|
if (EPOXY_BUILD_SHARED AND NOT EPOXY_TEST_LINKAGE_TYPE STREQUAL EPOXY_LINKAGE_TYPE_STATIC) |
||||||
|
set (EPOXY_TEST_TARGET_NAME "test_shared_${EPOXY_TEST_NAME}") |
||||||
|
add_executable (${EPOXY_TEST_TARGET_NAME} ${EPOXY_TEST_CODE}) |
||||||
|
target_link_libraries (${EPOXY_TEST_TARGET_NAME} "${EPOXY_TARGET_NAME}_shared" ${EPOXY_TEST_DEPS}) |
||||||
|
target_compile_definitions (${EPOXY_TEST_TARGET_NAME} PRIVATE |
||||||
|
${EPOXY_TEST_COMPILE_DEFS}) |
||||||
|
target_include_directories (${EPOXY_TEST_TARGET_NAME} PRIVATE ${EPOXY_INCLUDE_DIRS}) |
||||||
|
set_target_properties (${EPOXY_TEST_TARGET_NAME} PROPERTIES |
||||||
|
LINK_FLAGS "${EPOXY_TEST_LINK_FLAGS}") |
||||||
|
add_test (NAME "${EPOXY_TEST_TARGET_NAME}" |
||||||
|
COMMAND "${CMAKE_COMMAND}" |
||||||
|
"-DEPOXY_TEST_CMD=$<TARGET_FILE:${EPOXY_TEST_TARGET_NAME}>" |
||||||
|
"-DEPOXY_SHARED_LIB=$<TARGET_FILE:${EPOXY_TARGET_NAME}_shared>" |
||||||
|
"-P" "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/epoxy_run_test_wrapper.cmake") |
||||||
|
endif () |
||||||
|
|
||||||
|
if (EPOXY_BUILD_STATIC AND NOT EPOXY_TEST_LINKAGE_TYPE STREQUAL EPOXY_LINKAGE_TYPE_SHARED) |
||||||
|
set (EPOXY_TEST_TARGET_NAME "test_static_${EPOXY_TEST_NAME}") |
||||||
|
add_executable (${EPOXY_TEST_TARGET_NAME} ${EPOXY_TEST_CODE}) |
||||||
|
target_link_libraries (${EPOXY_TEST_TARGET_NAME} "${EPOXY_TARGET_NAME}_static" ${EPOXY_TEST_DEPS}) |
||||||
|
target_compile_definitions (${EPOXY_TEST_TARGET_NAME} PRIVATE |
||||||
|
${EPOXY_TEST_COMPILE_DEFS} EPOXY_STATIC_LIB) |
||||||
|
target_include_directories (${EPOXY_TEST_TARGET_NAME} PRIVATE ${EPOXY_INCLUDE_DIRS}) |
||||||
|
set_target_properties (${EPOXY_TEST_TARGET_NAME} PROPERTIES |
||||||
|
LINK_FLAGS "${EPOXY_TEST_LINK_FLAGS}") |
||||||
|
add_test (NAME "${EPOXY_TEST_TARGET_NAME}" |
||||||
|
COMMAND "${CMAKE_COMMAND}" |
||||||
|
"-DEPOXY_TEST_CMD=$<TARGET_FILE:${EPOXY_TEST_TARGET_NAME}>" |
||||||
|
"-P" "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/epoxy_run_test_wrapper.cmake") |
||||||
|
endif () |
||||||
|
|
||||||
|
endfunction () |
||||||
|
|
||||||
|
if (EPOXY_BUILD_EGL_TESTS AND X11_FOUND) |
||||||
|
|
||||||
|
epoxy_add_test (egl_has_extension_nocontext "${EPOXY_EGL_TESTS_COMMON};egl_has_extension_nocontext.c" |
||||||
|
"${X11_LIBRARIES}") |
||||||
|
epoxy_add_test (egl_gl "${EPOXY_EGL_TESTS_COMMON};egl_gl.c" "${X11_LIBRARIES}") |
||||||
|
if (GLESv1_FOUND) |
||||||
|
epoxy_add_test (egl_gles1_without_glx "${EPOXY_EGL_TESTS_COMMON};egl_without_glx.c" "${X11_LIBRARIES}" |
||||||
|
"GLES_VERSION=1") |
||||||
|
endif () |
||||||
|
if (GLESv2_FOUND) |
||||||
|
epoxy_add_test (egl_gles2_without_glx "${EPOXY_EGL_TESTS_COMMON};egl_without_glx.c" "${X11_LIBRARIES}" |
||||||
|
"GLES_VERSION=2") |
||||||
|
endif () |
||||||
|
endif() |
||||||
|
|
||||||
|
if (EPOXY_BUILD_EGL_TESTS AND EPOXY_SUPPORT_GLX AND NOT APPLE) |
||||||
|
|
||||||
|
#epoxy_add_test (egl_and_glx_different_pointers "${EPOXY_EGL_TESTS_COMMON};${EPOXY_GLX_TESTS_COMMON};egl_and_glx_different_pointers.c;dlwrap.c;dlwrap.h" "${X11_LIBRARIES}" "USE_EGL;USE_GLX" "-rdynamic") |
||||||
|
epoxy_add_test (egl_different_pointers |
||||||
|
"${EPOXY_EGL_TESTS_COMMON};${EPOXY_GLX_TESTS_COMMON};egl_and_glx_different_pointers.c;dlwrap.c;dlwrap.h" |
||||||
|
"${X11_LIBRARIES}" "USE_EGL" "-rdynamic") |
||||||
|
epoxy_add_test (glx_different_pointers |
||||||
|
"${EPOXY_EGL_TESTS_COMMON};${EPOXY_GLX_TESTS_COMMON};egl_and_glx_different_pointers.c;dlwrap.c;dlwrap.h" |
||||||
|
"${X11_LIBRARIES}" "USE_GLX" "-rdynamic") |
||||||
|
endif () |
||||||
|
|
||||||
|
if (EPOXY_SUPPORT_GLX) |
||||||
|
|
||||||
|
if (NOT APPLE) |
||||||
|
epoxy_add_test (glx_alias_prefer_same_name |
||||||
|
"${EPOXY_GLX_TESTS_COMMON};glx_alias_prefer_same_name.c;dlwrap.c;dlwrap.h" "${X11_LIBRARIES}" |
||||||
|
"" "-rdynamic") |
||||||
|
if (GLESv2_FOUND) |
||||||
|
epoxy_add_test (test_glx_gles2 |
||||||
|
"${EPOXY_GLX_TESTS_COMMON};glx_gles2.c;dlwrap.c;dlwrap.h" "${X11_LIBRARIES}" "" "-rdynamic") |
||||||
|
endif () |
||||||
|
endif () |
||||||
|
|
||||||
|
epoxy_add_test (test_glx_beginend "${EPOXY_GLX_TESTS_COMMON};glx_beginend.c" |
||||||
|
"${OPENGL_gl_LIBRARY};${X11_LIBRARIES}") |
||||||
|
epoxy_add_test (glx_public_api "${EPOXY_GLX_TESTS_COMMON};glx_public_api.c" "${X11_LIBRARIES}") |
||||||
|
epoxy_add_test (glx_public_api_core "${EPOXY_GLX_TESTS_COMMON};glx_public_api_core.c" "${X11_LIBRARIES}") |
||||||
|
epoxy_add_test (glx_getprocaddress_nocontext |
||||||
|
"${EPOXY_GLX_TESTS_COMMON};glx_glxgetprocaddress_nocontext.c" "${X11_LIBRARIES}") |
||||||
|
epoxy_add_test (glx_has_extension_nocontext "${EPOXY_GLX_TESTS_COMMON};glx_has_extension_nocontext.c" |
||||||
|
"${X11_LIBRARIES}") |
||||||
|
|
||||||
|
epoxy_add_test (glx_shared_znow "${EPOXY_GLX_TESTS_COMMON};glx_static.c" |
||||||
|
"${X11_LIBRARIES}" "" "-Wl,-z,now" SHARED) |
||||||
|
epoxy_add_test (glx_static "${EPOXY_GLX_TESTS_COMMON};glx_static.c" |
||||||
|
"${X11_LIBRARIES}" "NEEDS_TO_BE_STATIC" "" STATIC) |
||||||
|
endif () |
||||||
|
|
||||||
|
epoxy_add_test (headerguards headerguards.c) |
||||||
|
epoxy_add_test (miscdefines miscdefines.c) |
||||||
|
|
||||||
|
if (EPOXY_SUPPORT_WGL) |
||||||
|
epoxy_add_test (wgl_core_and_exts "${EPOXY_WGL_TESTS_COMMON};wgl_core_and_exts.c") |
||||||
|
epoxy_add_test (wgl_per_context_funcptrs "${EPOXY_WGL_TESTS_COMMON};wgl_per_context_funcptrs.c") |
||||||
|
epoxy_add_test (wgl_usefontbitmaps_ascii "${EPOXY_WGL_TESTS_COMMON};wgl_usefontbitmaps.c") |
||||||
|
epoxy_add_test (wgl_usefontbitmaps_unicode "${EPOXY_WGL_TESTS_COMMON};wgl_usefontbitmaps.c" |
||||||
|
"" "_UNICODE;UNICODE") |
||||||
|
endif () |
||||||
|
|
||||||
|
endif () |
Loading…
Reference in new issue