diff --git a/.gitignore b/.gitignore
index 38bd96332d..20ac95d238 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ syntax: glob
debug/*
release/*
profile/*
+src/turi_common.h
dist/turicreateapi*
configure.deps
config.log
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f6fe426d3..6f80c647bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,7 @@ cmake_policy(SET CMP0005 NEW)
cmake_policy(SET CMP0045 OLD)
cmake_policy(SET CMP0046 OLD)
cmake_policy(SET CMP0042 NEW)
+
# Generate a compilation database for use with automated tools like IDE/editor
# plugins. See http://clang.llvm.org/docs/JSONCompilationDatabase.html
@@ -40,11 +41,8 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake")
# Configure the compiler
include(SetupCompiler)
SetupCompiler()
+include(CompilerFlags)
-if(WIN32)
- add_definitions(-DWINVER=0x0600)
- add_definitions(-D_WIN32_WINNT=0x0600)
-endif()
if(${TC_BUILD_IOS})
add_definitions(-DTC_BUILD_IOS)
@@ -56,7 +54,7 @@ if(${TC_BUILD_IOS})
endif()
if(NOT ${TC_BUILD_REMOTEFS})
- add_definitions(-DTC_DISABLE_REMOTEFS)
+ add_compiler_source_define(TC_DISABLE_REMOTEFS)
endif()
# Determine where additional Turi specific cmake modules are
@@ -86,28 +84,29 @@ else()
endif()
+#
+
+
+
# Add global defines
add_definitions(-DTC_BUILD_PATH_BASE="${CMAKE_SOURCE_DIR}")
add_definitions(-DCURL_STATICLIB)
add_definitions(-DIN_TURI_SOURCE_TREE)
-add_definitions(-DFUSION_MAX_VECTOR_SIZE=20)
-add_definitions(-DBOOST_SPIRIT_THREAD_SAFE)
-add_definitions(-DBOOST_THREAD_ONCE_ATOMIC)
-
-# These determine the maximum number of arguments for extension functions
-add_definitions(-DBOOST_FUSION_INVOKE_MAX_ARITY=12)
-add_definitions(-DBOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY=12)
-add_definitions(-DBOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY=12)
-# Workaround for https://svn.boost.org/trac10/ticket/10443 in Boost 1.68.0
-add_definitions(-DBOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
+# Compile specif defines for boost.
+add_compiler_source_define(FUSION_MAX_VECTOR_SIZE=20)
+add_compiler_source_define(BOOST_SPIRIT_THREAD_SAFE)
+add_compiler_source_define(BOOST_THREAD_ONCE_ATOMIC)
+add_compiler_source_define(BOOST_FUSION_INVOKE_MAX_ARITY=12)
+add_compiler_source_define(BOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY=12)
+add_compiler_source_define(BOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY=12)
+add_compiler_source_define(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
# Legal define for Eigen.
-add_definitions(-DEIGEN_MPL2_ONLY)
+add_compiler_source_define(EIGEN_MPL2_ONLY)
# Defines to avoid symbol collisions
-add_definitions(-Dgoogle=_tc_google)
-add_definitions(-DCoreML=_tc_CoreML)
+add_compiler_source_define(google=_tc_google)
#**************************************************************************/
#* */
@@ -175,6 +174,14 @@ endif()
include(FindInt128)
Find_Int128_Types()
+set(_compiler_int128_defs ${INT128_FLAGS})
+separate_arguments(_compiler_int128_defs)
+list(FILTER _compiler_int128_defs INCLUDE REGEX "^-D.*")
+foreach(_def ${_compiler_int128_defs})
+ string(REGEX REPLACE "^-D(.*)$" "\\1" _set_arg ${_def})
+ add_compiler_source_define(${_set_arg})
+endforeach()
+
# Set up defines around a few compiler and language oddities that we have to understand.
include(CompilerOddities)
Set_Compiler_Specific_Flags()
@@ -185,6 +192,7 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
if(CMAKE_USE_PTHREADS_INIT)
add_definitions(-DHAVE_PTHREAD)
+ add_compiler_source_define(HAVE_PTHREAD)
endif()
# Get framework dependencies.
@@ -198,13 +206,13 @@ if (APPLE)
find_library(CORE_VIDEO CoreVideo)
find_library(METAL NAMES Metal)
find_library(METAL_PERFORMANCE_SHADERS NAMES MetalPerformanceShaders)
- set(_TC_APPLE_DEPENDENCIES
+ set(TC_APPLE_DEPENDENCIES
${ACCELERATE} ${CORE_GRAPHICS} ${JAVASCRIPT_CORE} ${FOUNDATION}
${CORE_IMAGE} ${CORE_ML} ${CORE_VIDEO} ${METAL} ${METAL_PERFORMANCE_SHADERS})
if(NOT ${TC_BUILD_IOS})
find_library(APPKIT AppKit)
- set(_TC_APPLE_DEPENDENCIES ${_TC_APPLE_DEPENDENCIES} ${APPKIT})
+ set(TC_APPLE_DEPENDENCIES ${TC_APPLE_DEPENDENCIES} ${APPKIT})
endif()
endif()
@@ -236,9 +244,9 @@ elseif (APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath,@loader_path -Wl,-rpath,@loader_path/..")
else()
# LINUX
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,\\$ORIGIN")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,\\$ORIGIN -Wl,-rpath,\\$ORIGIN/..")
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath,\\$ORIGIN -Wl,-rpath,\\$ORIGIN/..")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ORIGIN")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,$ORIGIN -Wl,-rpath,$ORIGIN/..")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath,$ORIGIN -Wl,-rpath,$ORIGIN/..")
endif()
# Common install locations for deps linked libraries
@@ -297,55 +305,63 @@ include(MakeExecutable)
include(MakeTest)
include(BuildUtilities)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/deps/local/include)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/src/external/boost/boost_1_68_0/)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/src/external/libpng/libpng-1.6.37/)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/src/external/libjpeg/jpeg-8d/)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/src/external/bzip2/)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/src/external/zlib/zlib-1.2.11/)
-include_directories(SYSTEM
- ${CMAKE_SOURCE_DIR}/src/external/coremltools_wrap/)
+
link_directories(${CMAKE_SOURCE_DIR}/deps/local/lib)
link_directories(${CMAKE_SOURCE_DIR}/deps/local/lib64)
+include_directories(${CMAKE_SOURCE_DIR}/deps/local/include/)
include_directories(src)
-include_directories(src/core/system/platform)
-include_directories(SYSTEM src/external)
+include_directories(${CMAKE_BINARY_DIR}/src)
+
+set(TC_EXTERNAL_INCLUDE_SUBDIRS
+ ./
+ boost/boost_1_68_0/
+ libpng/libpng-1.6.37/
+ libjpeg/jpeg-8d/
+ bzip2/
+ google
+ nanomsg/nanomsg-1.0.0/src
+ zlib/zlib-1.2.11/
+ coremltools_wrap/)
if(${TC_BUILD_REMOTEFS})
- include_directories(SYSTEM src/external/aws-sdk-cpp/aws-cpp-sdk-core/include)
- include_directories(SYSTEM src/external/aws-sdk-cpp/aws-cpp-sdk-s3/include)
+ set(TC_EXTERNAL_INCLUDE_SUBDIRS
+ ${TC_EXTERNAL_INCLUDE_SUBDIRS}
+ aws-sdk-cpp/aws-cpp-sdk-core/include
+ aws-sdk-cpp/aws-cpp-sdk-s3/include)
endif()
-include_directories(SYSTEM src/external/google)
-include_directories(SYSTEM src/external/nanomsg/nanomsg-1.0.0/src)
-
+foreach(_dir ${TC_EXTERNAL_INCLUDE_SUBDIRS})
+ include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/src/external/${_dir})
+endforeach()
-# Include all the external dependencies.
-include(ExternalProject)
add_custom_target(external_dependencies)
-file(GLOB packages "${DEPS_CMAKE}/ExternalProject*.cmake")
-foreach(package ${packages})
- get_filename_component(packagename "${package}" NAME_WE)
- #package is of the form ExternalProjectXXX"
- include(${package})
- STRING(SUBSTRING "${packagename}" 15 -1 depname)
- string(TOLOWER ${depname} depname)
- set(package_${depname} requires_${depname} CACHE STRING "Package map")
- add_dependencies(external_dependencies ex_${depname})
-endforeach()
+if(${TC_BUILD_REMOTEFS})
+ if(NOT ${TC_EXTERNAL_DEPS_PREBUILT})
-set(_TC_EXTERNAL_DEPENDENCIES
- openssl libxml2 curl
+# Include all the external dependencies.
+ include(ExternalProject)
+
+ file(GLOB packages "${DEPS_CMAKE}/ExternalProject*.cmake")
+ foreach(package ${packages})
+ get_filename_component(packagename "${package}" NAME_WE)
+ #package is of the form ExternalProjectXXX"
+ include(${package})
+ STRING(SUBSTRING "${packagename}" 15 -1 depname)
+ string(TOLOWER ${depname} depname)
+ set(package_${depname} requires_${depname} CACHE STRING "Package map")
+ add_dependencies(external_dependencies ex_${depname})
+ endforeach()
+ endif()
+
+ set(TC_EXTERNAL_DEPENDENCIES openssl libxml2 curl)
+endif()
+
+set(TC_EXTERNAL_DEPENDENCIES
+ ${TC_EXTERNAL_DEPENDENCIES}
Threads::Threads
${CMAKE_DL_LIBS})
@@ -353,178 +369,161 @@ set(_TC_EXTERNAL_DEPENDENCIES
# Collate all the object targets shared among static and shared library targets
# These are used by C API, unity_shared, etc.
-if(NOT _TC_DEFAULT_SERVER_INITIALIZER)
- set(_TC_DEFAULT_SERVER_INITIALIZER
+if(NOT TC_DEFAULT_SERVER_INITIALIZER)
+ set(TC_DEFAULT_SERVER_INITIALIZER
"${CMAKE_SOURCE_DIR}/src/capi/default_server_initializer.cpp"
)
endif()
-if(NOT TC_DISABLE_OBJECT_BUILDS)
-
-set(_TC_COMMON_OBJECTS
-
- # External dependencies (built from src/external)
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
-
- # Then our own source code
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
- "$"
-)
-
-# TODO we can remove the requirements from here when target_link_libraries
-# works with OBJECT library targets (requires CMake 3.12)
-# See https://gitlab.kitware.com/cmake/cmake/issues/14778
-set(_TC_COMMON_REQUIREMENTS
- # External dependencies (from deps)
- ${_TC_EXTERNAL_DEPENDENCIES}
- nanomsg
- boost
- libbz2
- z
-)
+################################################################################
+#
+# Write out all the definitions into a common header file.
-if(APPLE)
- set(_TC_COMMON_REQUIREMENTS
- # External dependencies (from deps)
- ${_TC_COMMON_REQUIREMENTS}
- ${_TC_APPLE_DEPENDENCIES})
-endif()
-
- set(_TC_COMMON_OBJECTS
- ${_TC_COMMON_OBJECTS}
- "$"
- "$")
+set(TC_COMMON_HEADER_FILE ${CMAKE_SOURCE_DIR}/src/turi_common.h)
-if(APPLE)
- set(_TC_COMMON_OBJECTS
+# Write out all the definitions into a single file
+separate_arguments(TC_COMPILER_SOURCE_DEFINES)
- ${_TC_COMMON_OBJECTS}
- "$"
- "$"
- )
- set(_TC_COMMON_REQUIREMENTS
- ${_TC_COMMON_REQUIREMENTS}
- ${CORE_ML}
- ${CORE_VIDEO}
- ${FOUNDATION}
- )
- if(NOT ${TC_BUILD_IOS})
- set(_TC_COMMON_OBJECTS
- ${_TC_COMMON_OBJECTS}
- "$"
- )
- set(_TC_COMMON_REQUIREMENTS
- ${_TC_COMMON_REQUIREMENTS}
- ${APPKIT}
- ${CORE_GRAPHICS}
- ${JAVASCRIPT_CORE}
- )
- if(HAS_MPS)
- set(_TC_COMMON_OBJECTS
- ${_TC_COMMON_OBJECTS}
- "$"
- )
- set(_TC_COMMON_REQUIREMENTS
- ${_TC_COMMON_REQUIREMENTS}
- ${ACCELERATE}
- ${CORE_IMAGE}
- ${METAL}
- ${METAL_PERFORMANCE_SHADERS}
- )
- endif()
- endif()
-endif()
+set(_file_contents "
+// AUTOGENERATED DEFINITIONS
+// DO NOT EDIT
+#ifndef TC_CODE_DEFINES
+#define TC_CODE_DEFINES
-if(${TC_BUILD_REMOTEFS})
- # object targets that should be included in all APPLE and non-APPLE
- # platforms except for iOS
- set(_TC_COMMON_OBJECTS
- ${_TC_COMMON_OBJECTS}
- "$"
- )
-endif()
+")
+
+foreach(_def ${TC_COMPILER_SOURCE_DEFINES})
-endif() # End disable object builds
+ string(REGEX REPLACE "^([^\\=]+)(=|$)((.*)$|)" "\\1" _variable ${_def})
+ string(REGEX REPLACE "^([^\\=]+)(=|$)((.*)$|)" "#define \\1 \\3" _expression ${_def})
+
+ set(_file_contents "${_file_contents}
+#ifndef ${_variable}
+${_expression}
+#endif
+")
+
+endforeach()
+set(_file_contents "${_file_contents}
+#endif // End ifdef TC_CODE_DEFINES
+")
+file(WRITE ${TC_COMMON_HEADER_FILE} "${_file_contents}")
-if(EXISTS ${CMAKE_SOURCE_DIR}/extensions)
- include_directories(SYSTEM extensions)
- add_subdirectory(extensions)
+
+################################################################################
+
+# Add in src/external as a subdirectory. The rest of the directories are
+# handled directly below
+add_subdirectory(src/external)
+
+set(TC_DEPENDENCIES
+ z libjson libjpeg libpng eigen sparsehash protobuf libbz2
+ lz4 uuid xgboost coremltools_mlmodel boost nanomsg)
+
+
+if(${TC_BUILD_REMOTEFS})
+ set(TC_DEPENDENCIES ${TC_DEPENDENCIES} aws-sdk-cpp)
endif()
-# for build-time generated source code
-include_directories(SYSTEM ${CMAKE_BINARY_DIR}/src)
+###############################################################################
+# Also set up the visualization. This contains a lot of custom scripts,
+# so we preserve it.
-if(EXISTS ${CMAKE_SOURCE_DIR}/subtree)
- include_directories(SYSTEM subtree)
- add_subdirectory(subtree)
+add_subdirectory(src/visualization)
+set(TC_DEPENDENCIES ${TC_DEPENDENCIES}
+ visualization vega_renderer annotation)
+
+################################################################################
+# Add all the framework dependencies
+
+if(APPLE)
+ macro(AddFrameworkDependency _name)
+ find_library(_fwrk_path_${_name} ${_name} REQUIRED)
+ set(TC_DEPENDENCIES ${TC_DEPENDENCIES} "-framework ${_name}")
+ endmacro()
+
+ AddFrameworkDependency(Accelerate)
+ AddFrameworkDependency(CoreGraphics)
+ AddFrameworkDependency(JavaScriptCore)
+ AddFrameworkDependency(Foundation)
+ AddFrameworkDependency(CoreImage)
+ AddFrameworkDependency(CoreML)
+ AddFrameworkDependency(CoreVideo)
+ AddFrameworkDependency(Metal)
+ AddFrameworkDependency(MetalPerformanceShaders)
+ if(NOT ${TC_BUILD_IOS})
+ AddFrameworkDependency(AppKit)
+ endif()
endif()
-add_subdirectory(src)
-add_subdirectory(test)
+FILE(GLOB_RECURSE _tc_core_files
+ CONFIGURE_DEPENDS
+ ${CMAKE_SOURCE_DIR}/src/core/*.h
+ ${CMAKE_SOURCE_DIR}/src/core/*.c
+ ${CMAKE_SOURCE_DIR}/src/core/*.hpp
+ ${CMAKE_SOURCE_DIR}/src/core/*.cpp
+ ${CMAKE_SOURCE_DIR}/src/core/*.m
+ ${CMAKE_SOURCE_DIR}/src/core/*.mm
+
+ ${CMAKE_SOURCE_DIR}/src/ml/*.h
+ ${CMAKE_SOURCE_DIR}/src/ml/*.c
+ ${CMAKE_SOURCE_DIR}/src/ml/*.hpp
+ ${CMAKE_SOURCE_DIR}/src/ml/*.cpp
+ ${CMAKE_SOURCE_DIR}/src/ml/*.m
+ ${CMAKE_SOURCE_DIR}/src/ml/*.mm
+
+ ${CMAKE_SOURCE_DIR}/src/model_server/*.h
+ ${CMAKE_SOURCE_DIR}/src/model_server/*.c
+ ${CMAKE_SOURCE_DIR}/src/model_server/*.hpp
+ ${CMAKE_SOURCE_DIR}/src/model_server/*.cpp
+ ${CMAKE_SOURCE_DIR}/src/model_server/*.m
+ ${CMAKE_SOURCE_DIR}/src/model_server/*.mm
+
+ # TODO: this will be integrated
+ ${CMAKE_SOURCE_DIR}/src/model_server_v2/*.h
+ ${CMAKE_SOURCE_DIR}/src/model_server_v2/*.c
+ ${CMAKE_SOURCE_DIR}/src/model_server_v2/*.hpp
+ ${CMAKE_SOURCE_DIR}/src/model_server_v2/*.cpp
+ ${CMAKE_SOURCE_DIR}/src/model_server_v2/*.m
+ ${CMAKE_SOURCE_DIR}/src/model_server_v2/*.mm
+
+ ${CMAKE_SOURCE_DIR}/src/toolkits/*.h
+ ${CMAKE_SOURCE_DIR}/src/toolkits/*.c
+ ${CMAKE_SOURCE_DIR}/src/toolkits/*.hpp
+ ${CMAKE_SOURCE_DIR}/src/toolkits/*.cpp
+ ${CMAKE_SOURCE_DIR}/src/toolkits/*.m
+ ${CMAKE_SOURCE_DIR}/src/toolkits/*.mm
+
+
+ ${CMAKE_SOURCE_DIR}/src/capi/*.h
+ ${CMAKE_SOURCE_DIR}/src/capi/*.c
+ ${CMAKE_SOURCE_DIR}/src/capi/*.hpp
+ ${CMAKE_SOURCE_DIR}/src/capi/*.cpp
+ ${CMAKE_SOURCE_DIR}/src/capi/*.m
+ ${CMAKE_SOURCE_DIR}/src/capi/*.mm)
+
+list(FILTER _tc_core_files EXCLUDE REGEX ".*/model_server/extensions/.*")
+
+
+add_library(Core SHARED ${_tc_core_files})
+target_link_libraries(Core ${TC_DEPENDENCIES} ${TC_EXTERNAL_DEPENDENCIES})
+add_dependencies(Core external_dependencies ${TC_EXTERNAL_DEPENDENCIES})
+# set_property(TARGET Core APPEND_STRING PROPERTY LINK_FLAGS " -undefined dynamic_lookup")
+source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${_tc_core_files})
+
+set(TC_TARGET_DIR "${CMAKE_SOURCE_DIR}/targets/")
+
+INSTALL(TARGETS Core
+ LIBRARY DESTINATION ${TC_TARGET_DIR}/lib/)
+INSTALL(DIRECTORY src/
+ DESTINATION ${TC_TARGET_DIR}/include/
+ MESSAGE_NEVER
+ FILES_MATCHING REGEX "^.*\.((h)|(hpp))$")
+INSTALL(CODE "execute_process( \
+ COMMAND ${CMAKE_COMMAND} -E create_symlink \
+ ${TC_TARGET_DIR}/include/external/boost/boost_1_68_0/boost \
+ ${TC_TARGET_DIR}/include/boost)")
diff --git a/build_python_wheel.sh b/build_python_wheel.sh
new file mode 100755
index 0000000000..c78d84ec00
--- /dev/null
+++ b/build_python_wheel.sh
@@ -0,0 +1,114 @@
+#!/bin/bash -e
+
+
+function print_help {
+ echo "Configures and builds a specified target."
+ echo
+ echo "Usage: ./build.sh [build options] [configure options]"
+ echo
+ echo "Common Options:"
+ echo " --target-dir, -t The target directory to install artifact to."
+ echo " default: `pwd`/targets."
+ echo
+ echo " --release Build in release mode."
+ echo " --debug Build in debug mode (default)."
+ echo
+ echo " --jobs,-j The number of parallel jobs to run."
+ echo
+ echo " --cleanup,-c Clean up everything before building."
+ echo
+ echo " --skip-configure,-s Skip running ./configure."
+ echo
+ echo " --build-number Set build number. "
+ echo " Defaults to part of git commit hash. "
+ echo
+ echo " All additional options passed through to ./configure."
+ echo
+ exit 1
+} # end of print help
+
+function unknown_option {
+ echo "Unrecognized option: $1"
+ echo "To get help, run ./configure --help"
+ exit 1
+} # end of unknown option
+
+if [[ ${OSTYPE} == darwin* ]] ; then
+ apple=1
+else
+ apple=0
+fi
+
+
+# command flag options
+cleanup=0
+skip_configure=0
+jobs=4
+configure_options=""
+build_mode="release"
+target_dir=`pwd`/targets
+install_sysroot=""
+no_sudo=0
+copy_links=0
+build_number=`git rev-parse --short HEAD || echo "NULL"`
+
+###############################################################################
+#
+# Parse command line configure flags ------------------------------------------
+#
+while [ $# -gt 0 ]
+ do case $1 in
+
+ --cleanup|-c) cleanup=1;;
+
+ --skip-configure|-s) skip_configure=1;;
+
+ --copy-links) copy_links=1;;
+
+ --build-number=*) build_number=${1##--build-number=} ;;
+ --build-number) build_number="$2"; shift;;
+
+ --target-dir=*) target_dir="${1##--target-dir=}" ;;
+ --target-dir|-t) target_dir="$2"; shift ;;
+
+ --jobs=*) jobs=${1##--jobs=} ;;
+ --jobs|-j) jobs=$2; shift ;;
+
+ --help) print_help; exit 0;;
+
+ -D) configure_options="${configure_options} -D $2"; shift ;;
+
+ *) configure_options="${configure_options} $1";;
+ esac
+ shift
+done
+
+build_dir=`pwd`/${build_mode}
+src_dir=`pwd`
+
+
+echo "Setting up build:"
+echo "build_mode = ${build_mode}"
+echo "target_dir = ${target_dir}"
+echo "target = ${target}"
+echo "build_dir = ${build_dir}"
+
+
+if [[ ${cleanup} -eq 1 ]]; then
+ ./configure --cleanup --yes || exit 1
+fi
+
+if [[ ${skip_configure} -eq 0 ]] ; then
+ ./configure ${configure_options} --with-python || exit 1
+else
+ echo "skipping configure script as requested."
+fi
+
+
+install_dir=${target_dir}/python
+rm -rf ${target_dir}/python
+mkdir -p ${target_dir}/python
+
+bash scripts/make_wheel.sh --skip_test --skip_cpp_test --build_number="$build_number" --num_procs=${jobs} --${build_mode} --target-dir="${install_dir}"
+
+
diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake
index 3452338308..a57a789273 100644
--- a/cmake/CompilerFlags.cmake
+++ b/cmake/CompilerFlags.cmake
@@ -2,6 +2,16 @@ include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(CMakeParseArguments)
+# Set a define to be dumped into turi_common.h at the end.
+#
+# A compiler source define is one that determines or switches some part of the
+# compilation, but isn't related to the particular build being asked for. These are dumped into
+# turi_common.h at the end.
+#
+macro(add_compiler_source_define FLAG)
+ add_definitions(-D${FLAG})
+ set(TC_COMPILER_SOURCE_DEFINES "${TC_COMPILER_SOURCE_DEFINES} ${FLAG}")
+endmacro()
# check_and_set_compiler_flag
#
diff --git a/cmake/CompilerOddities.cmake b/cmake/CompilerOddities.cmake
index 60bbabf058..392f8d19fc 100644
--- a/cmake/CompilerOddities.cmake
+++ b/cmake/CompilerOddities.cmake
@@ -1,4 +1,6 @@
include(CheckCXXSourceCompiles)
+include(CompilerFlags)
+
macro(Set_Compiler_Specific_Flags)
@@ -16,7 +18,7 @@ macro(Set_Compiler_Specific_Flags)
if(COMPILER_HAS_IOS_BASE_FAILURE_WITH_ERROR_CODE)
message(STATUS "Compiler supports ios_base::failure(str, error_code)")
- add_definitions(-DCOMPILER_HAS_IOS_BASE_FAILURE_WITH_ERROR_CODE)
+ add_compiler_source_define(COMPILER_HAS_IOS_BASE_FAILURE_WITH_ERROR_CODE)
else()
message(STATUS "Compiler does not support ios_base::failure(str, error_code)")
endif()
@@ -60,11 +62,11 @@ macro(Set_Compiler_Specific_Flags)
message(FATAL_ERROR "Cannot determine noexcept fladg on std::ios_base::failure. See log.")
elseif(COMPILER_HAS_NOEXCEPT_WHAT_ON_EXCEPTIONS_V1)
- add_definitions(-DCOMPILER_MODIFIER_ON_EXCEPTION_WHAT=noexcept)
+ add_compiler_source_define(COMPILER_MODIFIER_ON_EXCEPTION_WHAT=noexcept)
elseif(COMPILER_HAS_NOEXCEPT_WHAT_ON_EXCEPTIONS_V2)
- add_definitions(-DCOMPILER_MODIFIER_ON_EXCEPTION_WHAT=_NOEXCEPT)
+ add_compiler_source_define(DCOMPILER_MODIFIER_ON_EXCEPTION_WHAT=_NOEXCEPT)
else()
- add_definitions(-DCOMPILER_MODIFIER_ON_EXCEPTION_WHAT="")
+ add_compiler_source_define(COMPILER_MODIFIER_ON_EXCEPTION_WHAT=)
endif()
endmacro()
diff --git a/configure b/configure
index f13139eeb5..109a4f2904 100755
--- a/configure
+++ b/configure
@@ -75,6 +75,13 @@ function print_help {
echo " using the [SOURCE:] format. "
echo
echo " -D var=value Specify FLAGS definitions to be passed on to cmake."
+ echo
+ echo " --create-xcode-project Create an xcode project file as xcode/Turi.xcodeproj."
+ echo
+ echo " --build-dependencies Build the external dependencies as part of configure and install them into deps/local."
+ echo " Needed for the xcode project build."
+ echo
+ echo " --skip-dependencies Skip building the dependencies."
echo
echo "Relevant environment variables: "
echo
@@ -151,12 +158,14 @@ with_release=1
with_debug=1
release_opt_for_size=0
debug_opt_for_size=0
+create_xcode_project=0
arch_list=""
target=""
builder="make"
min_ios_version=${IOS_DEFAULT_MIN_VERSION}
min_macos_version=${MACOS_DEFAULT_MIN_VERSION}
enable_codesign=0
+build_dependencies=0
list_source_files=0
DEBUG_DIR="${TURI_HOME}/debug"
@@ -230,6 +239,11 @@ while [ $# -gt 0 ]
--min-macos-version=*) min_macos_version=${1##--min-macos-version=};;
--min-macos-version) min_macos_version=${2}; shift ;;
+ --create-xcode-project) create_xcode_project=1; build_dependencies=1; builder=xcode;;
+
+ --build-dependencies) build_dependencies=1;;
+ --skip-dependencies) skip_dependencies=1;;
+
--list-source-files) list_source_files=1 ;;
*) unknown_option $1 ;;
@@ -335,6 +349,8 @@ mkdir -p ${PWD}/deps/local/bin
CCCMD=`./scripts/find_compiler.sh cc --ccache=$with_ccache --script-dir=${PWD}/deps/local/bin/`
CXXCMD=`./scripts/find_compiler.sh cxx --ccache=$with_ccache --script-dir=${PWD}/deps/local/bin/`
+CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DCMAKE_C_COMPILER=$CCCMD -DCMAKE_CXX_COMPILER=$CXXCMD"
+
echo "Setting C compiler to $CCCMD."
echo "Setting C++ compiler to $CXXCMD."
@@ -346,16 +362,21 @@ CMAKE=`./scripts/find_cmake.sh`
########################################################
# Prepare to build
+
+
+# Configuration flags that are specific to the xcode builder
+CMAKE_XCODE_CONFIG_FLAGS=""
+
set -e
set -o pipefail
case $builder in
xcode)
- CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -GXcode"
- CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=1"
+ CMAKE_XCODE_CONFIG_FLAGS="${CMAKE_XCODE_CONFIG_FLAGS} -GXcode"
+ CMAKE_XCODE_CONFIG_FLAGS="${CMAKE_XCODE_CONFIG_FLAGS} -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=1"
if [[ ! -z ${arch_list} ]] ; then
- CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DCMAKE_OSX_ARCHITECTURES='${arch_list}'"
+ CMAKE_XCODE_CONFIG_FLAGS="${CMAKE_XCODE_CONFIG_FLAGS} -DCMAKE_OSX_ARCHITECTURES='${arch_list}'"
fi
;;
@@ -375,10 +396,10 @@ if [[ ${enable_codesign} == 1 ]] ; then
elif [[ ${builder} == xcode ]] ; then
# Deal with the code signing issues.
- CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY= -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=0 -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM= "
+ CMAKE_XCODE_CONFIG_FLAGS="${CMAKE_XCODE_CONFIG_FLAGS} -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY= -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=0 -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM= "
# This also requires us to skip the code signing when trying to compile targets to check definitions.
- CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
+ CMAKE_XCODE_CONFIG_FLAGS="${CMAKE_XCODE_CONFIG_FLAGS} -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
echo "Skipping code signing."
fi
@@ -424,25 +445,42 @@ if [[ ${build_platform} == macosx ]] ; then
exit 1
fi
fi
-
-build_cmd="$CMAKE \
- $GENERATOR \
- -D CMAKE_C_COMPILER=$CCCMD \
- -D CMAKE_CXX_COMPILER=$CXXCMD \
- ${CMAKE_CONFIG_FLAGS}"
-
-if [[ $with_debug == 1 ]] ; then
- set -x
- mkdir -p ${DEBUG_DIR}
- cd ${DEBUG_DIR} && $build_cmd -DCMAKE_BUILD_TYPE=Debug --config Debug -D CMAKE_CONFIGURATION_TYPES='Debug;Release' ${TURI_HOME}
- set +x
-fi
-if [[ $with_release == 1 ]] ; then
- set -x
- mkdir -p ${RELEASE_DIR}
- cd ${RELEASE_DIR} && $build_cmd -DCMAKE_BUILD_TYPE=Release -D CMAKE_CONFIGURATION_TYPES='Release;Debug' --config Release ${TURI_HOME}
- set +x
-fi
+if [[ $build_dependencies == 1 ]] ; then
+ # Build the dependencies through the make build scripts so they don't have to
+ # be part of the XCode project, which doesn't work.
+
+ deps_build_dir=${TURI_HOME}/deps/build
+ mkdir -p $deps_build_dir
+ cd ${deps_build_dir}
+ $CMAKE ${CMAKE_CONFIG_FLAGS} -DCMAKE_BUILD_TYPE=Release --config Release ${TURI_HOME}
+ make external_dependencies
+ CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DTC_EXTERNAL_DEPS_PREBUILT=1"
+else
+ CMAKE_CONFIG_FLAGS="${CMAKE_CONFIG_FLAGS} -DTC_EXTERNAL_DEPS_PREBUILT=0"
+fi
+
+
+if [[ $create_xcode_project == 1 ]] ; then
+ xcode_proj_dir=${TURI_HOME}/xcode/
+ mkdir -p $xcode_proj_dir
+ cd ${xcode_proj_dir}
+ $CMAKE ${CMAKE_CONFIG_FLAGS} ${CMAKE_XCODE_CONFIG_FLAGS} -DTC_EXTERNAL_DEPS_PREBUILT=1 -DCMAKE_BUILD_TYPE=Debug --config Debug -D CMAKE_CONFIGURATION_TYPES='Debug;Release' ${TURI_HOME}
+
+else
+ if [[ $with_debug == 1 ]] ; then
+ set -x
+ mkdir -p ${DEBUG_DIR}
+ cd ${DEBUG_DIR} && $CMAKE ${CMAKE_CONFIG_FLAGS} ${CMAKE_XCODE_CONFIG_FLAGS} -DCMAKE_BUILD_TYPE=Debug --config Debug -D CMAKE_CONFIGURATION_TYPES='Debug;Release' ${TURI_HOME}
+ set +x
+ fi
+
+ if [[ $with_release == 1 ]] ; then
+ set -x
+ mkdir -p ${RELEASE_DIR}
+ cd ${RELEASE_DIR} && $CMAKE ${CMAKE_CONFIG_FLAGS} ${CMAKE_XCODE_CONFIG_FLAGS} -DCMAKE_BUILD_TYPE=Release -D CMAKE_CONFIGURATION_TYPES='Release;Debug' --config Release ${TURI_HOME}
+ set +x
+ fi
+fi
diff --git a/deps/src/libxml2-2.9.1/ChangeLog b/deps/src/libxml2-2.9.1/ChangeLog
index e06a71da72..ce13596b3a 100644
--- a/deps/src/libxml2-2.9.1/ChangeLog
+++ b/deps/src/libxml2-2.9.1/ChangeLog
@@ -13956,7 +13956,7 @@ Fri Mar 15 19:41:25 CET 2002 Daniel Veillard
xml2-config --cflags should not output
-I$includeprefix/libxml2/libxml because libxml2 header names
clashes with existing names like list.h from C++ stl.
- Includes should be #include so ...
+ Includes should be #include so ...
Fri Mar 15 10:41:50 CET 2002 Daniel Veillard
diff --git a/deps/src/libxml2-2.9.1/bakefile/libxml2.bkl b/deps/src/libxml2-2.9.1/bakefile/libxml2.bkl
index 4efbb73f26..1ec753b062 100644
--- a/deps/src/libxml2-2.9.1/bakefile/libxml2.bkl
+++ b/deps/src/libxml2-2.9.1/bakefile/libxml2.bkl
@@ -517,8 +517,8 @@ $(TAB)copy "$(DOLLAR)(InputPath)" ..\$(CONFIG_DSTNAME)
- $(XMLBASEDIR)$(DIRSEP)include
- $(ICONV_DIR)$(DIRSEP)include
+ $(XMLBASEDIR)$(DIRSEP)include
+ $(ICONV_DIR)$(DIRSEP)include
$(ICONV_DIR)$(DIRSEP)lib
diff --git a/deps/src/libxml2-2.9.1/doc/APIchunk17.html b/deps/src/libxml2-2.9.1/doc/APIchunk17.html
index 070f8ce980..aa5659551f 100644
--- a/deps/src/libxml2-2.9.1/doc/APIchunk17.html
+++ b/deps/src/libxml2-2.9.1/doc/APIchunk17.html
@@ -138,7 +138,7 @@
xmlNanoHTTPFetch
xmlNanoHTTPSave
incl_xmlSchemaType
-includeXINCLUDE_NODE
+include XINCLUDE_NODE
xmlC14NDocDumpMemory
xmlC14NDocSave
xmlC14NDocSaveTo
diff --git a/deps/src/libxml2-2.9.1/doc/APIchunk9.html b/deps/src/libxml2-2.9.1/doc/APIchunk9.html
index 8c4ac1fcab..d33039db91 100644
--- a/deps/src/libxml2-2.9.1/doc/APIchunk9.html
+++ b/deps/src/libxml2-2.9.1/doc/APIchunk9.html
@@ -236,7 +236,7 @@
xmlFreePatternList
xmlXPathNewValueTree
xmlXPathStackIsNodeSet
-XincludeXINCLUDE_NS
+Xinclude XINCLUDE_NS
XINCLUDE_OLD_NS
XmlxmlTextReaderNodeType
XmlNodeTypexmlTextReaderNodeType
diff --git a/deps/src/libxml2-2.9.1/doc/APIfiles.html b/deps/src/libxml2-2.9.1/doc/APIfiles.html
index 65e004be3c..9f740808dc 100644
--- a/deps/src/libxml2-2.9.1/doc/APIfiles.html
+++ b/deps/src/libxml2-2.9.1/doc/APIfiles.html
@@ -1700,7 +1700,7 @@
xmlValidateRoot
xmlValidityErrorFunc
xmlValidityWarningFunc
-
XINCLUDE_FALLBACK
+
XINCLUDE_FALLBACK
XINCLUDE_HREF
XINCLUDE_NODE
XINCLUDE_NS
diff --git a/deps/src/libxml2-2.9.1/doc/devhelp/general.html b/deps/src/libxml2-2.9.1/doc/devhelp/general.html
index 68f9380553..18d997590b 100644
--- a/deps/src/libxml2-2.9.1/doc/devhelp/general.html
+++ b/deps/src/libxml2-2.9.1/doc/devhelp/general.html
@@ -33,6 +33,6 @@
libxml2 API Modules
- DOCBparser - old DocBook SGML parser
HTMLparser - interface for an HTML 4.0 non-verifying parser
HTMLtree - specific APIs to process HTML tree, especially serialization
SAX - Old SAX version 1 handler, deprecated
SAX2 - SAX2 parser interface used to build the DOM tree
c14n - Provide Canonical XML and Exclusive XML Canonicalization
catalog - interfaces to the Catalog handling system
chvalid - Unicode character range checking
debugXML - Tree debugging APIs
dict - string dictionnary
encoding - interface for the encoding conversion functions
entities - interface for the XML entities handling
globals - interface for all global variables of the library
hash - Chained hash tables
list - lists interfaces
nanoftp - minimal FTP implementation
nanohttp - minimal HTTP implementation
parser - the core parser module
parserInternals - internals routines and limits exported by the parser.
pattern - pattern expression handling
relaxng - implementation of the Relax-NG validation
schemasInternals - internal interfaces for XML Schemas
schematron - XML Schemastron implementation
threads - interfaces for thread handling
tree - interfaces for tree manipulation
uri - library of generic URI related routines
valid - The DTD validation
xinclude - implementation of XInclude
xlink - unfinished XLink detection module
xmlIO - interface for the I/O interfaces used by the parser
xmlautomata - API to build regexp automata
xmlerror - error handling
xmlexports - macros for marking symbols as exportable/importable.
xmlmemory - interface for the memory allocator
xmlmodule - dynamic module loading
xmlreader - the XMLReader implementation
xmlregexp - regular expressions handling
xmlsave - the XML document serializer
xmlschemas - incomplete XML Schemas structure implementation
xmlschemastypes - implementation of XML Schema Datatypes
xmlstring - set of routines to process strings
xmlunicode - Unicode character APIs
xmlversion - compile-time version informations
xmlwriter - text writing API for XML
xpath - XML Path Language implementation
xpathInternals - internal interfaces for XML Path Language implementation
xpointer - API to handle XML Pointers
+ DOCBparser - old DocBook SGML parser
HTMLparser - interface for an HTML 4.0 non-verifying parser
HTMLtree - specific APIs to process HTML tree, especially serialization
SAX - Old SAX version 1 handler, deprecated
SAX2 - SAX2 parser interface used to build the DOM tree
c14n - Provide Canonical XML and Exclusive XML Canonicalization
catalog - interfaces to the Catalog handling system
chvalid - Unicode character range checking
debugXML - Tree debugging APIs
dict - string dictionnary
encoding - interface for the encoding conversion functions
entities - interface for the XML entities handling
globals - interface for all global variables of the library
hash - Chained hash tables
list - lists interfaces
nanoftp - minimal FTP implementation
nanohttp - minimal HTTP implementation
parser - the core parser module
parserInternals - internals routines and limits exported by the parser.
pattern - pattern expression handling
relaxng - implementation of the Relax-NG validation
schemasInternals - internal interfaces for XML Schemas
schematron - XML Schemastron implementation
threads - interfaces for thread handling
tree - interfaces for tree manipulation
uri - library of generic URI related routines
valid - The DTD validation
xinclude - implementation of XInclude
xlink - unfinished XLink detection module
xmlIO - interface for the I/O interfaces used by the parser
xmlautomata - API to build regexp automata
xmlerror - error handling
xmlexports - macros for marking symbols as exportable/importable.
xmlmemory - interface for the memory allocator
xmlmodule - dynamic module loading
xmlreader - the XMLReader implementation
xmlregexp - regular expressions handling
xmlsave - the XML document serializer
xmlschemas - incomplete XML Schemas structure implementation
xmlschemastypes - implementation of XML Schema Datatypes
xmlstring - set of routines to process strings
xmlunicode - Unicode character APIs
xmlversion - compile-time version informations
xmlwriter - text writing API for XML
xpath - XML Path Language implementation
xpathInternals - internal interfaces for XML Path Language implementation
xpointer - API to handle XML Pointers