Added PROJ library dependencies in windows. Imrpoved PythonAPI compilation speed in windows. Disabled boost RTTI checks.

This commit is contained in:
Axel1092 2021-02-18 15:59:26 +01:00 committed by Axel1092
parent d8bc438f6f
commit 0989aae70b
6 changed files with 340 additions and 6 deletions

View File

@ -105,14 +105,15 @@ def get_libcarla_extensions():
sys.version_info.major, sys.version_info.major,
sys.version_info.minor) sys.version_info.minor)
extra_link_args = ['shlwapi.lib', 'Advapi32.lib'] extra_link_args = ['shlwapi.lib', 'Advapi32.lib', 'ole32.lib', 'shell32.lib']
required_libs = [ required_libs = [
pylib, 'libboost_filesystem', pylib, 'libboost_filesystem',
'rpc.lib', 'carla_client.lib', 'rpc.lib', 'carla_client.lib',
'libpng.lib', 'zlib.lib', 'libpng.lib', 'zlib.lib',
'Recast.lib', 'Detour.lib', 'DetourCrowd.lib', 'Recast.lib', 'Detour.lib', 'DetourCrowd.lib',
'osm2odr.lib', 'xerces-c_3.lib'] 'xerces-c_3.lib', 'sqlite3.lib',
'proj.lib', 'osm2odr.lib']
# Search for files in 'PythonAPI\carla\dependencies\lib' that contains # Search for files in 'PythonAPI\carla\dependencies\lib' that contains
# the names listed in required_libs in it's file name # the names listed in required_libs in it's file name

View File

@ -229,7 +229,7 @@ def main():
print('file not found.') print('file not found.')
elif args.osm_path is not None: elif args.osm_path is not None:
if os.path.exists(args.osm_path): if os.path.exists(args.osm_path):
with open(args.osm_path) as od_file: with open(args.osm_path, encoding='utf-8') as od_file:
try: try:
data = od_file.read() data = od_file.read()
except OSError: except OSError:

View File

