Skip to content

Commit

Permalink
try python3
Browse files Browse the repository at this point in the history
  • Loading branch information
fokkonaut committed Jul 2, 2024
1 parent e919497 commit c7b31a5
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12...3.27)
cmake_minimum_required(VERSION 2.8.12...3.19.1)
if(CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_VERSION})
endif()
Expand Down Expand Up @@ -96,11 +96,7 @@ set(CLIENT_EXECUTABLE F-Client CACHE STRING "Name of the build client executable
# Download dependencies
########################################################################

if(POLICY CMP0148)
cmake_policy(SET CMP0148 OLD)
endif()

find_package(PythonInterp)
find_package(Python3)
if(DOWNLOAD_DEPENDENCIES)
if(PYTHON_EXECUTABLE AND TARGET_OS STREQUAL "windows" AND TARGET_BITS)
set(DOWNLOADS)
Expand All @@ -111,7 +107,7 @@ if(DOWNLOAD_DEPENDENCIES)
endforeach()
if(DOWNLOADS)
message(STATUS "Downloading Freetype and SDL 2")
execute_process(COMMAND ${PYTHON_EXECUTABLE} scripts/download.py ${DOWNLOADS}
execute_process(COMMAND ${Python3_EXECUTABLE} scripts/download.py ${DOWNLOADS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
endif()
Expand Down Expand Up @@ -358,13 +354,13 @@ if(TARGET_OS AND TARGET_OS STREQUAL "mac")
endif()
show_dependency_status("OpenSSL Crypto" CRYPTO)
show_dependency_status("Pnglite" PNGLITE)
show_dependency_status("PythonInterp" PYTHONINTERP)
show_dependency_status("Python3" Python3)
show_dependency_status("SDL2" SDL2)
show_dependency_status("Wavpack" WAVPACK)
show_dependency_status("Zlib" ZLIB)

if(NOT(PYTHONINTERP_FOUND))
message(SEND_ERROR "You must install Python to compile Teeworlds")
if(NOT(Python3_FOUND))
message(SEND_ERROR "You must install Python to compile ${CMAKE_PROJECT_NAME}")
endif()

if(CLIENT AND NOT(FREETYPE_FOUND))
Expand Down Expand Up @@ -1218,7 +1214,7 @@ file(COPY ${COPY_FILES} DESTINATION .)

function(generate_source output_file script_parameter)
add_custom_command(OUTPUT ${output_file}
COMMAND ${PYTHON_EXECUTABLE} datasrc/compile.py ${script_parameter}
COMMAND ${Python3_EXECUTABLE} datasrc/compile.py ${script_parameter}
> "${PROJECT_BINARY_DIR}/${output_file}"
DEPENDS
datasrc/compile.py
Expand All @@ -1245,7 +1241,7 @@ if(GIT_FOUND)
endif()
endif()
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src/generated/git_revision.cpp
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
scripts/git_revision.py
> ${PROJECT_BINARY_DIR}/src/generated/git_revision.cpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
Expand Down Expand Up @@ -1972,8 +1968,8 @@ if(CLIENT AND (DMGTOOLS_FOUND OR HDIUTIL))
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${TARGET_CLIENT}> ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/
COMMAND ${CMAKE_COMMAND} -E copy ${SDL2_LIBRARY} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/libSDL2-2.0.0.dylib
COMMAND ${CMAKE_COMMAND} -E copy ${FREETYPE_LIBRARY} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/libfreetype.6.dylib
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_change_dylib.py change --tools ${CMAKE_INSTALL_NAME_TOOL} ${CMAKE_OTOOL} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT} SDL2 @executable_path/../Frameworks/libSDL2-2.0.0.dylib
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_change_dylib.py change --tools ${CMAKE_INSTALL_NAME_TOOL} ${CMAKE_OTOOL} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT} libfreetype @executable_path/../Frameworks/libfreetype.6.dylib
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_change_dylib.py change --tools ${CMAKE_INSTALL_NAME_TOOL} ${CMAKE_OTOOL} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT} SDL2 @executable_path/../Frameworks/libSDL2-2.0.0.dylib
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_change_dylib.py change --tools ${CMAKE_INSTALL_NAME_TOOL} ${CMAKE_OTOOL} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT} libfreetype @executable_path/../Frameworks/libfreetype.6.dylib

# SERVER
COMMAND ${CMAKE_COMMAND} -E copy_directory data/maps ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/Resources/data/maps
Expand All @@ -1982,7 +1978,7 @@ if(CLIENT AND (DMGTOOLS_FOUND OR HDIUTIL))
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${TARGET_SERVER}> $<TARGET_FILE:${TARGET_SERVER_LAUNCHER}> ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/MacOS/

# DMG
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/dmg.py create ${DMG_PARAMS} ${CPACK_PACKAGE_FILE_NAME}.dmg ${CPACK_PACKAGE_FILE_NAME} ${DMG_TMPDIR}
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/dmg.py create ${DMG_PARAMS} ${CPACK_PACKAGE_FILE_NAME}.dmg ${CPACK_PACKAGE_FILE_NAME} ${DMG_TMPDIR}

DEPENDS
${TARGET_CLIENT}
Expand Down

0 comments on commit c7b31a5

Please sign in to comment.