cmake: add EFL_SUPPORT_LIB() and simplify/speedup its usage.

generate a static library for src/static_libs and use that as
LIBRARIES for the actual library, for those such as rg_etc that are
used multiple times will even speed up the final build by compiling
only once.

Although not used, they can be made into shared libraries that would
go inside /usr/lib/efl/support/v-1.19/libname.so
This commit is contained in:
Gustavo Sverzut Barbieri 2017-01-27 12:38:52 -02:00
parent 28960d7851
commit 525d1e0629
17 changed files with 200 additions and 54 deletions

View File

@ -31,6 +31,12 @@ include_directories(
include(${CMAKE_SOURCE_DIR}/cmake/config/common.cmake)
EFL_SUPPORT_LIB(lz4)
EFL_SUPPORT_LIB(draw)
EFL_SUPPORT_LIB(freetype)
EFL_SUPPORT_LIB(rg_etc)
EFL_SUPPORT_LIB(triangulator)
EFL_LIB(eina)
EFL_LIB(eolian)
EFL_LIB(eo)

View File

@ -783,6 +783,126 @@ define_property(TARGET PROPERTY EFL_EO_PUBLIC
BRIEF_DOCS "EFL's .eo/.eot files associated with this target and installed"
FULL_DOCS "The list of all .eo or .eot files this target uses and installs")
# EFL_SUPPORT_LIB(Name)
#
# adds a support library as src/static_libs/${Name}, this will
# generate a static library that can be later referred by other
# targets using support-${Name}
#
# This is simiar to EFL_LIB(), however defaults to STATIC libraries
# and if set to SHARED will install to
# lib/efl/support/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
# and it shouldn't set any PUBLIC_HEADERS or PKG_CONFIG_REQUIRES.
function(EFL_SUPPORT_LIB _target)
set(EFL_LIB_CURRENT ${_target})
set(EFL_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/static_libs/${_target})
set(EFL_LIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/static_libs/${_target})
set(DESCRIPTION)
set(PKG_CONFIG_REQUIRES)
set(PKG_CONFIG_REQUIRES_PRIVATE)
set(INCLUDE_DIRECTORIES)
set(SYSTEM_INCLUDE_DIRECTORIES)
set(OUTPUT_NAME)
set(SOURCES)
set(PUBLIC_HEADERS)
set(VERSION)
set(SOVERSION)
set(LIBRARY_TYPE STATIC)
set(OBJECT_DEPENDS)
set(DEPENDENCIES)
set(LIBRARIES)
set(PUBLIC_LIBRARIES)
set(DEFINITIONS)
set(COMPILE_FLAGS)
set(LINK_FLAGS)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/${_target}.cmake OPTIONAL)
include(${EFL_LIB_SOURCE_DIR}/CMakeLists.txt)
if(NOT SOURCES)
message(WARNING "${EFL_LIB_SOURCE_DIR}/CMakeLists.txt defines no SOURCES")
return()
endif()
if(PUBLIC_HEADERS)
message(WARNING "${EFL_LIB_SOURCE_DIR}/CMakeLists.txt should not define PUBLIC_HEADERS, it's not to be installed.")
endif()
if(PKG_CONFIG_REQUIRES)
message(WARNING "${EFL_LIB_SOURCE_DIR}/CMakeLists.txt should not define PKG_CONFIG_REQUIRES. Use PKG_CONFIG_REQUIRES_PRIVATE instead")
endif()
EFL_FILES_TO_ABSOLUTE(_sources ${EFL_LIB_SOURCE_DIR} ${EFL_LIB_BINARY_DIR}
${SOURCES})
EFL_FILES_TO_ABSOLUTE(_obj_deps ${EFL_LIB_SOURCE_DIR} ${EFL_LIB_BINARY_DIR}
${OBJECT_DEPENDS})
EFL_PKG_CONFIG_EVAL(${_target} "${PKG_CONFIG_REQUIRES_PRIVATE}" "${PKG_CONFIG_REQUIRES}")
set(__link_flags ${${_target}_PKG_CONFIG_REQUIRES_PRIVATE_LDFLAGS} ${${_target}_PKG_CONFIG_REQUIRES_LDFLAGS} ${LINK_FLAGS})
set(__compile_flags ${${_target}_PKG_CONFIG_REQUIRES_PRIVATE_CFLAGS} ${${_target}_PKG_CONFIG_REQUIRES_CFLAGS} ${COMPILE_FLAGS})
set(_link_flags)
foreach(_l ${__link_flags})
set(_link_flags "${_link_flags} ${_l}")
endforeach()
set(_compile_flags)
foreach(_c ${__compile_flags})
set(_compile_flags "${_compile_flags} ${_c}")
endforeach()
add_library(support-${_target} ${LIBRARY_TYPE} ${_sources} ${_headers})
set_target_properties(support-${_target} PROPERTIES
OBJECT_DEPENDS "${_obj_deps}"
LINK_FLAGS "${_link_flags}"
COMPILE_FLAGS "${_compile_flags}")
if(DEPENDENCIES)
add_dependencies(support-${_target} ${DEPENDENCIES})
endif()
if(LIBRARIES)
target_link_libraries(support-${_target} LINK_PRIVATE ${LIBRARIES})
endif()
if(PUBLIC_LIBRARIES)
target_link_libraries(support-${_target} PUBLIC ${PUBLIC_LIBRARIES})
endif()
target_include_directories(support-${_target} PUBLIC
${INCLUDE_DIRECTORIES}
${EFL_LIB_SOURCE_DIR}
${EFL_LIB_BINARY_DIR}
)
if(SYSTEM_INCLUDE_DIRECTORIES)
target_include_directories(support-${_target} SYSTEM PUBLIC ${SYSTEM_INCLUDE_DIRECTORIES})
endif()
if(DEFINITIONS)
target_compile_definitions(support-${_target} PRIVATE ${DEFINITIONS})
endif()
if(OUTPUT_NAME)
set_target_properties(support-${_target} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
endif()
if(VERSION AND SOVERSION)
set_target_properties(support-${_target} PROPERTIES
VERSION ${VERSION}
SOVERSION ${SOVERSION})
endif()
if(LIBRARY_TYPE STREQUAL "SHARED")
install(TARGETS support-${_target}
RUNTIME DESTINATION lib/efl/support/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
LIBRARY DESTINATION lib/efl/support/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
else()
set_target_properties(support-${_target} PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/post/${_target}.cmake OPTIONAL)
endfunction()
# EFL_LIB(Name)
#
# adds a library ${Name} automatically setting object/target

View File

@ -155,6 +155,7 @@ lib/ector/gl/shader/ector_gl_shaders.x: $(ECTOR_GL_SHADERS_GEN)
@sh $(srcdir)/lib/ector/gl/shader/gen_shaders.sh
lib_ector_libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_builddir)/src/lib \
-I$(top_builddir)/src/lib/ector \
-I$(top_builddir)/src/lib/ector/cairo \
-I$(top_builddir)/src/lib/ector/software \

View File

@ -407,6 +407,7 @@ lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/include \
-I$(top_srcdir)/src/static_libs/libunibreak \
-I$(top_srcdir)/src/static_libs/draw \
-I$(top_builddir)/src/lib \
-I$(top_builddir)/src/lib/evas/canvas \
-I$(top_builddir)/src/lib/evas/include \
-I$(top_builddir)/src/modules/evas/engines/software_generic \

View File

@ -5,6 +5,10 @@ set(LIBRARIES
efl
emile
m
support-draw
support-freetype
support-rg_etc
support-triangulator
)
set(PUBLIC_LIBRARIES
@ -99,31 +103,6 @@ set(SOURCES
software/ector_software_gradient.c
software/ector_software_rasterizer.c
software/ector_software_surface.c
${CMAKE_SOURCE_DIR}/src/static_libs/draw/draw_main.c
${CMAKE_SOURCE_DIR}/src/static_libs/draw/draw_main_neon.c
${CMAKE_SOURCE_DIR}/src/static_libs/draw/draw_main_sse2.c
${CMAKE_SOURCE_DIR}/src/static_libs/freetype/sw_ft_math.c
${CMAKE_SOURCE_DIR}/src/static_libs/freetype/sw_ft_raster.c
${CMAKE_SOURCE_DIR}/src/static_libs/freetype/sw_ft_stroker.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/etc2_encoder.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc1.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc1.h
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc2.c
${CMAKE_SOURCE_DIR}/src/static_libs/triangulator/triangulator_simple.c
${CMAKE_SOURCE_DIR}/src/static_libs/triangulator/triangulator_simple.h
${CMAKE_SOURCE_DIR}/src/static_libs/triangulator/triangulator_stroker.c
${CMAKE_SOURCE_DIR}/src/static_libs/triangulator/triangulator_stroker.h
)
set(INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/src/static_libs/draw
${CMAKE_SOURCE_DIR}/src/static_libs/freetype
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc
${CMAKE_SOURCE_DIR}/src/static_libs/triangulator
)
add_custom_command(

View File

@ -12,6 +12,7 @@ set(PUBLIC_LIBRARIES
set(LIBRARIES
m
support-rg_etc
)
set(PUBLIC_HEADERS
@ -29,14 +30,6 @@ set(SOURCES
eet_node.c
Eet_private.h
eet_utils.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc1.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc2.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/etc2_encoder.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc1.h
)
set(INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc
)
if(WITH_CRYPTO STREQUAL "gnutls")

View File

@ -8,6 +8,7 @@ set(PKG_CONFIG_REQUIRES_PRIVATE
set(LIBRARIES
eina
m
support-rg_etc
)
set(PUBLIC_HEADERS
@ -24,14 +25,6 @@ set(SOURCES
emile_image.c
emile_main.c
emile_private.h
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/etc2_encoder.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc1.c
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc1.h
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc/rg_etc2.c
)
set(INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/src/static_libs/rg_etc
)
if(WITH_CRYPTO STREQUAL "gnutls")
@ -47,11 +40,5 @@ endif()
if(WITH_LZ4 STREQUAL "system")
list(APPEND PKG_CONFIG_REQUIRES_PRIVATE liblz4)
else()
list(APPEND SOURCES
${CMAKE_SOURCE_DIR}/src/static_libs/lz4/lz4.c
${CMAKE_SOURCE_DIR}/src/static_libs/lz4/lz4.h
${CMAKE_SOURCE_DIR}/src/static_libs/lz4/lz4hc.c
${CMAKE_SOURCE_DIR}/src/static_libs/lz4/lz4hc.h
)
list(APPEND INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src/static_libs/lz4)
list(APPEND LIBRARIES support-lz4)
endif()

View File

@ -0,0 +1,17 @@
set(LIBRARIES
eina
)
set(SOURCES
draw_main.c
draw_main_neon.c
draw_main_sse2.c
)
set(INCLUDE_DIRECTORIES
${CMAKE_BINARY_DIR}/src/lib
)
set(DEPENDENCIES
efl-eo
)

View File

@ -5,7 +5,8 @@
# include <config.h>
#endif
#include <Efl.h>
#include <Eina.h>
#include "efl/interfaces/efl_gfx_types.eot.h"
/* FIXME: naming convention */
typedef void (*RGBA_Comp_Func) (uint32_t *dest, const uint32_t *src, int length, uint32_t mul_col, uint32_t const_alpha);

View File

@ -2,7 +2,6 @@
#include "config.h"
#endif
#include <Ector.h>
#include "draw_private.h"
int _draw_log_dom = -1;

View File

@ -2,7 +2,6 @@
#include "config.h"
#endif
#include <Ector.h>
#include "draw_private.h"
#ifdef BUILD_SSE3

View File

@ -0,0 +1,5 @@
set(SOURCES
sw_ft_math.c
sw_ft_raster.c
sw_ft_stroker.c
)

View File

@ -0,0 +1,6 @@
set(SOURCES
lz4.c
lz4.h
lz4hc.c
lz4hc.h
)

View File

@ -0,0 +1,10 @@
set(LIBRARIES
eina
)
set(SOURCES
etc2_encoder.c
rg_etc1.c
rg_etc1.h
rg_etc2.c
)

View File

@ -0,0 +1,18 @@
set(LIBRARIES
eina
)
set(SOURCES
triangulator_simple.c
triangulator_simple.h
triangulator_stroker.c
triangulator_stroker.h
)
set(INCLUDE_DIRECTORIES
${CMAKE_BINARY_DIR}/src/lib
)
set(DEPENDENCIES
efl-eo
)

View File

@ -1,7 +1,9 @@
#ifndef TRIANGULATOR_SIMPLE_H_
#define TRIANGULATOR_SIMPLE_H_
#include <Efl.h>
#include <Eina.h>
#include "efl/interfaces/efl_gfx_types.eot.h"
typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
typedef struct _Triangulator_Simple Triangulator_Simple;
struct _Triangulator_Simple
@ -40,4 +42,4 @@ void triangulator_simple_free(Triangulator_Simple *st);
*/
void triangulator_simple_process(Triangulator_Simple *st, const Efl_Gfx_Path_Command *cmds, const double *pts, Eina_Bool convex);
#endif // #endif // TRIANGULATOR_SIMPLE_H_
#endif // #endif // TRIANGULATOR_SIMPLE_H_

View File

@ -1,7 +1,9 @@
#ifndef TRIANGULATOR_STROKER_H_
#define TRIANGULATOR_STROKER_H_
#include <Efl.h>
#include <Eina.h>
#include "efl/interfaces/efl_gfx_types.eot.h"
typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
typedef struct _Triangulator_Stroker Triangulator_Stroker;
struct _Triangulator_Stroker