carla/Makefile

105 lines
3.2 KiB
Makefile
Raw Normal View History

2017-10-25 23:26:31 +08:00
INSTALL_FOLDER=$(CURDIR)/Unreal/CarlaUE4/Plugins/Carla/CarlaServer
PYTHON_CLIENT_FOLDER=$(CURDIR)/PythonClient/test
2017-08-29 22:04:58 +08:00
BASE_BUILD_FOLDER=$(CURDIR)/Util/Build/carlaserver-build
MY_CMAKE_FOLDER=$(CURDIR)/Util/cmake
2017-07-26 22:04:39 +08:00
MY_CMAKE_FLAGS=-B"$(BUILD_FOLDER)" -DCMAKE_INSTALL_PREFIX="$(INSTALL_FOLDER)"
2017-04-05 16:25:24 +08:00
2017-07-26 22:04:39 +08:00
ifeq ($(OS),Windows_NT)
BUILD_RULE=build_windows
2018-02-14 01:17:52 +08:00
CLEAN_RULE=clean_windows
CALL_CMAKE_RULE=call_cmake_windows
2017-08-29 22:04:58 +08:00
PROTOC_COMPILE=cmd.exe /k "cd Util & call Protoc.bat & exit"
PROTOC_CLEAN=cmd.exe /k "cd Util & call Protoc.bat --clean & exit"
2017-07-26 22:04:39 +08:00
else
BUILD_RULE=build_linux
CLEAN_RULE=clean_linux
CALL_CMAKE_RULE=call_cmake_linux
2017-08-29 22:04:58 +08:00
PROTOC_COMPILE=./Util/Protoc.sh
PROTOC_CLEAN=./Util/Protoc.sh --clean
2017-07-26 22:04:39 +08:00
endif
default: release
### Build ######################################################################
debug: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/debug
debug: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Debug
debug: $(BUILD_RULE)
release: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/release
release: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Release
release: $(BUILD_RULE)
2018-02-14 01:17:52 +08:00
vsproject: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/visualstudio
vsproject: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Release
2018-02-14 01:17:52 +08:00
vsproject: MY_CMAKE_FLAGS+=-G "Visual Studio 14 2015 Win64"
vsproject: call_cmake
vsproject15: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/visualstudio
vsproject15: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Release
vsproject15: MY_CMAKE_FLAGS+=-G "Visual Studio 15 2017 Win64"
vsproject15: call_cmake
2017-07-26 22:04:39 +08:00
build_linux: MY_CMAKE_FLAGS+=-G "Ninja"
build_linux: call_cmake
2017-10-25 23:26:31 +08:00
@cd $(BUILD_FOLDER) && ninja && ninja install
2017-07-26 22:04:39 +08:00
build_windows: MY_CMAKE_FLAGS+=-G "NMake Makefiles"
build_windows: call_cmake
2017-10-25 23:26:31 +08:00
@cd $(BUILD_FOLDER) && nmake && nmake install
2017-07-26 22:04:39 +08:00
call_cmake: protobuf $(CALL_CMAKE_RULE)
2017-10-25 23:26:31 +08:00
@cd $(BUILD_FOLDER) && cmake $(MY_CMAKE_FLAGS) "$(MY_CMAKE_FOLDER)"
2017-07-26 22:04:39 +08:00
protobuf:
2017-10-25 23:26:31 +08:00
@$(PROTOC_COMPILE)
2017-07-26 22:04:39 +08:00
call_cmake_linux:
@mkdir -p $(BUILD_FOLDER)
call_cmake_windows:
-@mkdir "$(BUILD_FOLDER)"
2017-07-26 22:04:39 +08:00
### Docs #######################################################################
2017-09-27 00:22:17 +08:00
docs: doxygen
doxygen:
2017-10-25 23:26:31 +08:00
@doxygen
2017-07-26 22:04:39 +08:00
@echo "Documentation index at ./Doxygen/html/index.html"
### Clean ######################################################################
clean: $(CLEAN_RULE)
2017-10-25 23:26:31 +08:00
@$(PROTOC_CLEAN)
2017-07-26 22:04:39 +08:00
clean_linux:
@rm -Rf $(BASE_BUILD_FOLDER) $(INSTALL_FOLDER) Doxygen
clean_windows:
2018-05-23 22:01:17 +08:00
-@rd /s /q "$(BASE_BUILD_FOLDER)" "$(INSTALL_FOLDER)" Doxygen
2017-07-26 22:04:39 +08:00
### Test #######################################################################
check: debug launch_test_clients run_test_debug kill_test_clients
check_release: release launch_test_clients run_test_release kill_test_clients
run_test_debug:
2017-09-14 21:02:31 +08:00
@-LD_LIBRARY_PATH=$(INSTALL_FOLDER)/shared $(INSTALL_FOLDER)/bin/test_carlaserverd --gtest_shuffle $(GTEST_ARGS)
2017-07-26 22:04:39 +08:00
run_test_release:
2017-09-14 21:02:31 +08:00
@-LD_LIBRARY_PATH=$(INSTALL_FOLDER)/shared $(INSTALL_FOLDER)/bin/test_carlaserver --gtest_shuffle $(GTEST_ARGS)
2017-07-26 22:04:39 +08:00
launch_test_clients:
@echo "Launch echo client"
2018-02-27 01:14:04 +08:00
@python3 $(PYTHON_CLIENT_FOLDER)/test_client.py --echo -v -p 4000 --log echo_client.log & echo $$! > echo_client.pid
@echo "Launch carla client"
2018-02-27 01:14:04 +08:00
@python3 $(PYTHON_CLIENT_FOLDER)/test_client.py -v -p 2000 --log carla_client.log & echo $$! > carla_client.pid
2017-07-26 22:04:39 +08:00
kill_test_clients:
@echo "Kill echo client"
2017-07-26 22:04:39 +08:00
@kill `cat echo_client.pid` && rm echo_client.pid
@echo "Kill carla client"
2018-05-23 22:01:17 +08:00
@kill `cat carla_client.pid` && rm carla_client.pid