Now can switch between projects and get builds from root

This commit is contained in:
Phil Smith 2017-10-20 17:35:25 -07:00
Родитель 02e8f4d3d4
Коммит bec7a19212
6 изменённых файлов: 24 добавлений и 26 удалений

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

@ -6,16 +6,16 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
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(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 .." )
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()
@ -60,15 +60,7 @@ SET(CMAKE_MACOSX_RPATH ON)
#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.
# Each of these define what we want to issue when building from the top directory while
# being able to issue the same target in sub directories *when* we compile only a subproject.
add_custom_target(xPlatAppx_library)
add_custom_target(MakeXplat_tool)
ADD_DEPENDENCIES(xPlatAppx_library zlibstatic)
ADD_DEPENDENCIES(MakeXplat_tool xPlatAppx_library)
add_subdirectory(lib)
add_subdirectory(src)
ADD_DEPENDENCIES(SRC LIBS)

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

@ -15,7 +15,7 @@
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
@ -37,7 +37,7 @@
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",

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

@ -3,7 +3,9 @@
# Created by Phil Smith (psmith@microsoft.com) on 10/19/2017
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
IF(Win32)
ADD_CUSTOM_TARGET(LIBS)
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)

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

@ -3,8 +3,12 @@
# Created by Phil Smith (psmith@microsoft.com) on 10/19/2017
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
ADD_CUSTOM_TARGET(SRC)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) # main (top) cmake dir
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
add_subdirectory(xPlatAppx)
add_subdirectory(MakeXPlat)
add_subdirectory(MakeXPlat)
ADD_DEPENDENCIES(MakeXplat xPlatAppx)

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

@ -12,9 +12,9 @@ include_directories(
${CMAKE_PROJECT_ROOT}/src/inc
)
add_executable(MakeXPlat
add_executable(MakeXplat
main.cpp
)
ADD_DEPENDENCIES(MakeXPlat xPlatAppx)
target_link_libraries(MakeXPlat xPlatAppx)
ADD_DEPENDENCIES(MakeXplat xPlatAppx)
target_link_libraries(MakeXplat xPlatAppx)

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

@ -33,17 +33,17 @@ set_target_properties(${LIBRARY_NAME} PROPERTIES
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
)
IF(Win32)
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)
#add_dependencies(${PROJECT_NAME} zlibstatic)
target_link_libraries(${PROJECT_NAME} zlibstatic)
ELSE()
MESSAGE("xPlatAppx takes a dynamic dependency on zlib")
#find_library(ZLIB libz.a)
# TODO: Where/how to bind?
ENDIF()