@ -82,6 +82,8 @@ if %BUILD_OSM2ODR% == true (
cmake -G "Visual Studio 15 2017 Win64"^ cmake -G "Visual Studio 15 2017 Win64"^
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^ -DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
-DCMAKE_INSTALL_PREFIX="%OSM2ODR_INSTALL_PATH:\=/%"^ -DCMAKE_INSTALL_PREFIX="%OSM2ODR_INSTALL_PATH:\=/%"^
-DPROJ_INCLUDE_DIR=%INSTALLATION_DIR:/=\%\proj-install\include^
-DPROJ_LIBRARY=%INSTALLATION_DIR:/=\%\proj-install/lib\proj.lib^
"%ROOT_PATH%\Util\OSM2ODR" "%ROOT_PATH%\Util\OSM2ODR"
if %errorlevel% neq 0 goto error_cmake if %errorlevel% neq 0 goto error_cmake

View File

@ -30,6 +30,7 @@ set VERSION_FILE=%ROOT_PATH:/=\%Util\ContentVersions.txt
set CONTENT_DIR=%ROOT_PATH:/=\%Unreal\CarlaUE4\Content\Carla\ set CONTENT_DIR=%ROOT_PATH:/=\%Unreal\CarlaUE4\Content\Carla\
set CARLA_DEPENDENCIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\ set CARLA_DEPENDENCIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\
set CARLA_BINARIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\Binaries\Win64 set CARLA_BINARIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\Binaries\Win64
set CARLA_PYTHON_DEPENDENCIES=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\
set USE_CHRONO=false set USE_CHRONO=false
:arg-parse :arg-parse
@ -185,13 +186,31 @@ copy /Y "%INSTALLATION_DIR%..\Util\BoostFiles\rational.hpp" "%INSTALLATION_DIR%b
copy /Y "%INSTALLATION_DIR%..\Util\BoostFiles\read.hpp" "%INSTALLATION_DIR%boost-%BOOST_VERSION%-install\include\boost\geometry\io\wkt\read.hpp" copy /Y "%INSTALLATION_DIR%..\Util\BoostFiles\read.hpp" "%INSTALLATION_DIR%boost-%BOOST_VERSION%-install\include\boost\geometry\io\wkt\read.hpp"
rem ============================================================================ rem ============================================================================
rem -- Download and install Xercesc ---------------------------------------------- rem -- Download and install Xercesc --------------------------------------------
rem ============================================================================ rem ============================================================================
echo %FILE_N% Installing Xercesc... echo %FILE_N% Installing Xercesc...
call "%INSTALLERS_DIR%install_xercesc.bat"^ call "%INSTALLERS_DIR%install_xercesc.bat"^
--build-dir "%INSTALLATION_DIR%" --build-dir "%INSTALLATION_DIR%"
rem ============================================================================
rem -- Download and install Sqlite3 --------------------------------------------
rem ============================================================================
echo %FILE_N% Installing Sqlite3
call "%INSTALLERS_DIR%install_sqlite3.bat"^
--build-dir "%INSTALLATION_DIR%"
copy %INSTALLATION_DIR%\sqlite3-install\lib\sqlite3.lib %CARLA_PYTHON_DEPENDENCIES%\lib
rem ============================================================================
rem -- Download and install PROJ --------------------------------------------
rem ============================================================================
echo %FILE_N% Installing PROJ
call "%INSTALLERS_DIR%install_proj.bat"^
--build-dir "%INSTALLATION_DIR%"
copy %INSTALLATION_DIR%\proj-install\lib\proj.lib %CARLA_PYTHON_DEPENDENCIES%\lib
rem ============================================================================ rem ============================================================================
rem -- Download and install Chrono ---------------------------------------------- rem -- Download and install Chrono ----------------------------------------------
rem ============================================================================ rem ============================================================================
@ -223,7 +242,7 @@ if %USE_CHRONO% == true (
xcopy /Y /S /I "%INSTALLATION_DIR%eigen-install\include\*" "%CARLA_DEPENDENCIES_FOLDER%include\*" > NUL xcopy /Y /S /I "%INSTALLATION_DIR%eigen-install\include\*" "%CARLA_DEPENDENCIES_FOLDER%include\*" > NUL
rem Workaround for unreal not finding the .dll files rem Workaround for unreal not finding the .dll files
copy "%INSTALLATION_DIR%chrono-install\bin\*.dll" "%CARLA_BINARIES_FOLDER%\*.dll" > NUL copy "%INSTALLATION_DIR%chrono-install\bin\*.dll" "%CARLA_BINARIES_FOLDER%\*.dll" > NUL
) )
rem ============================================================================ rem ============================================================================
@ -268,7 +287,7 @@ set CMAKE_CONFIG_FILE=%INSTALLATION_DIR%CMakeLists.txt.in
>>"%CMAKE_CONFIG_FILE%" echo. >>"%CMAKE_CONFIG_FILE%" echo.
>>"%CMAKE_CONFIG_FILE%" echo if (CMAKE_BUILD_TYPE STREQUAL "Server") >>"%CMAKE_CONFIG_FILE%" echo if (CMAKE_BUILD_TYPE STREQUAL "Server")
>>"%CMAKE_CONFIG_FILE%" echo # Prevent exceptions >>"%CMAKE_CONFIG_FILE%" echo # Prevent exceptions
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY) >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)
>>"%CMAKE_CONFIG_FILE%" echo add_compile_options(/EHsc) >>"%CMAKE_CONFIG_FILE%" echo add_compile_options(/EHsc)
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DASIO_NO_EXCEPTIONS) >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DASIO_NO_EXCEPTIONS)
>>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_NO_EXCEPTIONS) >>"%CMAKE_CONFIG_FILE%" echo add_definitions(-DBOOST_NO_EXCEPTIONS)

