Cleaned up build files.

This commit is contained in:
Axel1092 2020-07-28 11:29:06 +02:00 committed by bernat
parent 550c252813
commit f6676ca8e9
6 changed files with 188 additions and 51 deletions

View File

@ -14,6 +14,44 @@ rem ============================================================================
rem -- Parse arguments --------------------------------------------------------- rem -- Parse arguments ---------------------------------------------------------
rem ============================================================================ rem ============================================================================
set DOC_STRING=Build LibCarla.
set USAGE_STRING=Usage: %FILE_N% [-h^|--help] [--rebuild] [--build] [--clean]
set REMOVE_INTERMEDIATE=false
set BUILD_OSM2ODR=false
:arg-parse
if not "%1"=="" (
if "%1"=="--rebuild" (
set REMOVE_INTERMEDIATE=true
set BUILD_OSM2ODR=true
)
if "%1"=="--build" (
set BUILD_OSM2ODR=true
)
if "%1"=="--clean" (
set REMOVE_INTERMEDIATE=true
)
if "%1"=="-h" (
echo %DOC_STRING%
echo %USAGE_STRING%
GOTO :eof
)
if "%1"=="--help" (
echo %DOC_STRING%
echo %USAGE_STRING%
GOTO :eof
)
shift
goto :arg-parse
)
if %REMOVE_INTERMEDIATE% == false (
if %BUILD_OSM2ODR% == false (
echo Nothing selected to be done.
goto :eof
)
)
rem ============================================================================ rem ============================================================================
rem -- Local Variables --------------------------------------------------------- rem -- Local Variables ---------------------------------------------------------
@ -24,19 +62,66 @@ rem
set OSM2ODR_VSPROJECT_PATH=%INSTALLATION_DIR:/=\%osm2odr-visualstudio\ set OSM2ODR_VSPROJECT_PATH=%INSTALLATION_DIR:/=\%osm2odr-visualstudio\
set OSM2ODR_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\ set OSM2ODR_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\
if "%1"=="--rebuild" ( if %REMOVE_INTERMEDIATE% == true (
rmdir "%OSM2ODR_VSPROJECT_PATH%" /s /q rem Remove directories
for %%G in (
"%OSM2ODR_INSTALL_PATH%",
) do (
if exist %%G (
echo %FILE_N% Cleaning %%G
rmdir /s/q %%G
)
)
) )
if not exist "%OSM2ODR_VSPROJECT_PATH%" mkdir "%OSM2ODR_VSPROJECT_PATH%" if not exist "%OSM2ODR_VSPROJECT_PATH%" mkdir "%OSM2ODR_VSPROJECT_PATH%"
cd "%OSM2ODR_VSPROJECT_PATH%" cd "%OSM2ODR_VSPROJECT_PATH%"
rem Build OSM2ODR
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:\=/%"^
"%ROOT_PATH%\Util\OSM2ODR" "%ROOT_PATH%\Util\OSM2ODR"
cmake --build . --config Release --target install | findstr /V "Up-to-date:" if %errorlevel% neq 0 goto error_cmake
cmake --build . --config Release --target install | findstr /V "Up-to-date:"
if %errorlevel% neq 0 goto error_install
)
goto success
rem ============================================================================
rem -- Messages and Errors -----------------------------------------------------
rem ============================================================================
:success
if %BUILD_OSM2ODR% == true echo %FILE_N% OSM2ODR has been successfully installed in "%OSM2ODR_INSTALL_PATH%"!
goto good_exit
:error_cmake
echo.
echo %FILE_N% [ERROR] An error ocurred while executing the cmake.
echo [ERROR] Possible causes:
echo [ERROR] - Make sure "CMake" is installed.
echo [ERROR] - Make sure it is available on your Windows "path".
echo [ERROR] - CMake 3.9.0 or higher is required.
goto bad_exit
:error_install
echo.
echo %FILE_N% [ERROR] An error ocurred while installing using Visual Studio 15 2017 Win64.
echo [ERROR] Possible causes:
echo [ERROR] - Make sure you have Visual Studio installed.
echo [ERROR] - Make sure you have the "x64 Visual C++ Toolset" in your path.
echo [ERROR] For example using the "Visual Studio x64 Native Tools Command Prompt",
echo [ERROR] or the "vcvarsall.bat".
goto bad_exit
:good_exit
endlocal endlocal
exit /b 0 exit /b 0
:bad_exit
endlocal
exit /b %errorlevel%

