comparison cmake/function/MalikaniaDefineLibrary.cmake @ 182:3107ce017c3a

Misc: switch back to SDL Qt Quick and QML was an exciting experiment but it's definitely not enough flexible and easy to use for game development. Using SDL2 will let us focusing on our own drawing functions without any kind of overhead. While here, start massive cleanup.
author David Demelier <markand@malikania.fr>
date Fri, 19 Oct 2018 20:18:19 +0200
parents 3e3040d085b5
children 387f6b0a5420
comparison
equal deleted inserted replaced
181:fbfc2555bda5 182:3107ce017c3a
21 # ------------------------ 21 # ------------------------
22 # 22 #
23 # malikania_define_library( 23 # malikania_define_library(
24 # TARGET The target name 24 # TARGET The target name
25 # SOURCES The sources 25 # SOURCES The sources
26 # ASSETS (Optional) Additional assets files
26 # FLAGS (Optional) List of flags 27 # FLAGS (Optional) List of flags
27 # PRIVATE_INCLUDES (Optional) List of includes only for building the library 28 # PRIVATE_INCLUDES (Optional) List of includes only for building the library
28 # PUBLIC_INCLUDES (Optional) List of public includes to share with the library users 29 # PUBLIC_INCLUDES (Optional) List of public includes to share with the library users
29 # LIBRARIES (Optional) List of libraries to link against 30 # LIBRARIES (Optional) List of libraries to link against
30 # ) 31 # )
33 # However, additional PRIVATE_INCLUDES and PUBLIC_INCLUDES are available. 34 # However, additional PRIVATE_INCLUDES and PUBLIC_INCLUDES are available.
34 # 35 #
35 36
36 include(CMakeParseArguments) 37 include(CMakeParseArguments)
37 38
39 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaBuildAssets.cmake)
38 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaVeraCheck.cmake) 40 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaVeraCheck.cmake)
39 41
40 function(malikania_define_library) 42 function(malikania_define_library)
41 set(singleArgs TARGET) 43 set(singleArgs TARGET)
42 set(multiArgs SOURCES FLAGS PRIVATE_INCLUDES PUBLIC_INCLUDES LIBRARIES) 44 set(multiArgs ASSETS SOURCES FLAGS PRIVATE_INCLUDES PUBLIC_INCLUDES LIBRARIES)
43 set(mandatory TARGET SOURCES) 45 set(mandatory TARGET SOURCES)
44 46
45 cmake_parse_arguments(LIB "" "${singleArgs}" "${multiArgs}" ${ARGN}) 47 cmake_parse_arguments(LIB "" "${singleArgs}" "${multiArgs}" ${ARGN})
46 48
47 if (NOT LIB_TARGET) 49 if (NOT LIB_TARGET)
49 endif () 51 endif ()
50 if (NOT LIB_SOURCES) 52 if (NOT LIB_SOURCES)
51 message(FATAL_ERROR "Missing SOURCES parameter") 53 message(FATAL_ERROR "Missing SOURCES parameter")
52 endif () 54 endif ()
53 55
56 # Enable assets for libraries.
57 malikania_build_assets("${LIB_ASSETS}" assets)
58
54 # Create the shared library. 59 # Create the shared library.
55 add_library(${LIB_TARGET} SHARED ${LIB_SOURCES}) 60 add_library(${LIB_TARGET} SHARED ${LIB_SOURCES} ${assets} ${LIB_ASSETS})
56 target_link_libraries(${LIB_TARGET} ${LIB_LIBRARIES}) 61 target_link_libraries(${LIB_TARGET} ${LIB_LIBRARIES})
57 target_include_directories( 62 target_include_directories(
58 ${LIB_TARGET} 63 ${LIB_TARGET}
59 PRIVATE 64 PRIVATE
65 ${CMAKE_CURRENT_BINARY_DIR}/assets
60 ${LIB_PRIVATE_INCLUDES} 66 ${LIB_PRIVATE_INCLUDES}
61 PUBLIC 67 PUBLIC
62 ${CMAKE_CURRENT_SOURCE_DIR} 68 ${CMAKE_CURRENT_SOURCE_DIR}
63 ${LIB_PUBLIC_INCLUDES} 69 ${LIB_PUBLIC_INCLUDES}
64 ) 70 )