Minor progress...
This commit is contained in:
parent
3dd36684b6
commit
9d5af88345
|
@ -3,8 +3,15 @@ cmake_minimum_required (VERSION 3.12.0)
|
|||
set (CARLA_VERSION_MAJOR 0)
|
||||
set (CARLA_VERSION_MINOR 9)
|
||||
set (CARLA_VERSION_PATCH 14)
|
||||
set (CARLA_VERSION ${CARLA_VERSION_MAJOR}.${CARLA_VERSION_MINOR}.${CARLA_VERSION_PATCH})
|
||||
|
||||
project (CARLA)
|
||||
project (
|
||||
CARLA
|
||||
VERSION ${CARLA_VERSION}
|
||||
LANGUAGES CXX
|
||||
DESCRIPTION "Open-source simulator for autonomous driving research."
|
||||
HOMEPAGE_URL "https://carla.org/"
|
||||
)
|
||||
|
||||
include (CheckCCompilerFlag)
|
||||
include (CheckCXXCompilerFlag)
|
||||
|
@ -60,7 +67,9 @@ option (
|
|||
|
||||
set (CARLA_WORKSPACE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set (CARLA_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set (CARLA_DEPENDENCIES_PATH ${CMAKE_CURRENT_BINARY_DIR}/Dependencies)
|
||||
if (NOT CARLA_DEPENDENCIES_PATH)
|
||||
set (CARLA_DEPENDENCIES_PATH ${CMAKE_CURRENT_BINARY_DIR}/Dependencies)
|
||||
endif ()
|
||||
|
||||
set (LIBCARLA_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/LibCarla/source)
|
||||
set (LIBCARLA_THIRD_PARTY_SOURCE_PATH ${LIBCARLA_SOURCE_PATH}/third-party)
|
||||
|
@ -99,7 +108,7 @@ set (
|
|||
|
||||
if (WIN32)
|
||||
# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
|
||||
list (APPEND CARLA_COMMON_DEFINITIONS _WIN32_WINNT=0x0A00) # Windows 10
|
||||
list (APPEND CARLA_COMMON_DEFINITIONS _WIN32_WINNT=0x0601) # Windows 10
|
||||
list (APPEND CARLA_COMMON_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
|
||||
endif ()
|
||||
|
||||
|
@ -124,7 +133,7 @@ endif ()
|
|||
|
||||
if (BUILD_LIBCARLA_SERVER)
|
||||
|
||||
project (LibCarla-Server)
|
||||
project (libcarla-server)
|
||||
|
||||
set (LIBCARLA_SERVER_INCLUDE_PATHS
|
||||
${LIBCARLA_SOURCE_PATH}
|
||||
|
@ -174,19 +183,19 @@ if (BUILD_LIBCARLA_SERVER)
|
|||
)
|
||||
|
||||
add_library (
|
||||
LibCarla-Server STATIC ${LIBCARLA_SERVER_SOURCES}
|
||||
libcarla-server STATIC ${LIBCARLA_SERVER_SOURCES}
|
||||
)
|
||||
|
||||
target_compile_options (
|
||||
LibCarla-Server PRIVATE /EHsc
|
||||
libcarla-server PRIVATE /EHsc
|
||||
)
|
||||
|
||||
target_include_directories (
|
||||
LibCarla-Server PRIVATE ${LIBCARLA_SERVER_INCLUDE_PATHS}
|
||||
libcarla-server PRIVATE ${LIBCARLA_SERVER_INCLUDE_PATHS}
|
||||
)
|
||||
|
||||
target_compile_definitions (
|
||||
LibCarla-Server PRIVATE
|
||||
libcarla-server PRIVATE
|
||||
${CARLA_COMMON_DEFINITIONS}
|
||||
)
|
||||
|
||||
|
@ -196,7 +205,7 @@ endif ()
|
|||
|
||||
if (BUILD_LIBCARLA_CLIENT)
|
||||
|
||||
project (LibCarla-Client)
|
||||
project (libcarla-client)
|
||||
|
||||
set (LIBCARLA_CLIENT_INCLUDE_PATHS
|
||||
${LIBCARLA_SOURCE_PATH}
|
||||
|
@ -268,15 +277,15 @@ if (BUILD_LIBCARLA_CLIENT)
|
|||
)
|
||||
|
||||
add_library (
|
||||
LibCarla-Client STATIC ${LIBCARLA_CLIENT_SOURCES}
|
||||
libcarla-client STATIC ${LIBCARLA_CLIENT_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories (
|
||||
LibCarla-Client PRIVATE ${LIBCARLA_CLIENT_INCLUDE_PATHS}
|
||||
libcarla-client PRIVATE ${LIBCARLA_CLIENT_INCLUDE_PATHS}
|
||||
)
|
||||
|
||||
target_compile_definitions (
|
||||
LibCarla-Client PRIVATE
|
||||
libcarla-client PRIVATE
|
||||
${CARLA_COMMON_DEFINITIONS}
|
||||
)
|
||||
|
||||
|
|
1063
Configure.py
1063
Configure.py
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,4 @@
|
|||
*.egg-info
|
||||
build
|
||||
dependencies
|
||||
dist
|
||||
setup.py
|
||||
dist
|
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma de
|
||||
# Barcelona (UAB).
|
||||
#
|
||||
# This work is licensed under the terms of the MIT license.
|
||||
# For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
from setuptools import setup, Extension
|
||||
from pathlib import Path
|
||||
import subprocess, glob, os
|
||||
|
||||
PYTHON_API_PATH = Path(__file__).parent
|
||||
PYTHON_API_INTERMEDIATE_PATH = PYTHON_API_PATH / 'Intermediate'
|
||||
LICENSE = 'MIT License' if not {ENABLE_RSS} else 'LGPL-v2.1-only License'
|
||||
|
||||
PYTHON_API_INTERMEDIATE_PATH.mkdir(exist_ok = True)
|
||||
PYTHON_API_AMALGAMATED_OBJECT_PATH = PYTHON_API_INTERMEDIATE_PATH / 'libcarla{OBJ_EXT}'
|
||||
|
||||
compile_command = [
|
||||
'{CPP_COMPILER}',
|
||||
'/c',
|
||||
'/std:c++{CPP_STANDARD}',
|
||||
'/I', '{BOOST_INCLUDE_PATH}',
|
||||
'/I', '{RPCLIB_INCLUDE_PATH}',
|
||||
'/I', '{LIBPNG_INCLUDE_PATH}',
|
||||
'/I', '{ZLIB_INCLUDE_PATH}',
|
||||
'/I', '{RECAST_INCLUDE_PATH}',
|
||||
'/I', '{XERCESC_INCLUDE_PATH}',
|
||||
'/I', '{SQLITE_INCLUDE_PATH}',
|
||||
'/I', '{PROJ_INCLUDE_PATH}',
|
||||
PYTHON_API_PATH / 'source' / 'libcarla' / 'libcarla.cpp',
|
||||
f'/Fo{{PYTHON_API_AMALGAMATED_OBJECT_PATH}}',
|
||||
] if os.name == 'nt' else [
|
||||
|
||||
]
|
||||
|
||||
subprocess.run(
|
||||
compile_command
|
||||
).check_returncode()
|
||||
|
||||
sources = []
|
||||
include_paths = []
|
||||
library_paths = []
|
||||
link_libraries = [
|
||||
sorted(glob.glob(str('{BOOST_INSTALL_PATH}/lib/libboost_python*{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{BOOST_INSTALL_PATH}/lib/libboost_filesystem*{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{RPCLIB_INSTALL_PATH}/lib/rpc{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{LIBCARLA_BUILD_PATH}/libcarla-client{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{LIBPNG_INSTALL_PATH}/lib/libpng*{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{ZLIB_INSTALL_PATH}/lib/zlib{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{RECAST_INSTALL_PATH}/lib/Recast{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{RECAST_INSTALL_PATH}/lib/Detour{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{RECAST_INSTALL_PATH}/lib/DetourCrowd{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{XERCESC_INSTALL_PATH}/lib/xerces-c*{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{SQLITE_BUILD_PATH}/sqlite*{LIB_EXT}'), recursive = True))[0],
|
||||
sorted(glob.glob(str('{PROJ_INSTALL_PATH}/lib/proj{LIB_EXT}'), recursive = True))[0],
|
||||
]
|
||||
compile_flags = []
|
||||
link_flags = []
|
||||
dependencies = []
|
||||
|
||||
carla_extensions = [
|
||||
Extension(
|
||||
name = 'libcarla.carla',
|
||||
sources = sources,
|
||||
include_dirs = include_paths,
|
||||
library_dirs = library_paths,
|
||||
libraries = link_libraries,
|
||||
extra_compile_args = compile_flags,
|
||||
extra_link_args = link_flags,
|
||||
extra_objects = [],
|
||||
language = f'c++{CPP_STANDARD}',
|
||||
depends = dependencies)
|
||||
]
|
||||
|
||||
readme = ''
|
||||
with open(PYTHON_API_PATH / 'README.md', 'r') as file:
|
||||
readme = file.read()
|
||||
|
||||
setup(
|
||||
name = 'carla',
|
||||
version = '{CARLA_VERSION_STRING}',
|
||||
package_dir = {{ '' : 'source' }},
|
||||
packages = [ 'carla' ],
|
||||
ext_modules = carla_extensions,
|
||||
license = LICENSE,
|
||||
description = 'Python API for communicating with the CARLA server.',
|
||||
long_description = readme,
|
||||
url = 'https://github.com/carla-simulator/carla',
|
||||
author = 'The CARLA team',
|
||||
author_email = 'carla.simulator@gmail.com',
|
||||
include_package_data = True,
|
||||
)
|
|
@ -1,121 +0,0 @@
|
|||
# Warning: This file is autogenerated from setup.py.txt. Manual changes may be discarded.
|
||||
|
||||
from pathlib import Path
|
||||
from setuptools.command.build_ext import build_ext
|
||||
import setuptools, fnmatch, glob, sys, os
|
||||
|
||||
HERE = Path(__file__).parent.resolve()
|
||||
|
||||
library_paths = []
|
||||
|
||||
libraries = []
|
||||
|
||||
compile_args = [
|
||||
'/experimental:external',
|
||||
'/external:W0',
|
||||
'/external:I',
|
||||
|
||||
'/D_WIN32_WINNT=0x0A00',
|
||||
'/D_CRT_SECURE_NO_WARNINGS',
|
||||
'/DHAVE_SNPRINTF',
|
||||
|
||||
'/DBOOST_ALL_NO_LIB',
|
||||
'/DBOOST_NO_EXCEPTIONS',
|
||||
'/DBOOST_PYTHON_STATIC_LIB',
|
||||
'/DBOOST_ERROR_CODE_HEADER_ONLY',
|
||||
'/DBOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY',
|
||||
|
||||
'/DLIBCARLA_WITH_PYTHON_SUPPORT',
|
||||
'/DLIBCARLA_IMAGE_WITH_PNG_SUPPORT=true',
|
||||
'/MD'
|
||||
]
|
||||
|
||||
link_args = [
|
||||
'shlwapi.lib',
|
||||
'Advapi32.lib',
|
||||
'ole32.lib',
|
||||
'shell32.lib'
|
||||
]
|
||||
|
||||
dependency_patterns = [
|
||||
f'{BUILD_PATH}/**/LibCarla-Client{LIB_EXT}',
|
||||
f'{SQLITE_LIBRARY_PATH}/**/sqlite*{LIB_EXT}',
|
||||
f'{ZLIB_LIBRARY_PATH}/**/zlib{LIB_EXT}',
|
||||
f'{BOOST_LIBRARY_PATH}/**/libboost_python*{LIB_EXT}',
|
||||
f'{BOOST_LIBRARY_PATH}/**/libboost_filesystem{LIB_EXT}',
|
||||
f'{RPCLIB_LIBRARY_PATH}/**/rpc{LIB_EXT}',
|
||||
f'{LIBPNG_LIBRARY_PATH}/**/libpng*{LIB_EXT}',
|
||||
f'{RECAST_LIBRARY_PATH}/**/Recast{LIB_EXT}',
|
||||
f'{RECAST_LIBRARY_PATH}/**/Detour{LIB_EXT}',
|
||||
f'{RECAST_LIBRARY_PATH}/**/DetourCrowd{LIB_EXT}',
|
||||
f'{XERCESC_LIBRARY_PATH}/**/xerces-c*{LIB_EXT}',
|
||||
f'{PROJ_LIBRARY_PATH}/**/proj{LIB_EXT}',
|
||||
f'{SUMO_LIBRARY_PATH}/**/osm2odr{LIB_EXT}'
|
||||
]
|
||||
|
||||
include_paths = [
|
||||
Path('{LIBCARLA_ROOT_PATH}') / 'source',
|
||||
Path('{BOOST_INCLUDE_PATH}'),
|
||||
Path('{RPCLIB_INCLUDE_PATH}'),
|
||||
Path('{LIBPNG_INCLUDE_PATH}'),
|
||||
Path('{ZLIB_INCLUDE_PATH}'),
|
||||
Path('{RECAST_INCLUDE_PATH}'),
|
||||
Path('{XERCESC_INCLUDE_PATH}'),
|
||||
Path('{SQLITE_INCLUDE_PATH}'),
|
||||
Path('{PROJ_INCLUDE_PATH}'),
|
||||
Path('{SUMO_INCLUDE_PATH}'),
|
||||
]
|
||||
|
||||
include_paths = [ str(e.resolve()) for e in include_paths ]
|
||||
|
||||
for pattern in dependency_patterns:
|
||||
candidates = glob.glob(pattern, recursive = True)
|
||||
candidates.sort()
|
||||
assert len(candidates) != 0
|
||||
if len(candidates) > 1:
|
||||
print(f'Warning: Multiple candidates match "{{pattern}}":\n{{candidates}}\n')
|
||||
link_args.append(str(Path(candidates[0]).resolve()))
|
||||
|
||||
depends = glob.glob('F:/Carla/PythonAPI/carla/source/libcarla/**/*', recursive = True)
|
||||
depends2 = [ str(Path(e).relative_to(HERE)) for e in depends ]
|
||||
depends = depends2
|
||||
|
||||
extensions = [ setuptools.Extension(
|
||||
'carla.libcarla',
|
||||
sources = [ 'source/libcarla/libcarla.cpp' ],
|
||||
include_dirs = include_paths,
|
||||
library_dirs = library_paths,
|
||||
libraries = libraries,
|
||||
extra_compile_args = compile_args,
|
||||
extra_link_args = link_args,
|
||||
language = 'c++14',
|
||||
depends = depends)
|
||||
]
|
||||
|
||||
readme = ''
|
||||
with open(Path('{WORKSPACE_PATH}') / 'README.md', 'r') as file:
|
||||
readme = file.read()
|
||||
|
||||
class BuildEXT(build_ext):
|
||||
def build_extensions(self):
|
||||
self.compiler.set_executable('compiler_so', '{CPP_COMPILER}')
|
||||
self.compiler.set_executable('compiler_cxx', '{CPP_COMPILER}')
|
||||
self.compiler.set_executable('linker_so', '{LINKER}')
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
setuptools.setup(
|
||||
name = 'carla',
|
||||
version = '{CARLA_VERSION_STRING}',
|
||||
package_dir = {{ '' : 'source' }},
|
||||
packages = ['carla'],
|
||||
ext_modules = extensions,
|
||||
license = 'MIT License' if not ('-enable-rss' in sys.argv) else 'LGPL-v2.1-only License',
|
||||
description = 'Python API for communicating with the CARLA server.',
|
||||
long_description = readme,
|
||||
long_description_content_type = 'text/markdown',
|
||||
url = 'https://github.com/carla-simulator/carla',
|
||||
author = 'The CARLA team',
|
||||
author_email = 'carla.simulator@gmail.com',
|
||||
include_package_data = True,
|
||||
cmdclass = {{ 'build_ext' : BuildEXT }},
|
||||
)
|
Loading…
Reference in New Issue