Move zlib to tag 'v1.2.9' and fix building xPlatAppx and MakeXplat via CMake on Win32
This commit is contained in:
Родитель
0cef010d24
Коммит
02e8f4d3d4
|
@ -3,44 +3,62 @@
|
|||
# Created by Phil Smith (psmith@microsoft.com) on 10/19/2017
|
||||
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
# Set build options
|
||||
OPTION(Win32 "Build for Win32" OFF)
|
||||
OPTION(MacOS "Build for MacOS" OFF)
|
||||
OPTION(iOS "Build for iOS" OFF)
|
||||
OPTION(AOSP "Build for Android" OFF)
|
||||
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 .." )
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# TODO: specify c++ 14
|
||||
#ADD_DEFINITIONS(-std=c++14)
|
||||
|
||||
enable_testing() # needed on top-level CMakeLists.txt
|
||||
|
||||
# CMake useful variables
|
||||
set(CMAKE_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
SET(CMAKE_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
|
||||
## Git (and its revision)
|
||||
find_package(Git) # QUIET) # if we don't find git or FindGit.cmake is not on the system we ignore it.
|
||||
|
||||
## GetGitRevisionDescription module to retreive branch and revision information from Git
|
||||
## Starting with Git 1.9 the module will be part of official cMake distribution, until then it has to be
|
||||
## part of the application
|
||||
## 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)
|
||||
SET(VCS_REVISION "-1")
|
||||
IF(GIT_FOUND)
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
message(STATUS "GIT branch ${GIT_REFSPEC}")
|
||||
message(STATUS "GIT revision ${GIT_SHA1}")
|
||||
MESSAGE(STATUS "GIT branch ${GIT_REFSPEC}")
|
||||
MESSAGE(STATUS "GIT revision ${GIT_SHA1}")
|
||||
set (VCS_REVISION ${GIT_SHA1})
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
|
||||
set(VERSION_MAJOR "0")
|
||||
set(VERSION_MINOR "0")
|
||||
set(VERSION_PATCH "0")
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
SET(VERSION_MAJOR "0")
|
||||
SET(VERSION_MINOR "0")
|
||||
SET(VERSION_PATCH "0")
|
||||
SET(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
|
||||
# Mac needed variables
|
||||
# [TODO: adapt as needed]
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
#set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
#set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
#set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
SET(CMAKE_MACOSX_RPATH ON)
|
||||
#SET(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
# Target definitions:
|
||||
# Sub projects must all define a custom target but with different names to avoid conflicts.
|
||||
|
@ -49,6 +67,7 @@ set(CMAKE_MACOSX_RPATH ON)
|
|||
|
||||
add_custom_target(xPlatAppx_library)
|
||||
add_custom_target(MakeXplat_tool)
|
||||
ADD_DEPENDENCIES(xPlatAppx_library zlibstatic)
|
||||
ADD_DEPENDENCIES(MakeXplat_tool xPlatAppx_library)
|
||||
|
||||
add_subdirectory(lib)
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x86-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x86" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DWIN32=ON",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x86-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x86" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DWIN32=ON",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DWIN32=ON",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x64" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-DWIN32=ON",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": ""
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,2 +1,13 @@
|
|||
cmake_minimum_required(VERSION 2.4.4)
|
||||
project (libs)
|
||||
# xplat\lib
|
||||
# Copyright (C) 2017 Microsoft
|
||||
# Created by Phil Smith (psmith@microsoft.com) on 10/19/2017
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
|
||||
IF(Win32)
|
||||
# set(AMD64 OFF CACHE BOOL "Disable building i686 assembly implementation" FORCE)
|
||||
# set(ASM686 OFF CACHE BOOL "Disable building amd64 assembly implementation" FORCE)
|
||||
set(MINGW OFF CACHE BOOL "Only build the static lib" FORCE)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Only build the static lib" FORCE)
|
||||
set(HAVE_OFF64_T OFF CACHE BOOL "no need to build zlib tests as part of build" FORCE)
|
||||
add_subdirectory(zlib)
|
||||
ENDIF()
|
2
lib/zlib
2
lib/zlib
|
@ -1 +1 @@
|
|||
Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f
|
||||
Subproject commit 2fa463bacfff79181df1a5270fb67cc679a53e71
|
|
@ -6,4 +6,15 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
|||
project (MakeXplat)
|
||||
|
||||
set (XPLATAPPX_API 1)
|
||||
add_executable(MakeXPlat main.cpp)
|
||||
|
||||
include_directories(
|
||||
${include_directories}
|
||||
${CMAKE_PROJECT_ROOT}/src/inc
|
||||
)
|
||||
|
||||
add_executable(MakeXPlat
|
||||
main.cpp
|
||||
)
|
||||
|
||||
ADD_DEPENDENCIES(MakeXPlat xPlatAppx)
|
||||
target_link_libraries(MakeXPlat xPlatAppx)
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
#pragma once
|
||||
#ifdef WIN32
|
||||
#define ZLIB_WINAPI
|
||||
#include "zlib.h"
|
||||
#else
|
||||
#include <zlib.h>
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake) # main (top) cmake dir
|
||||
|
||||
include_directories(
|
||||
${include_directories}
|
||||
${CMAKE_PROJECT_ROOT}/lib/zlib
|
||||
)
|
||||
project(xPlatAppx)
|
||||
|
||||
set(LIB_SOURCES
|
||||
AppxBlockMapObject.cpp
|
||||
|
@ -31,7 +28,22 @@ add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES})
|
|||
# Set the build version. It will be used in the name of the lib, with corresponding
|
||||
# symlinks created. SOVERSION could also be specified for api version.
|
||||
set_target_properties(${LIBRARY_NAME} PROPERTIES
|
||||
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
|
||||
FRAMEWORK FALSE
|
||||
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
||||
)
|
||||
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
|
||||
FRAMEWORK FALSE
|
||||
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
||||
)
|
||||
|
||||
IF(Win32)
|
||||
MESSAGE("xPlatAppx takes a static dependency on zlib")
|
||||
include_directories(
|
||||
${include_directories}
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/zlib
|
||||
${CMAKE_PROJECT_ROOT}/lib/zlib
|
||||
)
|
||||
add_dependencies(${PROJECT_NAME} zlibstatic)
|
||||
find_library(ZLIB libz.a)
|
||||
target_link_libraries(${PROJECT_NAME} zlibstatic)
|
||||
ELSE()
|
||||
MESSAGE("xPlatAppx takes a dynamic dependency on zlib")
|
||||
# TODO: Where/how to bind?
|
||||
ENDIF()
|
||||
|
|
Загрузка…
Ссылка в новой задаче