-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for building on Mac OS X #2433
base: master
Are you sure you want to change the base?
Changes from all commits
96c5487
e069582
6c1f4f1
0bf0356
ac2759f
4ca1f03
6a596cb
af117d6
9e56a3d
9a8bc24
91e24c4
f04049a
a55b18f
65d98f4
f14f8c5
b0a12e7
75a6daf
39abe9b
b277478
fcd09dc
be11ac3
8c143df
4e8d0bf
e70767b
f9d11b1
c68027d
15036b1
f413edd
164fa11
44b3e13
d97cd3e
a112caa
092817d
002f603
2f9e44a
5f4ddd3
d7425a8
9212464
544eb2e
6c84278
356e15b
15b6009
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# How to build CARLA on Mac OSX | ||
|
||
Note that unlike the Linux build, this one uses the standard Mac compiler tools and | ||
the standard Unreal Engine 4.21 distribution. | ||
|
||
Prerequisites | ||
------------- | ||
|
||
### Install Xcode 9.4 | ||
|
||
*Later versions of Xcode may work, but using the same version that is used by Unreal 4.21 seems a safe bet.* | ||
|
||
You should be able to install from [Apple's developer downloads](https://developer.apple.com/download/more/). | ||
|
||
If you have installed more than one version of Xcode, you should activate 9.4 using | ||
the `xcode-select` command line utility. This will set `/usr/bin/clang` and `/usr/bin/clang++` | ||
to the appropriate versions, and these are what will be used in the build. | ||
|
||
Note that Apple's has it's own clang versioning scheme that tracks the Xcode versions, | ||
so it is not obvious how the features compare to the LLVM distributions, but this version | ||
should fully support c++14 features. | ||
|
||
**On Mac OSX Mojave 10.14 you also need to install the MacOS headers using:** | ||
|
||
~~~sh | ||
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / | ||
~~~ | ||
|
||
### Install Unreal Engine 4.21 | ||
|
||
Install the [Epic Games Launcher](https://www.epicgames.com/unrealtournament/download) | ||
and use it to download version 4.21 of the Unreal Engine. The default install location | ||
is `/Users/Shared/Epic Games/`, but it is a good idea to eliminate the space in the path | ||
and instead use `/Users/Shared/EpicGames/` since some tools seem to have problems with | ||
the space. | ||
|
||
Although, you don't need to build the engine from source, you do need to add the file | ||
[GenerateProjectFiles.sh](https://github.com/EpicGames/UnrealEngine/blob/4.21/GenerateProjectFiles.sh) to the root directory from a copy of the Unreal Engine source tree. | ||
|
||
### Install the build tools and dependencies | ||
|
||
~~~sh | ||
$ brew install autoconf curl libtool ninja wget \ | ||
libpng | ||
~~~ | ||
|
||
Use shipping python or install using your favorite method (e.g. brew, download installer from python.org, | ||
Anaconda/miniconda). | ||
|
||
If using conda environment: | ||
|
||
~~~sh | ||
$ conda install -c conda-forge nose2 | ||
~~~ | ||
|
||
else: | ||
|
||
~~~sh | ||
$ pip2 install nose2 | ||
~~~ | ||
|
||
In order for `boost-python` to build properly, you may need to add a `user-config.jam` file | ||
to your home directory describing the location of your python implementations. For instance, | ||
to use the preinstalled python2 and a python 3.6 from python.org installer you might use: | ||
|
||
~~~jam | ||
import toolset : using ; | ||
|
||
using python : 2.7 | ||
: /usr/bin/python2.7 | ||
: /usr/include/python2.7 | ||
; | ||
|
||
using python : 3.6 | ||
: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 | ||
: /Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m | ||
: /Library/Frameworks/Python.framework/Versions/3.6/lib | ||
; | ||
~~~ | ||
|
||
Currently, the build will only support the first listed python. Eventually, it should | ||
support building apis for multiple python versions. | ||
|
||
Build CARLA | ||
----------- | ||
|
||
Clone or download the project from our | ||
[GitHub repository](https://github.com/carla-simulator/carla) | ||
|
||
```sh | ||
git clone https://github.com/carla-simulator/carla | ||
``` | ||
|
||
Note that the `master` branch contains the latest fixes and features, for the | ||
latest stable code may be best to switch to the latest release tag. | ||
|
||
Now you need to download the assets package, to do so we provide a handy script | ||
that downloads and extracts the latest version (note that the package is >12GB, | ||
this step might take some time depending on your connection) | ||
|
||
```sh | ||
./Update.sh | ||
``` | ||
|
||
For CARLA to find your Unreal Engine's installation folder you need to set the | ||
following environment variable | ||
|
||
```sh | ||
export UE4_ROOT=/Users/shared/EpicGames/UE_4.21 | ||
``` | ||
|
||
You can also add this variable to your `~/.bashrc` or `~/.profile`. | ||
|
||
Now that the environment is set up, you can run make to run different commands | ||
|
||
```sh | ||
make launch # Compiles CARLA and launches Unreal Engine's Editor. | ||
make package # Compiles CARLA and creates a packaged version for distribution. | ||
make help # Print all available commands. | ||
``` | ||
|
||
Updating CARLA | ||
-------------- | ||
|
||
Every new release of CARLA we release a new package with the latest changes in | ||
the CARLA assets. To download the latest version and recompile CARLA, run | ||
|
||
```sh | ||
make clean | ||
git pull | ||
./Update.sh | ||
make launch | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ namespace adaptor { | |
|
||
private: | ||
|
||
template <uint64_t I> | ||
template <unsigned long I> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: Make this OS dependent? |
||
static void copy_to_variant_impl( | ||
const clmdep_msgpack::object &o, | ||
boost::variant<Ts...> &v) { | ||
|
@@ -115,9 +115,9 @@ namespace adaptor { | |
v = o.via.array.ptr[1].as<T>(); | ||
} | ||
|
||
template <uint64_t... Is> | ||
template <unsigned long... Is> | ||
static void copy_to_variant( | ||
const uint64_t index, | ||
const unsigned long index, | ||
const clmdep_msgpack::object &o, | ||
boost::variant<Ts...> &v, | ||
std::index_sequence<Is...>) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,7 @@ namespace client { | |
/// @todo Works as a list but its actually a map. We should assess the use | ||
/// cases and reconsider this implementation. | ||
class BlueprintLibrary | ||
: public EnableSharedFromThis<BlueprintLibrary>, | ||
private NonCopyable { | ||
: public EnableSharedFromThis<BlueprintLibrary> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed this due to a complaint about the move constructor, can look more into it. |
||
using map_type = std::unordered_map<std::string, ActorBlueprint>; | ||
public: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ namespace std { | |
|
||
using argument_type = carla::road::element::Waypoint; | ||
|
||
using result_type = uint64_t; | ||
using result_type = unsigned long; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gate based on OS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any problem using |
||
|
||
/// Generates an unique id for @a waypoint based on its road_id, lane_id, | ||
/// section_id, and "s" offset. The "s" offset is truncated to half | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,13 @@ static void TestSequence(carla::ListView<Iterator> view) { | |
TEST(listview, sequence) { | ||
int array[] = {0, 1, 2, 3, 4, 5}; | ||
TestSequence(MakeListView(array)); | ||
std::array<int, 6u> std_array = {0, 1, 2, 3, 4, 5}; | ||
std::array<int, 6u> std_array = {{0, 1, 2, 3, 4, 5}}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be changed? |
||
TestSequence(MakeListView(std_array)); | ||
std::vector<int> vector = {0, 1, 2, 3, 4, 5}; | ||
std::vector<int> vector = {{0, 1, 2, 3, 4, 5}}; | ||
TestSequence(MakeListView(vector)); | ||
std::list<int> list = {0, 1, 2, 3, 4, 5}; | ||
std::list<int> list = {{0, 1, 2, 3, 4, 5}}; | ||
TestSequence(MakeListView(list)); | ||
std::set<int> set = {0, 1, 2, 3, 4, 5}; | ||
std::set<int> set = {{0, 1, 2, 3, 4, 5}}; | ||
TestSequence(MakeListView(set)); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Change to 4.22