View File

@ -0,0 +1,161 @@
REM @echo off
setlocal
rem BAT script that downloads and installs a ready to use
rem x64 xerces-c build for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
rem ============================================================================
rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~dpn2
shift
)
if "%1"=="-h" (
goto help
)
if "%1"=="--help" (
goto help
)
shift
goto :arg-parse
)
rem If not set set the build dir to the current dir
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
rem ============================================================================
rem -- Local Variables ---------------------------------------------------------
rem ============================================================================
set PROJ_BASE_NAME=proj-7.2.1
set PROJ_ZIP=%PROJ_BASE_NAME%.tar.gz
set PROJ_ZIP_DIR=%BUILD_DIR%%PROJ_ZIP%
set PROJ_REPO=https://download.osgeo.org/proj/%PROJ_ZIP%
set SQLITE_INSTALL_DIR=%BUILD_DIR%sqlite3-install
set SQLITE_INCLUDE_DIR=%SQLITE_INSTALL_DIR%\include
set SQLITE_BIN=%SQLITE_INSTALL_DIR%\bin\sqlite.exe
set SQLITE_LIB=%SQLITE_INSTALL_DIR%\lib\sqlite3.lib
set PROJ_SRC_DIR=%BUILD_DIR%proj-src
set PROJ_BUILD_DIR=%PROJ_SRC_DIR%\build
set PROJ_INSTALL_DIR=%BUILD_DIR%proj-install
set PROJ_INCLUDE_DIR=%PROJ_INSTALL_DIR%\include
set PROJ_BIN_DIR=%PROJ_INSTALL_DIR%\bin
set PROJ_LIB_DIR=%PROJ_INSTALL_DIR%\lib
if exist "%PROJ_INSTALL_DIR%" (
goto already_build
)
echo %FILE_N% Retrieving %PROJ_BASE_NAME%.
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%PROJ_REPO%', '%PROJ_ZIP_DIR%')"
if %errorlevel% neq 0 goto error_download
cd %BUILD_DIR%
echo %FILE_N% Extracting PROJ from "%PROJ_ZIP%".
call tar -xzf %PROJ_ZIP%
move %BUILD_DIR%%PROJ_BASE_NAME% %PROJ_SRC_DIR%
mkdir %PROJ_BUILD_DIR%
cd %PROJ_BUILD_DIR%
cmake -G "Visual Studio 15 2017 Win64" .. ^
-DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^
-DCMAKE_CXX_FLAGS="/MD /MP"^
-DSQLITE3_INCLUDE_DIR=%SQLITE_INCLUDE_DIR% -DSQLITE3_LIBRARY=%SQLITE_LIB%^
-DEXE_SQLITE3=%SQLITE_BIN%^
-DENABLE_TIFF=OFF -DENABLE_CURL=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_PROJSYNC=OFF^
-DCMAKE_BUILD_TYPE=Release -DBUILD_PROJINFO=OFF^
-DBUILD_CCT=OFF -DBUILD_CS2CS=OFF -DBUILD_GEOD=OFF -DBUILD_GIE=OFF^
-DBUILD_PROJ=OFF -DBUILD_TESTING=OFF^
-DCMAKE_INSTALL_PREFIX=%PROJ_INSTALL_DIR%
if %errorlevel% neq 0 goto error_cmake
cmake --build . --config Release --target install
del %PROJ_ZIP_DIR%
goto success
rem ============================================================================
rem -- Messages and Errors -----------------------------------------------------
rem ============================================================================
:help
echo %FILE_N% Download and install a PROJ.
echo "Usage: %FILE_N% [-h^|--help] [--build-dir] [--zlib-install-dir]"
goto eof
:success
echo.
echo %FILE_N% PROJ has been successfully installed in "%PROJ_INSTALL_DIR%"!
goto good_exit
:already_build
echo %FILE_N% A PROJ installation already exists.
echo %FILE_N% Delete "%PROJ_INSTALL_DIR%" if you want to force a rebuild.
goto good_exit
:error_download
echo.
echo %FILE_N% [DOWNLOAD ERROR] An error ocurred while downloading PROJ.
echo %FILE_N% [DOWNLOAD ERROR] Possible causes:
echo %FILE_N% - Make sure that the following url is valid:
echo %FILE_N% "%PROJ_REPO%"
echo %FILE_N% [DOWNLOAD ERROR] Workaround:
echo %FILE_N% - Download the PROJ's source code and
echo %FILE_N% extract the content in
echo %FILE_N% "%PROJ_SRC_DIR%"
echo %FILE_N% And re-run the setup script.
goto bad_exit
:error_extracting
echo.
echo %FILE_N% [EXTRACTING ERROR] An error ocurred while extracting the zip.
echo %FILE_N% [EXTRACTING ERROR] Workaround:
echo %FILE_N% - Download the PROJ's source code and
echo %FILE_N% extract the content manually in
echo %FILE_N% "%PROJ_SRC_DIR%"
echo %FILE_N% And re-run the setup script.
goto bad_exit
:error_compiling
echo.
echo %FILE_N% [COMPILING ERROR] An error ocurred while compiling with cl.exe.
echo %FILE_N% Possible causes:
echo %FILE_N% - Make sure you have Visual Studio installed.
echo %FILE_N% - Make sure you have the "x64 Visual C++ Toolset" in your path.
echo %FILE_N% For example, using the "Visual Studio x64 Native Tools Command Prompt",
echo %FILE_N% or the "vcvarsall.bat".
goto bad_exit
:error_generating_lib
echo.
echo %FILE_N% [NMAKE ERROR] An error ocurred while compiling and installing using nmake.
goto bad_exit
:good_exit
echo %FILE_N% Exiting...
rem A return value used for checking for errors
endlocal & set install_proj=%PROJ_INSTALL_DIR%
exit /b 0
:bad_exit
if exist "%PROJ_INSTALL_DIR%" rd /s /q "%PROJ_INSTALL_DIR%"
echo %FILE_N% Exiting with error...
endlocal
exit /b %errorlevel%