View File

@ -2,26 +2,89 @@
source $(dirname "$0")/Environment.sh source $(dirname "$0")/Environment.sh
function get_source_code_checksum {
local EXCLUDE='*__pycache__*'
find "${OSM2ODR_ROOT_FOLDER}"/* \! -path "${EXCLUDE}" -print0 | sha1sum | awk '{print $1}'
}
DOC_STRING="Build OSM2ODR."
USAGE_STRING=$(cat <<- END
Usage: $0 [-h|--help]
commands
[--clean] Clean intermediate files.
[--rebuild] Clean and rebuild both configurations.
END
)
REMOVE_INTERMEDIATE=false
BUILD_OSM2ODR=false
OPTS=`getopt -o h --long help,rebuild,build,clean -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
eval set -- "$OPTS"
while true; do
case $1 in
--rebuild )
REMOVE_INTERMEDIATE=true;
BUILD_OSM2ODR=true;
shift ;;
--build )
BUILD_OSM2ODR=true;
shift ;;
--clean )
REMOVE_INTERMEDIATE=true;
shift ;;
-h | --help )
echo "$DOC_STRING"
echo "$USAGE_STRING"
exit 1
;;
* )
break ;;
esac
done
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_OSM2ODR}; }; then
fatal_error "Nothing selected to be done."
fi
# ==============================================================================
# -- Clean intermediate files --------------------------------------------------
# ==============================================================================
if ${REMOVE_INTERMEDIATE} ; then
log "Cleaning intermediate files and folders."
rm -Rf ${OSM2ODR_BUILD_FOLDER}*
fi
# ==============================================================================
# -- Build library -------------------------------------------------------------
# ==============================================================================
if ${BUILD_OSM2ODR} ; then
[ ! -d ${OSM2ODR_BUILD_FOLDER} ] && mkdir ${OSM2ODR_BUILD_FOLDER}
cd ${OSM2ODR_BUILD_FOLDER}
# define clang compiler # define clang compiler
export CC=/usr/bin/clang-8 export CC=/usr/bin/clang-8
export CXX=/usr/bin/clang++-8 export CXX=/usr/bin/clang++-8
OSM2ODR_BASE_DIR=${CARLA_ROOT_FOLDER}/Util/OSM2ODR cmake ${OSM2ODR_ROOT_FOLDER} \
OSM2ODR_BUILD_DIR=${CARLA_ROOT_FOLDER}/Build/osm2odr-build
OSM2ODR_BIN_DIR=${OSM2ODR_BASE_DIR}/bin
[ ! -d ${OSM2ODR_BUILD_DIR} ] && mkdir ${OSM2ODR_BUILD_DIR}
cd ${OSM2ODR_BUILD_DIR}
case $1 in
--rebuild)
rm -r * || true
;;
esac
cmake ${OSM2ODR_BASE_DIR} \
-G "Eclipse CDT4 - Ninja" \ -G "Eclipse CDT4 - Ninja" \
-DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_CLIENT_FOLDER} -DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_CLIENT_FOLDER}
ninja osm2odr ninja osm2odr
ninja install ninja install
fi
log "Success!"

View File

@ -28,15 +28,19 @@ clean.PythonAPI:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --clean @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --clean
clean.CarlaUE4Editor: clean.CarlaUE4Editor:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --clean @${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --clean
clean: clean.CarlaUE4Editor clean.PythonAPI clean.LibCarla clean.osm2odr:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.sh --clean
clean: clean.CarlaUE4Editor clean.PythonAPI clean.LibCarla clean.osm2odr
rebuild: setup rebuild: setup
@${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --rebuild @${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --rebuild
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.sh --rebuild
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --rebuild @${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --rebuild
hard-clean: hard-clean:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --hard-clean @${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --hard-clean
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.sh --clean
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --clean @${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --clean
@${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --clean @${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --clean
@echo "To force recompiling dependencies run: rm -Rf ${CARLA_BUILD_FOLDER}" @echo "To force recompiling dependencies run: rm -Rf ${CARLA_BUILD_FOLDER}"
@ -151,4 +155,4 @@ build.utils: PythonAPI
@${CARLA_BUILD_TOOLS_FOLDER}/BuildUtilsDocker.sh @${CARLA_BUILD_TOOLS_FOLDER}/BuildUtilsDocker.sh
osm2odr: osm2odr:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.sh $(ARGS) @${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.sh --build

View File

@ -19,6 +19,9 @@ LIBCARLA_BUILD_CLIENT_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-client-build
LIBCARLA_INSTALL_SERVER_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies LIBCARLA_INSTALL_SERVER_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
LIBCARLA_INSTALL_CLIENT_FOLDER=${CARLA_PYTHONAPI_SOURCE_FOLDER}/dependencies LIBCARLA_INSTALL_CLIENT_FOLDER=${CARLA_PYTHONAPI_SOURCE_FOLDER}/dependencies
OSM2ODR_ROOT_FOLDER=${CURDIR}/Util/OSM2ODR
OSM2ODR_BUILD_FOLDER=${CARLA_BUILD_FOLDER}/libosm2dr-build
CARLAUE4_PLUGIN_DEPS_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies CARLAUE4_PLUGIN_DEPS_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
LIBSTDCPP_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/LibStdCppToolChain.cmake LIBSTDCPP_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/LibStdCppToolChain.cmake

View File

@ -42,10 +42,12 @@ clean:
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.bat" --clean @"${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.bat" --clean
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.bat" --clean @"${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.bat" --clean
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --clean @"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --clean
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.bat --clean
rebuild: setup rebuild: setup
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.bat" --clean @"${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.bat" --clean
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --rebuild @"${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.bat" --rebuild
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.bat --rebuild
@"${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.bat" --rebuild @"${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.bat" --rebuild
check: PythonAPI check: PythonAPI
@ -79,4 +81,4 @@ deploy:
@"${CARLA_BUILD_TOOLS_FOLDER}/Deploy.bat" $(ARGS) @"${CARLA_BUILD_TOOLS_FOLDER}/Deploy.bat" $(ARGS)
osm2odr: osm2odr:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.bat $(ARGS) @${CARLA_BUILD_TOOLS_FOLDER}/BuildOSM2ODR.bat --build

View File

@ -1,24 +1,4 @@
set(netconvertlibs
netwrite netimport netbuild foreign_eulerspiral ${GDAL_LIBRARY} netimport_vissim netimport_vissim_typeloader netimport_vissim_tempstructs ${commonlibs})
#add_subdirectory(foreign)
#add_subdirectory(netbuild)
#add_subdirectory(netimport)
#add_subdirectory(netwrite)
#add_subdirectory(utils)
#add_executable(netconvert netconvert_main.cpp)
#set_target_properties(netconvert PROPERTIES OUTPUT_NAME netconvert${BINARY_SUFFIX})
#set_target_properties(netconvert PROPERTIES OUTPUT_NAME_DEBUG netconvert${BINARY_SUFFIX}D)
#target_link_libraries(netconvert ${netconvertlibs})
#add_dependencies(netconvert generate-version-h)
#install(TARGETS netconvert RUNTIME DESTINATION bin)
set(osm2odr_sources "OSM2ODR.cpp") set(osm2odr_sources "OSM2ODR.cpp")
#add_library(osm2odr STATIC ${osm2odr_sources})
#target_link_libraries(osm2odr ${netconvertlibs})
#install(TARGETS osm2odr ARCHIVE DESTINATION lib)
configure_file(config.h.cmake config.h) configure_file(config.h.cmake config.h)