From 821b8ad4e7f9e986c63c77456572df8013e23dbd Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 4 Jul 2019 18:00:03 +0200 Subject: [PATCH] Fixed library building for windows --- cmake/config/tearoot-client.cmake | 11 ++-- helper.txt | 7 +-- scripts/build_helper.sh | 67 +++++++++++++++++++++---- third_party/CXXTerminal | 2 +- third_party/StringVariable | 2 +- third_party/build.sh | 8 +-- third_party/build_boringssl.sh | 78 ++++++++++++++++++----------- third_party/build_cxxterminal.sh | 4 +- third_party/build_datapipes.sh | 42 +++++++++------- third_party/build_ed25519.sh | 13 ++++- third_party/build_jsoncpp.sh | 6 ++- third_party/build_libevent.sh | 7 ++- third_party/build_opus.sh | 17 ++++++- third_party/build_portaudio.sh | 4 +- third_party/build_protobuf.sh | 4 +- third_party/build_soxr.sh | 4 +- third_party/build_stringvariable.sh | 6 ++- third_party/build_threadpool.sh | 4 +- third_party/build_tom.sh | 19 +++++-- third_party/build_yaml.sh | 4 +- third_party/ed25519 | 2 +- third_party/protobuf | 2 +- third_party/tomcrypt | 2 +- third_party/tommath | 2 +- 24 files changed, 224 insertions(+), 93 deletions(-) diff --git a/cmake/config/tearoot-client.cmake b/cmake/config/tearoot-client.cmake index 36fbc63..6053bd1 100644 --- a/cmake/config/tearoot-client.cmake +++ b/cmake/config/tearoot-client.cmake @@ -1,5 +1,10 @@ -set(BUILD_OS_TYPE "linux") -set(BUILD_OS_ARCH "amd64") +if (WIN32) + set(BUILD_OS_TYPE "win32") + set(BUILD_OS_ARCH "amd64") +else() + set(BUILD_OS_TYPE "linux") + set(BUILD_OS_ARCH "amd64") +endif () if(NOT LIBRARY_PATH OR LIBRARY_PATH STREQUAL "") message(FATAL_ERROR "Missing library path") @@ -12,7 +17,7 @@ SET(DataPipes_ROOT_DIR "${LIBRARY_PATH}/DataPipes/${BUILD_OUTPUT}") SET(StringVariable_ROOT_DIR "${LIBRARY_PATH}/StringVariable/${BUILD_OUTPUT}") SET(ThreadPool_ROOT_DIR "${LIBRARY_PATH}/Thread-Pool/${BUILD_OUTPUT}") SET(ed25519_ROOT_DIR "${LIBRARY_PATH}/ed25519/${BUILD_OUTPUT}") -SET(Libevent_DIR "${LIBRARY_PATH}/libevent/${BUILD_OUTPUT}") +SET(Libevent_DIR "${LIBRARY_PATH}/libevent/${BUILD_OUTPUT}/cmake") SET(soxr_ROOT_DIR "${LIBRARY_PATH}/soxr/${BUILD_OUTPUT}") SET(PortAudio_ROOT_DIR "${LIBRARY_PATH}/portaudio/${BUILD_OUTPUT}") SET(fvad_ROOT_DIR "${LIBRARY_PATH}/libfvad/${BUILD_OUTPUT}") diff --git a/helper.txt b/helper.txt index b0f33be..3e2b32e 100644 --- a/helper.txt +++ b/helper.txt @@ -4,11 +4,8 @@ git submodule update --init --recursive -f #Resetting local made changes git submodule foreach git reset --hard - - - -build_event.sh updated! - +CMake defs: +-DNO_EMBETTED_LIBEVENT=ON -DCMAKE_MODULE_PATH=C:/Users/WolverinDEV/TeaRoot-Client/cmake/ -DCMAKE_INCLUDE_FILE=C:/Users/WolverinDEV/TeaRoot-Client/cmake/config/tearoot-client.cmake -DLIBRARY_PATH=C:/Users/WolverinDEV/TeaRoot-Client/third_party build_os_type: [linux|win32] diff --git a/scripts/build_helper.sh b/scripts/build_helper.sh index 745f8ba..1865185 100644 --- a/scripts/build_helper.sh +++ b/scripts/build_helper.sh @@ -109,6 +109,10 @@ contains_element () { return 1 } +#Set env variable 'make_targets' as array to specify specific targets +#Possible actions: +# - _run_before_build="command" +# - _run_before_install="command" function cmake_build() { if [[ -z "${build_os_type}" ]]; then echo "Could not build cmake file because build os type has not been specified!" @@ -183,7 +187,9 @@ function cmake_build() { #Cut of the start space [[ ! -z ${definition_string} ]] && definition_string=${definition_string:1} - local cmake_command="cmake $base_path$base_path_suffix ${final_parms[*]} ${definition_string} ${CMAKE_OPTIONS}" + local _cmake_generator="" + [[ "${build_os_type}" == "win32" ]] && _cmake_generator=" -G\"Visual Studio 14 2015 Win64\"" + local cmake_command="cmake $base_path$base_path_suffix ${_cmake_generator} ${final_parms[*]} ${definition_string} ${CMAKE_OPTIONS}" local origin_directory=$(pwd) cd ${build_path} @@ -197,27 +203,66 @@ function cmake_build() { echo "Executing cmake command:" echo "> $cmake_command" - eval "${cmake_command}" + eval ${cmake_command} if [[ $? -ne 0 ]]; then echo "Failed to generate build file with cmake! Status code: $?" return 1 fi - local make_command="make ${CMAKE_MAKE_OPTIONS}" - echo "Executing make command:" - echo "> $make_command" - eval "${make_command}" - if [[ $? -ne 0 ]]; then - echo "Failed to build project with make! Status code: $?" + local make_command="" + local make_command_target="" + local make_install_command="" + if [[ "${build_os_type}" == "linux" ]]; then + make_command="make ${CMAKE_MAKE_OPTIONS}" + make_command_target="make ${CMAKE_MAKE_OPTIONS} %target%" + make_install_command="make install" + elif [[ "${build_os_type}" == "win32" ]]; then + _config="" + [[ ! -z "${final_definitions["CMAKE_BUILD_TYPE"]}" ]] && _config="--config ${final_definitions["CMAKE_BUILD_TYPE"]}" + + make_command="cmake --build . -j8 ${_config}" + make_command_target="cmake --build . --target %target% -j8 ${_config}" + make_install_command="cmake --build . ${_config} --target install -j8" + else + echo "OS type unknown" return 1 fi - local make_install_command="make install" - echo "Executing make install command:" + [[ ! -z "${_run_before_build}" ]] && { + eval "${_run_before_build}" + check_err_exit $1 "Failed to execute prebuild command" + } + + if [[ ! -z "${make_targets}" ]]; then + for target in ${make_targets[@]}; do + make_command=$(echo "${make_command_target}" | sed "s:%target%:$target:g") + echo "Executing build command for target ${target}:" + echo "> $make_command" + eval "${make_command}" + if [[ $? -ne 0 && "$?" != "0" ]]; then + echo "Failed to build project! Status code: $?" + return 1 + fi + done + else + echo "Executing build command:" + echo "> $make_command" + eval "${make_command}" + if [[ $? -ne 0 && "$?" != "0" ]]; then + echo "Failed to build project! Status code: $?" + return 1 + fi + fi + [[ ! -z "${_run_before_install}" ]] && { + eval "${_run_before_install}" + check_err_exit $1 "Failed to execute preinstall command" + } + + echo "Executing install command:" echo "> $make_install_command" eval "${make_install_command}" if [[ $? -ne 0 ]]; then - echo "Failed to install project build! Status code: $?" + echo "Failed to install project! Status code: $?" return 1 fi diff --git a/third_party/CXXTerminal b/third_party/CXXTerminal index a765e56..d93597c 160000 --- a/third_party/CXXTerminal +++ b/third_party/CXXTerminal @@ -1 +1 @@ -Subproject commit a765e5688c7c54f2c57d0074d5aee22f2e7eb8d4 +Subproject commit d93597ce7e5bd0f22bf27be5d89535e34de70fd1 diff --git a/third_party/StringVariable b/third_party/StringVariable index 4d6788c..f86cb9d 160000 --- a/third_party/StringVariable +++ b/third_party/StringVariable @@ -1 +1 @@ -Subproject commit 4d6788cb3d42dde4c5e6064dc2b79e99db4446d9 +Subproject commit f86cb9dedd9a21d7c816bbb61714dfa90ccef515 diff --git a/third_party/build.sh b/third_party/build.sh index 57450b2..2fec67f 100755 --- a/third_party/build.sh +++ b/third_party/build.sh @@ -23,9 +23,9 @@ function exec_script() { } exec_script build_boringssl.sh -exec_script build_breakpad.sh #Not required for windows TeaClient -exec_script build_event.sh -exec_script build_cxxterminal.sh #Depends on libevent; Not required for TeaClient +[[ ${build_os_type} != "win32" ]] && exec_script build_breakpad.sh #Not required for windows TeaClient +exec_script build_libevent.sh +#exec_script build_cxxterminal.sh #Depends on libevent; Not required for TeaClient exec_script build_datapipes.sh exec_script build_ed25519.sh exec_script build_jsoncpp.sh @@ -39,7 +39,7 @@ exec_script build_stringvariable.sh exec_script build_threadpool.sh exec_script build_tom.sh exec_script build_yaml.sh -exec_script build_jemalloc.sh #Not required for TeaClient +[[ ${build_os_type} != "win32" ]] && exec_script build_jemalloc.sh #Not required for TeaClient #Log the result end_task "build_third_party" "Build all libraries successfully" \ No newline at end of file diff --git a/third_party/build_boringssl.sh b/third_party/build_boringssl.sh index 5c5c64b..24fceb2 100755 --- a/third_party/build_boringssl.sh +++ b/third_party/build_boringssl.sh @@ -5,42 +5,62 @@ library_path="boringssl" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cd boringssl/ -[[ $? -ne 0 ]] && exit 1 -if [[ ! -d lib ]]; then - mkdir lib && cd lib - ln -s ../build/ssl/libssl.so . - ln -s ../build/crypto/libcrypto.so . - cd .. -fi -cat include/openssl/opensslv.h | grep "OPENSSL_VERSION_NUMBER" &> /dev/null -if [[ $? -ne 0 ]]; then - echo "#if false -# define OPENSSL_VERSION_NUMBER 0x1010008fL -#endif" > include/openssl/opensslv.h +if [[ ${build_os_type} == "linux" ]]; then + sudo apt-get install golang-go + check_err_exit ${library_path} "Failed to install libraries!" + + cd boringssl/ + [[ $? -ne 0 ]] && exit 1 + if [[ ! -d lib ]]; then + mkdir lib && cd lib + ln -s ../build/ssl/libssl.so . + ln -s ../build/crypto/libcrypto.so . + cd .. + fi + cat include/openssl/opensslv.h | grep "OPENSSL_VERSION_NUMBER" &> /dev/null + if [[ $? -ne 0 ]]; then + echo "#if false + # define OPENSSL_VERSION_NUMBER 0x1010008fL + #endif" > include/openssl/opensslv.h + fi fi -if [[ -d build ]]; then +generate_build_path "${library_path}" +if [[ -d ${build_path} ]]; then echo "Removing old build directory" - rm -r build + rm -r ${build_path} fi -mkdir build +mkdir -p ${build_path} check_err_exit ${library_path} "Failed to create build directory" -cd build +cd ${build_path} check_err_exit ${library_path} "Failed to enter build directory" -sudo apt-get install golang-go -check_err_exit ${library_path} "Failed to install libraries!" -if [[ "x86" == "${build_os_arch}" ]]; then - echo "Build boring SSL in 32 bit mode!" - T32="-DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake" +if [[ ${build_os_type} == "linux" ]]; then + if [[ "x86" == "${build_os_arch}" ]]; then + echo "Build boring SSL in 32 bit mode!" + T32="-DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake" + fi + + cmake ../../ -DOPENSSL_NO_ASM=ON -DCMAKE_CXX_FLAGS="-fPIC -Wno-error=format= -Wno-error=format-extra-args -Wno-error=misleading-indentation -Wno-error=maybe-uninitialized ${CXX_FLAGS}" -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS="${C_FLAGS} -fPIC -Wno-error=misleading-indentation -Wno-error=maybe-uninitialized" -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=1 ${T32} + check_err_exit ${library_path} "Failed to execute cmake!" + make ${CMAKE_MAKE_OPTIONS} + check_err_exit ${library_path} "Failed to build!" + #make install +elif [[ ${build_os_type} == "win32" ]]; then + cmake ../../ -G"Visual Studio 14 2015 Win64" -DOPENSSL_NO_ASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" + check_err_exit ${library_path} "Failed generate build files!" + + cmake --build . --target crypto --config release -j 8 + #MSBuild.exe //p:Configuration=Release //p:Platform=x64 crypto/crypto.vcxproj + check_err_exit ${library_path} "Failed to build crytp!" + + cmake --build . --target ssl --config release -j 8 + #MSBuild.exe //p:Configuration=Release //p:Platform=x64 ssl/ssl.vcxproj + check_err_exit ${library_path} "Failed to build ssl!" +else + echo "Invalid OS!" + exit 1 fi - -cmake .. -DOPENSSL_NO_ASM=ON -DCMAKE_CXX_FLAGS="-fPIC -Wno-error=format= -Wno-error=format-extra-args -Wno-error=misleading-indentation -Wno-error=maybe-uninitialized ${CXX_FLAGS}" -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS="${C_FLAGS} -fPIC -Wno-error=misleading-indentation -Wno-error=maybe-uninitialized" -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=1 ${T32} -check_err_exit ${library_path} "Failed to execute cmake!" -make ${CMAKE_MAKE_OPTIONS} -check_err_exit ${library_path} "Failed to build!" -#make install -cd ../.. +cd ../../../ set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_cxxterminal.sh b/third_party/build_cxxterminal.sh index 5504621..3eff8eb 100755 --- a/third_party/build_cxxterminal.sh +++ b/third_party/build_cxxterminal.sh @@ -6,6 +6,8 @@ library_path="CXXTerminal" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBEVENT=ON -DNO_EMBETTED_LIBEVENT=ON -DLibevent_DIR="`pwd`/libevent/out/${build_os_type}_${build_os_arch}/" +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" +cmake_build ${library_path} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="${_fpic}" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBEVENT=ON -DNO_EMBETTED_LIBEVENT=ON -DLibevent_DIR="`pwd`/libevent/out/${build_os_type}_${build_os_arch}/" check_err_exit ${library_path} "Failed to build CXXTerminal!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_datapipes.sh b/third_party/build_datapipes.sh index dce7a73..0d150c3 100755 --- a/third_party/build_datapipes.sh +++ b/third_party/build_datapipes.sh @@ -6,26 +6,32 @@ library_path="DataPipes" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cd DataPipes/ +if [[ ${build_os_type} != "win32" ]]; then + cd DataPipes/ -echo "Testing for libnice" + #echo "Testing for libnice" + #dpkg-query -l libnice-dev2 &>/dev/null + #if [[ $? -ne 0 ]]; then + # echo "Installing libnice" + # sudo apt-get update + # sudo apt-get install -yes --force-yes libnice-dev + #else + # echo "libnice already installed" + #fi -#dpkg-query -l libnice-dev2 &>/dev/null -#if [[ $? -ne 0 ]]; then -# echo "Installing libnice" -# sudo apt-get update -# sudo apt-get install -yes --force-yes libnice-dev -#else -# echo "libnice already installed" -#fi -./build_usrsctp.sh -check_err_exit ${library_path} "Failed to build usrsctp!" -./build_srtp.sh -check_err_exit ${library_path} "Failed to build srtp!" -./build_sdptransform.sh -check_err_exit ${library_path} "Failed to build sdptransform!" -cd .. + echo "Building dependencies" + ./build_usrsctp.sh + check_err_exit ${library_path} "Failed to build usrsctp!" + ./build_srtp.sh + check_err_exit ${library_path} "Failed to build srtp!" + ./build_sdptransform.sh + check_err_exit ${library_path} "Failed to build sdptransform!" + cd .. +fi -cmake_build ${library_path} -DCrypto_ROOT_DIR="`pwd`/boringssl/" -DCRYPTO_TYPE="boringssl" -DCMAKE_CXX_FLAGS="-fPIC -static-libgcc -static-libstdc++" -DBUILD_TESTS=OFF -DCMAKE_C_FLAGS="-fPIC" -DBUILD_WEBRTC=OFF +_cxx_options="" +[[ ${build_os_type} != "win32" ]] && _cxx_options="-fPIC -static-libgcc -static-libstdc++" +[[ ${build_os_type} == "win32" ]] && _cxx_options="-DWIN32" +cmake_build ${library_path} -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED=OFF -DCrypto_ROOT_DIR="`pwd`/boringssl/" -DCRYPTO_TYPE="boringssl" -DCMAKE_CXX_FLAGS="${_cxx_options}" -DBUILD_TESTS=OFF -DBUILD_WEBRTC=OFF -DMSVC_RUNTIME=static check_err_exit ${library_path} "Failed to build DataPipes!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_ed25519.sh b/third_party/build_ed25519.sh index 2625ce7..ed89225 100755 --- a/third_party/build_ed25519.sh +++ b/third_party/build_ed25519.sh @@ -6,6 +6,17 @@ library_path="ed25519" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC -I`pwd`/boringssl/include/ -L`pwd`/boringssl/build/ssl/ -L`pwd`/boringssl/build/crypto/" -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" + + +crypto_include="`pwd`/boringssl/include/" +# Convert the path +[[ ${build_os_type} == "win32" ]] && { + crypto_include="$(cygpath -w ${crypto_include} | sed 's:\\:\\\\:g')" +} + +#-L`pwd`/boringssl/build/ssl/ -L`pwd`/boringssl/build/crypto/ +cmake_build ${library_path} -DCMAKE_C_FLAGS="${_fpic} -I$crypto_include" -DBUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="${_fpic}" -DCMAKE_BUILD_TYPE=RelWithDebInfo check_err_exit ${library_path} "Failed to build ed25519!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_jsoncpp.sh b/third_party/build_jsoncpp.sh index c040125..3a965ba 100755 --- a/third_party/build_jsoncpp.sh +++ b/third_party/build_jsoncpp.sh @@ -6,6 +6,10 @@ library_path="jsoncpp" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-std=c++11 -fPIC -static-libstdc++" -DCMAKE_BUILD_TYPE=RelWithDebInfo +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" +_std_options="" +[[ ${build_os_type} == "linux" ]] && _std_options="-std=c++11 -static-libstdc++" +cmake_build ${library_path} -DCMAKE_CXX_FLAGS="${_fpic} ${_std_options}" -DCMAKE_BUILD_TYPE=RelWithDebInfo check_err_exit ${library_path} "Failed to build jsoncpp!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_libevent.sh b/third_party/build_libevent.sh index eebc5fd..d0b7f45 100644 --- a/third_party/build_libevent.sh +++ b/third_party/build_libevent.sh @@ -8,6 +8,9 @@ requires_rebuild ${library_path} _fpic="" [[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" -cmake_build ${library_path} -DCMAKE_C_FLAGS="${_fpic} -I../../boringssl/include/" -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_OPENSSL=ON -DEVENT__DISABLE_THREAD_SUPPORT=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded + +make_targets=("event_static") +#cmake ../../ -G"Visual Studio 14 2015 Win64" -DEVENT_INSTALL_CMAKE_DIR=cmake -DCMAKE_INSTALL_PREFIX=. -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__LIBRARY_TYPE=BOTH -DEVENT__MSVC_STATIC_RUNTIME=ON -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_OPENSSL=ON +cmake_build ${library_path} -DCMAKE_C_FLAGS="${_fpic} -I../../boringssl/include/" -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__LIBRARY_TYPE=STATIC -DEVENT__MSVC_STATIC_RUNTIME=ON -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_OPENSSL=ON -DCMAKE_BUILD_TYPE="Release" check_err_exit ${library_path} "Failed to build libevent!" -set_build_successful ${library_path} \ No newline at end of file +set_build_successful ${library_path} diff --git a/third_party/build_opus.sh b/third_party/build_opus.sh index 5186fbe..7480863 100755 --- a/third_party/build_opus.sh +++ b/third_party/build_opus.sh @@ -6,6 +6,19 @@ library_path="opus" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC" -DOPUS_X86_PRESUME_AVX=OFF -DOPUS_X86_PRESUME_SSE4_1=OFF +function win_fix_avx() { + echo "Fixing WIN32 AVX parameters" + sed -i 's/AdvancedVectorExtensions/NoExtensions/g' *.vcxproj + return 0 +} +_run_before_build="win_fix_avx" + +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" +_cflags="" +[[ ${build_os_type} == "win32" ]] && _cflags="/arch:SSE" + +cmake_build ${library_path} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="${_fpic} ${_cflags}" -DOPUS_X86_PRESUME_AVX=OFF -DOPUS_X86_PRESUME_SSE4_1=OFF check_err_exit ${library_path} "Failed to build opus!" -set_build_successful ${library_path} \ No newline at end of file +set_build_successful ${library_path} +# \ No newline at end of file diff --git a/third_party/build_portaudio.sh b/third_party/build_portaudio.sh index 81144a9..29c93c2 100755 --- a/third_party/build_portaudio.sh +++ b/third_party/build_portaudio.sh @@ -6,6 +6,8 @@ library_path="portaudio" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC" -DPA_BUILD_SHARED=OFF -DPA_BUILD_STATIC=ON -DPA_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" +cmake_build ${library_path} -DCMAKE_C_FLAGS="${_fpic}" -DPA_BUILD_SHARED=OFF -DPA_BUILD_STATIC=ON -DPA_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo check_err_exit ${library_path} "Failed to build portaudio!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_protobuf.sh b/third_party/build_protobuf.sh index 1d370a9..7f492a3 100755 --- a/third_party/build_protobuf.sh +++ b/third_party/build_protobuf.sh @@ -9,7 +9,9 @@ requires_rebuild ${library_path} #./${library_path}/libraries/build_event.sh #check_err_exit ${library_path} "Failed to build library libevent" +_cxx_options="" +[[ ${build_os_type} == "linux" ]] && _cxx_options="-fPIC -std=c++11" base_path_suffix="/cmake/" -cmake_build ${library_path} -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-std=c++11 -fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake_build ${library_path} -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="${_cxx_options}" -DCMAKE_BUILD_TYPE=RelWithDebInfo check_err_exit ${library_path} "Failed to build protobuf!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_soxr.sh b/third_party/build_soxr.sh index 3ccede8..67b0609 100755 --- a/third_party/build_soxr.sh +++ b/third_party/build_soxr.sh @@ -6,6 +6,8 @@ library_path="soxr" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC" -DBUILD_SHARED_RUNTIME=OFF -DWITH_OPENMP=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" +cmake_build ${library_path} -DCMAKE_C_FLAGS="${_fpic}" -DBUILD_SHARED_RUNTIME=OFF -DWITH_OPENMP=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF check_err_exit ${library_path} "Failed to build soxr!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_stringvariable.sh b/third_party/build_stringvariable.sh index 9592d86..8fb4807 100755 --- a/third_party/build_stringvariable.sh +++ b/third_party/build_stringvariable.sh @@ -6,6 +6,10 @@ library_path="StringVariable" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-fPIC" +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" +_cmake_options="" +[[ ${build_os_type} == "win32" ]] && _cmake_options="-DMSVC_RUNTIME=static" +cmake_build ${library_path} -DCMAKE_CXX_FLAGS="${_fpic}" -DCMAKE_BUILD_TYPE=RelWithDebInfo ${_cmake_options} check_err_exit ${library_path} "Failed to build StringVariable!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_threadpool.sh b/third_party/build_threadpool.sh index cbe6f63..511ddc9 100755 --- a/third_party/build_threadpool.sh +++ b/third_party/build_threadpool.sh @@ -6,6 +6,8 @@ library_path="Thread-Pool" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} +_cmake_options="" +[[ ${build_os_type} == "win32" ]] && _cmake_options="-DMSVC_RUNTIME=static" +cmake_build ${library_path} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${_cmake_options} check_err_exit ${library_path} "Failed to build Thread-Pool!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/build_tom.sh b/third_party/build_tom.sh index 3e81239..e7a2089 100755 --- a/third_party/build_tom.sh +++ b/third_party/build_tom.sh @@ -2,10 +2,15 @@ source ../scripts/build_helper.sh +_fpic="" +[[ ${build_os_type} == "linux" ]] && _fpic="-fPIC" + +_cmake_options="" +[[ ${build_os_type} == "win32" ]] && _cmake_options="-DMSVC_RUNTIME=static" library_path="tommath" requires_rebuild ${library_path} [[ $? -ne 0 ]] && { - cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake_build ${library_path} -DCMAKE_CXX_FLAGS="${_fpic}" -DCMAKE_C_FLAGS="${_fpic}" -DCMAKE_BUILD_TYPE=RelWithDebInfo ${_cmake_options} check_err_exit ${library_path} "Failed to build tommath!" set_build_successful ${library_path} } @@ -14,10 +19,16 @@ requires_rebuild ${library_path} library_path="tomcrypt" requires_rebuild ${library_path} [[ $? -ne 0 ]] && { - export tommath_library="`pwd`/tommath/out/${build_os_type}_${build_os_arch}/libtommathStatic.a" - export tommath_include="`pwd`/tommath/out/${build_os_type}_${build_os_arch}/include/" + tommath_library="`pwd`/tommath/out/${build_os_type}_${build_os_arch}/libtommathStatic.a" + tommath_include="`pwd`/tommath/out/${build_os_type}_${build_os_arch}/include/" - cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC -DUSE_LTM -DLTM_DESC -I$tommath_include" -DCMAKE_BUILD_TYPE=RelWithDebInfo + # Convert the path + [[ ${build_os_type} == "win32" ]] && { + tommath_library="$(cygpath -w ${tommath_library} | sed 's:\\:\\\\:g')" + tommath_include="$(cygpath -w ${tommath_include} | sed 's:\\:\\\\:g')" + } + + cmake_build ${library_path} -DCMAKE_C_FLAGS="${_fpic} -DUSE_LTM -DLTM_DESC -I$tommath_include " -DCMAKE_BUILD_TYPE=RelWithDebInfo ${_cmake_options} check_err_exit ${library_path} "Failed to build tomcrypt!" set_build_successful ${library_path} } diff --git a/third_party/build_yaml.sh b/third_party/build_yaml.sh index 1bc52f9..7915354 100755 --- a/third_party/build_yaml.sh +++ b/third_party/build_yaml.sh @@ -6,6 +6,8 @@ library_path="yaml-cpp" requires_rebuild ${library_path} [[ $? -eq 0 ]] && exit 0 -cmake_build ${library_path} -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -fPIC" +_cxx_flags="" +[[ ${build_os_type} == "linux" ]] && _cxx_flags="-D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -fPIC" +cmake_build ${library_path} -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${_cxx_flags}" check_err_exit ${library_path} "Failed to build yaml-cpp!" set_build_successful ${library_path} \ No newline at end of file diff --git a/third_party/ed25519 b/third_party/ed25519 index ad72bc7..542ffdc 160000 --- a/third_party/ed25519 +++ b/third_party/ed25519 @@ -1 +1 @@ -Subproject commit ad72bc7f729ebf046bc074eb4ec925e594926f82 +Subproject commit 542ffdc62c3efd2f659a1c14f3a15fe54c83e643 diff --git a/third_party/protobuf b/third_party/protobuf index 01ede60..8b09686 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 01ede6049bbc38e610cf2d03f366d8ad6ab1c83d +Subproject commit 8b0968625331457e79ba2e7eef5b35af3a95129e diff --git a/third_party/tomcrypt b/third_party/tomcrypt index fd15bbc..aa9d3c3 160000 --- a/third_party/tomcrypt +++ b/third_party/tomcrypt @@ -1 +1 @@ -Subproject commit fd15bbc65d6ca38d4579804ee0e9e20494e824af +Subproject commit aa9d3c3590bc7422c8afdafcc906cd2bc60228a4 diff --git a/third_party/tommath b/third_party/tommath index fe6cc64..a09c536 160000 --- a/third_party/tommath +++ b/third_party/tommath @@ -1 +1 @@ -Subproject commit fe6cc64884b2b408b607389f46266d44fd942a79 +Subproject commit a09c53619e0785adf17a597c9e7fd60bbb6ecb09