Fix debug symbols not being produce. Ensure that we're always building release builds. Insert temporary dynamic dependency on OpenSSL to unblock ThomasOl until we get CMake building the OpenSSL submodule. Add additional output via CMake to make diagnosing issues in the build a bit clearer.

This commit is contained in:
Phil Smith 2017-10-30 13:04:28 -07:00
Родитель 89e22fa290
Коммит b21266a687
2 изменённых файлов: 60 добавлений и 5 удалений

Просмотреть файл

@ -5,6 +5,10 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
MESSAGE (STATUS "--------------------------------")
MESSAGE (STATUS "xPlatAppx")
MESSAGE (STATUS "--------------------------------")
# Set build options
OPTION(WIN32 "Build for Win32" OFF)
OPTION(MACOS "Build for MacOS" OFF)
@ -14,11 +18,36 @@ OPTION(LINUX "Build for Linux" OFF)
# Enforce that target platform is specified.
IF((NOT WIN32) AND (NOT MACOS) AND (NOT IOS) AND (NOT AOSP) AND (NOT LINUX))
MESSAGE( "You must specify one of: [WIN32|MACOS|IOS|AOSP|LINUX]" )
MESSAGE( "For example, use cmake -DWIN32=on .." )
MESSAGE (STATUS "You must specify one of: [WIN32|MACOS|IOS|AOSP|LINUX]" )
MESSAGE (STATUS "For example, use cmake -DWIN32=on .." )
RETURN()
ELSE()
IF (WIN32)
MESSAGE (STATUS "Building for WIN32")
ENDIF()
IF (MACOS)
MESSAGE (STATUS "Building for MacOS")
ENDIF()
IF (IOS)
MESSAGE (STATUS "Building for iOS")
ENDIF()
IF (AOSP)
MESSAGE (STATUS "Building for Android")
ENDIF()
IF (LINUX)
MESSAGE (STATUS "Building for Linux")
ENDIF()
ENDIF()
# Enforce build type
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF()
MESSAGE (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
IF(MACOS)
# Incredibly, for both clang and g++, while a single compile-and-link
# invocation will create an executable.dSYM/ dir with debug info,
@ -68,9 +97,6 @@ find_package(Git) # QUIET) # if we don't find git or FindGit.cmake is not on the
## The Git module will trigger a reconfiguration for each pull that will bring a new revision on the local repository
SET(VCS_REVISION "-1")
IF(GIT_FOUND)
MESSAGE (STATUS "--------------------------------")
MESSAGE (STATUS "xPlatAppx")
MESSAGE (STATUS "--------------------------------")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
MESSAGE(STATUS "GIT refspec ${GIT_REFSPEC}")

Просмотреть файл

@ -14,6 +14,30 @@ IF(WIN32)
set (XPLATAPPX_API=1)
set (DirectoryObject PAL/FileSystem/Win32/DirectoryObject.cpp)
ELSE()
# TODO: Apple deprecated OpenSSL because there isn't a stable ABI.
# we should just build OpenSSL and statically include the library
# pretty much like how everyone else uses OpenSSL.
# TODO: remove this temporary hack to unblock Thomas after getting
# OpenSSL building and statically linking via the submodule dependency
# https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") # path is populated by brew
find_package(OpenSSL REQUIRED)
IF(OPENSSL_FOUND)
MESSAGE (STATUS "Using OpenSSL ${OPENSSL_VERSION}")
include_directories(
${include_directories}
${OPENSSL_INCLUDE_DIRS}
)
ELSE()
# ... and were done here... :/
MESSAGE (STATUS "OpenSSL NOT FOUND!")
MESSAGE (STATUS "on MacOS run: 'brew install openssl'")
RETURN()
ENDIF()
set (DirectoryObject PAL/FileSystem/POSIX/DirectoryObject.cpp)
ENDIF()
@ -85,3 +109,8 @@ include_directories(
target_link_libraries(${PROJECT_NAME} zlibstatic)
target_link_libraries(${PROJECT_NAME} xerces-c)
IF(OPENSSL_FOUND)
# include the libraries needed to use OpenSSL
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBRARIES})
ENDIF()