summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYaron Cohen-Tal <yaronct@gmail.com>2015-08-27 18:47:50 +0300
committerYaron Cohen-Tal <yaronct@gmail.com>2015-08-27 19:13:54 +0300
commitec2f42f01a95df0c524671ad7bf0ef1c55ecd63e (patch)
tree51e0a405a48d78dfc74e6f4da5f4615af6152eb7 /src
parent62e384129b5b9243634ca4a71108c6f8699a24bd (diff)
downloadlibepoxy-ec2f42f01a95df0c524671ad7bf0ef1c55ecd63e.tar.gz
Add support for building static libs with CMake. Fix file permissions. Update documentation about building static libs and about using OpenGL ES / EGL.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt55
-rw-r--r--src/dispatch_common.h4
2 files changed, 41 insertions, 18 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 34eb023..aac7ba9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -63,28 +63,51 @@ if (EPOXY_SUPPORT_WGL)
"${CMAKE_CURRENT_BINARY_DIR}/../include/epoxy/wgl_generated.h")
endif ()
-add_library ("${TARGET_NAME}" SHARED ${SOURCES} ${HEADERS})
+set (TARGET_OBJS_NAME "${TARGET_NAME}_objs")
+add_library ("${TARGET_NAME}_objs" OBJECT ${SOURCES} ${HEADERS})
+set_target_properties ("${TARGET_NAME}_objs" PROPERTIES
+ POSITION_INDEPENDENT_CODE TRUE)
+target_include_directories ("${TARGET_NAME}_objs" PUBLIC
+ "../include"
+ "${CMAKE_CURRENT_BINARY_DIR}/../include"
+ "${CMAKE_CURRENT_SOURCE_DIR}")
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
- target_compile_definitions("${TARGET_NAME}" PUBLIC "inline=__inline")
-endif()
-set_target_properties("${TARGET_NAME}" PROPERTIES
- DEFINE_SYMBOL EPOXY_EXPORTS)
-if (NOT ANDROID)
- set_target_properties("${TARGET_NAME}" PROPERTIES
- VERSION "1.3.1_yaronct-2"
- SOVERSION "${EPOXY_ABI_VER}")
+ target_compile_definitions ("${TARGET_NAME}_objs" PUBLIC "inline=__inline" EPOXY_EXPORTS)
endif ()
-
-target_include_directories ("${TARGET_NAME}" PUBLIC
- "../include"
- "${CMAKE_CURRENT_BINARY_DIR}/../include"
- "${CMAKE_CURRENT_SOURCE_DIR}")
+set (TARGETS_BUILT_NAMES "")
+if (EPOXY_BUILD_SHARED)
+ list (APPEND TARGETS_BUILT_NAMES "${TARGET_NAME}_shared")
+ add_library ("${TARGET_NAME}_shared" SHARED $<TARGET_OBJECTS:${TARGET_NAME}_objs>)
+ if (WIN32 OR ANDROID)
+ set_target_properties ("${TARGET_NAME}_shared" PROPERTIES
+ OUTPUT_NAME "${TARGET_OUTPUT_NAME}_${TARGET_ABI_VER}")
+ else ()
+ set_target_properties ("${TARGET_NAME}_shared" PROPERTIES
+ OUTPUT_NAME "${TARGET_OUTPUT_NAME}")
+ endif ()
+ if (NOT ANDROID)
+ set_target_properties("${TARGET_NAME}_shared" PROPERTIES
+ VERSION "${TARGET_VER}"
+ SOVERSION "${TARGET_ABI_VER}")
+ endif ()
+endif()
+if (EPOXY_BUILD_STATIC)
+ list (APPEND TARGETS_BUILT_NAMES "${TARGET_NAME}_static")
+ add_library ("${TARGET_NAME}_static" STATIC $<TARGET_OBJECTS:${TARGET_NAME}_objs>)
+ if (WIN32)
+ set_target_properties ("${TARGET_NAME}_static" PROPERTIES
+ OUTPUT_NAME "${TARGET_OUTPUT_NAME}_static_${TARGET_ABI_VER}")
+ else ()
+ set_target_properties ("${TARGET_NAME}_static" PROPERTIES
+ OUTPUT_NAME "${TARGET_OUTPUT_NAME}_${TARGET_ABI_VER}")
+ endif ()
+endif()
install (FILES ${HEADERS} DESTINATION "include/epoxy")
-install (TARGETS "${TARGET_NAME}"
+install (TARGETS ${TARGETS_BUILT_NAMES}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
- INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/Debug/${TARGET_NAME}.pdb"
+ INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/Debug/${TARGET_OUTPUT_NAME}_${TARGET_ABI_VER}.pdb"
DESTINATION lib CONFIGURATIONS Debug)
endif ()
diff --git a/src/dispatch_common.h b/src/dispatch_common.h
index 7ddbce1..262f34d 100644
--- a/src/dispatch_common.h
+++ b/src/dispatch_common.h
@@ -23,12 +23,12 @@
#include <stdbool.h>
+#include "epoxy/gl.h"
+
#if EPOXY_SUPPORT_WGL
#include "epoxy/wgl.h"
#endif
-#include "epoxy/gl.h"
-
#if EPOXY_SUPPORT_GLX
#include "epoxy/glx.h"
#endif