Skip to content

Commit

Permalink
Fixing cmake targets for XCode 12 - making sure unit tests can be run…
Browse files Browse the repository at this point in the history
… from macos project workspace.
  • Loading branch information
petr-pokorny-1 committed Feb 7, 2021
1 parent 62ab3e4 commit 62c6178
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
13 changes: 13 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set_target_properties(mbgl-benchmark PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(mbgl-benchmark mbgl-vendor-benchmark
PROPERTIES
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>
)
set_target_properties(mbgl-benchmark mbgl-vendor-benchmark
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()

# Needed for testing private classes
get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)

Expand Down
2 changes: 0 additions & 2 deletions platform/ios/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.19)

message(source-dir=${CMAKE_SOURCE_DIR} current-dir=${CMAKE_CURRENT_SOURCE_DIR} current-binary-dir=${CMAKE_CURRENT_BINARY_DIR})

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_BINARY_DIR}/mapbox-gl-native )

project (mbgl)
2 changes: 1 addition & 1 deletion platform/ios/platform/ios/ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3712,7 +3712,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 15256;
DEBUG_INFORMATION_FORMAT = dwarf;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_TESTABILITY = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down
2 changes: 2 additions & 0 deletions platform/macos/macos.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 3.19)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11")

# Override default CMake NATIVE_ARCH_ACTUAL
Expand Down Expand Up @@ -149,6 +150,7 @@ target_link_libraries(
set_property(TARGET mbgl-benchmark-runner PROPERTY FOLDER Executables)
set_property(TARGET mbgl-test-runner PROPERTY FOLDER Executables)
set_property(TARGET mbgl-render-test-runner PROPERTY FOLDER Executables)
set_target_properties(mbgl-benchmark-runner mbgl-test-runner mbgl-render-test-runner PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] "YES")

# Disable benchmarks in CI as they run in VM environment
if(NOT DEFINED ENV{CI})
Expand Down
10 changes: 10 additions & 0 deletions render-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set_target_properties(mbgl-render-test PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(mbgl-render-test PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
set_target_properties(mbgl-render-test
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()

# FIXME: Should not use core private interface
target_include_directories(
mbgl-render-test
Expand Down
10 changes: 10 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set_target_properties(mbgl-test PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(mbgl-test mbgl-vendor-googletest PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
set_target_properties(mbgl-test mbgl-vendor-googletest
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()

# Needed for testing private classes
get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)

Expand Down

0 comments on commit 62c6178

Please sign in to comment.