Skip to content

Commit

Permalink
Fix the issue of generating xcode projects for testing targerts. (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
domchen authored Jan 4, 2024
1 parent 6f63d99 commit cd4417e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ test/baseline/.cache
.vscode
ios/TGFX
mac/TGFX
/TGFX
24 changes: 15 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
endif ()
endif ()

add_vendor_target(TGFX STATIC_VENDORS ${TGFX_STATIC_VENDORS} SHARED_VENDORS ${TGFX_SHARED_VENDORS})
add_vendor_target(tgfx-vendor STATIC_VENDORS ${TGFX_STATIC_VENDORS} SHARED_VENDORS ${TGFX_SHARED_VENDORS})
find_vendor_libraries(tgfx-vendor STATIC TGFX_VENDOR_STATIC_LIBRARIES SHARED TGFX_VENDOR_SHARED_LIBRARIES)
list(APPEND TGFX_STATIC_LIBS ${TGFX_VENDOR_STATIC_LIBRARIES})
list(APPEND TGFX_SHARED_LIBS ${TGFX_VENDOR_SHARED_LIBRARIES})
list(APPEND TGFX_VENDOR_TARGETS ${TGFX_VENDOR_TARGET})

if (HasParent)
set(TGFX_STATIC_LIBS ${TGFX_STATIC_LIBS} PARENT_SCOPE)
Expand All @@ -392,7 +392,8 @@ if (TGFX_EXCLUDE_FILES)
list(REMOVE_ITEM TGFX_FILES ${TGFX_EXCLUDE_FILES})
endif ()

add_library(tgfx STATIC ${TGFX_VENDOR_TARGETS} ${TGFX_FILES})
add_library(tgfx STATIC ${TGFX_FILES})
add_dependencies(tgfx tgfx-vendor)
target_compile_definitions(tgfx PUBLIC ${TGFX_DEFINES})
target_compile_options(tgfx PUBLIC ${TGFX_COMPILE_OPTIONS})
target_include_directories(tgfx PUBLIC include PRIVATE src)
Expand All @@ -401,6 +402,7 @@ merge_libraries_into(tgfx ${TGFX_STATIC_LIBS})
target_link_libraries(tgfx ${TGFX_SHARED_LIBS})
set_target_properties(tgfx PROPERTIES PREFIX "")


if (TGFX_BUILD_DRAWERS)
file(GLOB_RECURSE DRAWER_FILES drawers/src/*.*)
add_library(tgfx-drawers STATIC ${DRAWER_FILES})
Expand Down Expand Up @@ -428,9 +430,9 @@ if (TGFX_BUILD_TESTS)
list(APPEND TGFX_TEST_LIBS tgfx-drawers tgfx ${TGFX_SHARED_LIBS})
list(APPEND TGFX_TEST_INCLUDES src test/src third_party/json/include)

add_vendor_target(TEST STATIC_VENDORS harfbuzz googletest)
add_vendor_target(test-vendor STATIC_VENDORS harfbuzz googletest)
find_vendor_libraries(test-vendor STATIC TEST_VENDOR_STATIC_LIBRARIES)
list(APPEND TGFX_TEST_LIBS ${TEST_VENDOR_STATIC_LIBRARIES})
list(APPEND TGFX_TEST_VENDOR_TARGETS ${TEST_VENDOR_TARGET})
list(APPEND TGFX_TEST_INCLUDES
third_party/harfbuzz/src
third_party/googletest/googletest
Expand All @@ -451,29 +453,33 @@ if (TGFX_BUILD_TESTS)
endif ()

# used to update the local md5 data for baseline testing.
add_executable(UpdateBaseline ${TGFX_TEST_VENDOR_TARGETS} ${TGFX_TEST_FILES})
add_executable(UpdateBaseline ${TGFX_TEST_FILES})
add_dependencies(UpdateBaseline test-vendor)
target_include_directories(UpdateBaseline PUBLIC ${TGFX_TEST_INCLUDES})
target_compile_definitions(UpdateBaseline PUBLIC ${TGFX_TEST_DEFINES} UPDATE_BASELINE)
target_compile_options(UpdateBaseline PUBLIC ${TGFX_TEST_COMPILE_OPTIONS})
target_link_options(UpdateBaseline PUBLIC ${TGFX_TEST_LINK_OPTIONS})
target_link_libraries(UpdateBaseline ${TGFX_TEST_LIBS})

# used to generate baseline images to the out/ directory. each image has a "_base" suffix.
add_executable(GenerateImages ${TGFX_TEST_VENDOR_TARGETS} ${TGFX_TEST_FILES})
add_executable(GenerateImages ${TGFX_TEST_FILES})
add_dependencies(GenerateImages test-vendor)
target_include_directories(GenerateImages PUBLIC ${TGFX_TEST_INCLUDES})
target_compile_definitions(GenerateImages PUBLIC ${TGFX_TEST_DEFINES} GENERATOR_BASELINE_IMAGES)
target_compile_options(GenerateImages PUBLIC ${TGFX_TEST_COMPILE_OPTIONS})
target_link_options(GenerateImages PUBLIC ${TGFX_TEST_LINK_OPTIONS})
target_link_libraries(GenerateImages ${TGFX_TEST_LIBS})

add_executable(TGFXUnitTest ${TGFX_TEST_VENDOR_TARGETS} ${TGFX_TEST_FILES})
add_executable(TGFXUnitTest ${TGFX_TEST_FILES})
add_dependencies(TGFXUnitTest test-vendor)
target_include_directories(TGFXUnitTest PUBLIC ${TGFX_TEST_INCLUDES})
target_compile_definitions(TGFXUnitTest PUBLIC ${TGFX_TEST_DEFINES} SKIP_FRAME_COMPARE)
target_compile_options(TGFXUnitTest PUBLIC ${TGFX_TEST_COMPILE_OPTIONS})
target_link_options(TGFXUnitTest PUBLIC ${TGFX_TEST_LINK_OPTIONS})
target_link_libraries(TGFXUnitTest ${TGFX_TEST_LIBS})

add_executable(TGFXFullTest ${TGFX_TEST_VENDOR_TARGETS} ${TGFX_TEST_FILES})
add_executable(TGFXFullTest ${TGFX_TEST_FILES})
add_dependencies(TGFXFullTest test-vendor)
target_compile_definitions(TGFXFullTest PUBLIC ${TGFX_TEST_DEFINES})
target_compile_options(TGFXFullTest PUBLIC ${TGFX_TEST_COMPILE_OPTIONS})
target_include_directories(TGFXFullTest PUBLIC ${TGFX_TEST_INCLUDES})
Expand Down
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"common": [
{
"url": "${PAG_GROUP}/vendor_tools.git",
"commit": "9787ea5507fe62bb02cb4de49cf5a87cfffbc1df",
"commit": "9f9e7ce5d0e5dcda8f9dbff0dc5115ed033ecae8",
"dir": "third_party/vendor_tools"
},
{
Expand Down

0 comments on commit cd4417e

Please sign in to comment.