View File

@ -0,0 +1,151 @@
REM @echo off
setlocal
rem BAT script that downloads and installs a ready to use
rem x64 xerces-c build for CARLA (carla.org).
rem Run it through a cmd with the x64 Visual C++ Toolset enabled.
set LOCAL_PATH=%~dp0
set FILE_N= -[%~n0]:
rem Print batch params (debug purpose)
echo %FILE_N% [Batch params]: %*
rem ============================================================================
rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================
:arg-parse
if not "%1"=="" (
if "%1"=="--build-dir" (
set BUILD_DIR=%~dpn2
shift
)
if "%1"=="-h" (
goto help
)
if "%1"=="--help" (
goto help
)
shift
goto :arg-parse
)
rem If not set set the build dir to the current dir
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
rem ============================================================================
rem -- Local Variables ---------------------------------------------------------
rem ============================================================================
set SQLITE_BASE_NAME=sqlite-amalgamation-3340100
set SQLITE_ZIP=%SQLITE_BASE_NAME%.zip
set SQLITE_ZIP_DIR=%BUILD_DIR%%SQLITE_ZIP%
set SQLITE_REPO=https://www.sqlite.org/2021/%SQLITE_ZIP%
set SQLITE_SRC_DIR=%BUILD_DIR%sqlite3-src
set SQLITE_INSTALL_DIR=%BUILD_DIR%sqlite3-install
set SQLITE_INCLUDE_DIR=%SQLITE_INSTALL_DIR%\include
set SQLITE_BIN_DIR=%SQLITE_INSTALL_DIR%\bin
set SQLITE_LIB_DIR=%SQLITE_INSTALL_DIR%\lib
if exist "%SQLITE_INSTALL_DIR%" (
goto already_build
)
echo %FILE_N% Retrieving %SQLITE_BASE_NAME%.
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SQLITE_REPO%', '%SQLITE_ZIP_DIR%')"
if %errorlevel% neq 0 goto error_download
echo %FILE_N% Extracting Sqlite3 from "%SQLITE_ZIP%".
powershell -Command "Expand-Archive '%SQLITE_ZIP_DIR%' -DestinationPath '%BUILD_DIR%'"
move %BUILD_DIR%%SQLITE_BASE_NAME% %SQLITE_SRC_DIR%
cd %SQLITE_SRC_DIR%
call cl /MD /MP sqlite3.c shell.c -Fesqlite.exe
call cl /MD /MP /c /EHsc sqlite3.c
call lib sqlite3.obj
mkdir %SQLITE_INCLUDE_DIR%
mkdir %SQLITE_BIN_DIR%
mkdir %SQLITE_LIB_DIR%
move sqlite.exe %SQLITE_BIN_DIR%
move sqlite3.h %SQLITE_INCLUDE_DIR%
move sqlite3.lib %SQLITE_LIB_DIR%
del %SQLITE_ZIP_DIR%
goto success
rem ============================================================================
rem -- Messages and Errors -----------------------------------------------------
rem ============================================================================
:help
echo %FILE_N% Download and install a Sqlite3.
echo "Usage: %FILE_N% [-h^|--help] [--build-dir] [--zlib-install-dir]"
goto eof
:success
echo.
echo %FILE_N% Sqlite3 has been successfully installed in "%SQLITE_INSTALL_DIR%"!
goto good_exit
:already_build
echo %FILE_N% A Sqlite3 installation already exists.
echo %FILE_N% Delete "%SQLITE_INSTALL_DIR%" if you want to force a rebuild.
goto good_exit
:error_download
echo.
echo %FILE_N% [DOWNLOAD ERROR] An error ocurred while downloading Sqlite3.
echo %FILE_N% [DOWNLOAD ERROR] Possible causes:
echo %FILE_N% - Make sure that the following url is valid:
echo %FILE_N% "%SQLITE_REPO%"
echo %FILE_N% [DOWNLOAD ERROR] Workaround:
echo %FILE_N% - Download the Sqlite3's source code and
echo %FILE_N% extract the content in
echo %FILE_N% "%SQLITE_SRC_DIR%"
echo %FILE_N% And re-run the setup script.
goto bad_exit
:error_extracting
echo.
echo %FILE_N% [EXTRACTING ERROR] An error ocurred while extracting the zip.
echo %FILE_N% [EXTRACTING ERROR] Workaround:
echo %FILE_N% - Download the Sqlite3's source code and
echo %FILE_N% extract the content manually in
echo %FILE_N% "%SQLITE_SRC_DIR%"
echo %FILE_N% And re-run the setup script.
goto bad_exit
:error_compiling
echo.
echo %FILE_N% [COMPILING ERROR] An error ocurred while compiling with cl.exe.
echo %FILE_N% Possible causes:
echo %FILE_N% - Make sure you have Visual Studio installed.
echo %FILE_N% - Make sure you have the "x64 Visual C++ Toolset" in your path.
echo %FILE_N% For example, using the "Visual Studio x64 Native Tools Command Prompt",
echo %FILE_N% or the "vcvarsall.bat".
goto bad_exit
:error_generating_lib
echo.
echo %FILE_N% [NMAKE ERROR] An error ocurred while compiling and installing using nmake.
goto bad_exit
:good_exit
echo %FILE_N% Exiting...
rem A return value used for checking for errors
endlocal & set install_Sqlite3=%SQLITE_INSTALL_DIR%
exit /b 0
:bad_exit
if exist "%SQLITE_INSTALL_DIR%" rd /s /q "%SQLITE_INSTALL_DIR%"
echo %FILE_N% Exiting with error...
endlocal
exit /b %errorlevel%