Skip to content

Commit

Permalink
disabling embedded python in cmake, enabling swig, refs #3752
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Mar 28, 2018
1 parent 8f5479e commit c13e4d1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
22 changes: 0 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,28 +208,6 @@ endif ()
# Now simply link your own targets against gtest, gmock,
# etc. as appropriate

# Python libs can be linked using find_package or specifying the folders (In the case of Apple systems or autobuild)
set(PYTHON_LIBRARIES $ENV{PYTHON_LIB})
set(PYTHON_INCLUDE_DIRS $ENV{PYTHON_INCLUDE})

if (APPLE)
include_directories("/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/")
set(PYTHON_LIBRARIES "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib")
elseif (PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS)
# Needed to avoid problems with pythons in 64 bits Windows
message(STATUS "Python include dirs:" ${PYTHON_INCLUDE_DIRS})
message(STATUS "Python libs:" ${PYTHON_LIBRARIES})
include_directories(${PYTHON_INCLUDE_DIRS})
else ()
find_package(PythonLibs)
if (PYTHONLIBS_FOUND)
message(STATUS "Python: " ${PYTHONLIBS_VERSION_STRING})
message(STATUS "Python include dirs:" ${PYTHON_INCLUDE_DIRS})
message(STATUS "Python libs:" ${PYTHON_LIBRARIES})
include_directories(${PYTHON_INCLUDE_DIRS})
endif ()
endif ()

if (BUILD_GRPC)
find_package(GRPC)
if (GRPC_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion build/cmake_modules/FindProj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ FIND_PATH(PROJ_INCLUDE_DIR proj_api.h
"$ENV{GDAL_DIR}/include"
)

FIND_LIBRARY(PROJ_LIBRARY NAMES proj proj_i PATHS
FIND_LIBRARY(PROJ_LIBRARY NAMES proj_i proj PATHS
"$ENV{LIB}"
"$ENV{LIB_DIR}/lib"
"$ENV{GDAL_DIR}/lib"
Expand Down
6 changes: 4 additions & 2 deletions tools/build/buildCMakeProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
or add the folder of cmake executable to PATH""")
else:
print("Searching libraries...")

cmakeOpt = ["-DBUILD_GTEST_FROM_GIT=true"]
# append custom lib dir to search path
for libDir in (os.path.join(SUMO_HOME, "lib"), os.path.join(SUMO_HOME, "SUMOLibraries"),
os.path.join(SUMO_HOME, "..", "SUMOLibraries"), os.path.join(SUMO_HOME, "..", "..", "SUMOLibraries")):
Expand All @@ -58,6 +58,8 @@
elif "python36" in folder.lower() and "scripts" not in folder.lower():
os.environ["PYTHON_LIB"] = folder + "libs\python36.lib"
os.environ["PYTHON_INCLUDE"] = folder + "include"
elif "swig" in folder.lower():
cmakeOpt += ["-DSWIG_EXECUTABLE=%sswig.exe" % folder[:-3]]

generator = sys.argv[1] if len(sys.argv) > 1 else "Visual Studio 12 2013 Win64"
buildDir = os.path.join(SUMO_HOME, "build/cmake-build-" + generator.replace(" ", "-"))
Expand All @@ -67,4 +69,4 @@
shutil.rmtree(buildDir)
os.makedirs(buildDir)
print ("Creating solution for", generator)
subprocess.call([CMAKE[0], "../..", "-G", generator, "-DBUILD_GTEST_FROM_GIT=true"], cwd=buildDir)
subprocess.call([CMAKE[0], "../..", "-G", generator] + cmakeOpt, cwd=buildDir)

0 comments on commit c13e4d1

Please sign in to comment.