Changeset - r24349:3fa910f6f5ee
CMakeLists.txt
Show inline comments
 
@@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT BINARY_NAME)
 
    set(BINARY_NAME openttd)
 
endif (NOT BINARY_NAME)
 
endif()
 

	
 
project(${BINARY_NAME})
 

	
 
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
 
    message(FATAL_ERROR "In-source builds not allowed. Please run \"cmake ..\" from the bin directory")
 
endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
 
endif()
 

	
 
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
 
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
 
@@ -17,7 +17,7 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
 
# but set our own default data dir
 
if (NOT CMAKE_INSTALL_DATADIR)
 
    set(CMAKE_INSTALL_DATADIR "share/games")
 
endif (NOT CMAKE_INSTALL_DATADIR)
 
endif()
 
include(GNUInstallDirs)
 

	
 
include(Options)
 
@@ -43,24 +43,24 @@ if (NOT WIN32)
 
        find_package(SDL2)
 
        if (NOT SDL2_FOUND)
 
            find_package(SDL)
 
        endif( NOT SDL2_FOUND)
 
        endif()
 
        find_package(Fluidsynth)
 
        find_package(Freetype)
 
        find_package(Fontconfig)
 
        find_package(ICU OPTIONAL_COMPONENTS i18n lx)
 
        find_package(XDG_basedir)
 
    else (NOT APPLE)
 
    else()
 
        find_package(Iconv)
 

	
 
        find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
 
        find_library(AUDIOUNIT_LIBRARY AudioUnit)
 
        find_library(COCOA_LIBRARY Cocoa)
 
    endif (NOT APPLE)
 
endif (NOT WIN32)
 
    endif()
 
endif()
 

	
 
if (MSVC)
 
    find_package(Editbin REQUIRED)
 
endif (MSVC)
 
endif()
 

	
 
find_package(SSE)
 
find_package(Xaudio2)
 
@@ -73,34 +73,34 @@ if (POLICY CMP0069)
 
    cmake_policy(SET CMP0069 NEW)
 
    include(CheckIPOSupported)
 
    check_ipo_supported(RESULT IPO_FOUND)
 
endif (POLICY CMP0069)
 
endif()
 

	
 
show_options()
 

	
 
if (UNIX AND NOT APPLE AND NOT OPTION_DEDICATED)
 
    if (NOT SDL_FOUND AND NOT SDL2_FOUND)
 
        message(FATAL_ERROR "SDL or SDL2 is required for this platform")
 
    endif (NOT SDL_FOUND AND NOT SDL2_FOUND)
 
endif (UNIX AND NOT APPLE AND NOT OPTION_DEDICATED)
 
    endif()
 
endif()
 
if (APPLE)
 
    if (NOT AUDIOTOOLBOX_LIBRARY)
 
        message(FATAL_ERROR "AudioToolbox is required for this platform")
 
    endif (NOT AUDIOTOOLBOX_LIBRARY)
 
    endif()
 
    if (NOT AUDIOUNIT_LIBRARY)
 
        message(FATAL_ERROR "AudioUnit is required for this platform")
 
    endif (NOT AUDIOUNIT_LIBRARY)
 
    endif()
 
    if (NOT COCOA_LIBRARY)
 
        message(FATAL_ERROR "Cocoa is required for this platform")
 
    endif (NOT COCOA_LIBRARY)
 
endif (APPLE)
 
    endif()
 
endif()
 

	
 
if (MSVC)
 
    # C++17 for MSVC
 
    set(CMAKE_CXX_STANDARD 17)
 
else (MSVC)
 
else()
 
    # C++11 for all other targets
 
    set(CMAKE_CXX_STANDARD 11)
 
endif (MSVC)
 
endif()
 

	
 
set(CMAKE_CXX_STANDARD_REQUIRED YES)
 
set(CMAKE_CXX_EXTENSIONS NO)
 
@@ -110,7 +110,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
 
list(APPEND GENERATED_SOURCE_FILES "${CMAKE_BINARY_DIR}/generated/rev.cpp")
 
if (WIN32)
 
    list(APPEND GENERATED_SOURCE_FILES "${CMAKE_BINARY_DIR}/generated/ottdres.rc")
 
endif (WIN32)
 
endif()
 

	
 
# Generate a target to determine version, which is execute every 'make' run
 
add_custom_target(find_version
 
@@ -159,13 +159,13 @@ if (IPO_FOUND)
 
    set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE True)
 
    set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True)
 
    set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True)
 
endif (IPO_FOUND)
 
endif()
 
set_target_properties(openttd PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
 
process_compile_flags()
 

	
 
if (APPLE OR UNIX)
 
    add_definitions(-DUNIX)
 
endif (APPLE OR UNIX)
 
endif()
 

	
 
include(LinkPackage)
 
link_package(PNG TARGET PNG::PNG ENCOURAGED)
 
@@ -183,7 +183,7 @@ if (NOT OPTION_DEDICATED)
 
    link_package(Fontconfig TARGET Fontconfig::Fontconfig)
 
    link_package(ICU_lx)
 
    link_package(ICU_i18n)
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
if (APPLE)
 
    link_package(Iconv TARGET Iconv::Iconv)
 
@@ -198,27 +198,27 @@ if (APPLE)
 
        -DWITH_COCOA
 
        -DENABLE_COCOA_QUARTZ
 
    )
 
endif (APPLE)
 
endif()
 

	
 
if (NOT PERSONAL_DIR STREQUAL "(not set)")
 
    add_definitions(
 
        -DWITH_PERSONAL_DIR
 
        -DPERSONAL_DIR="${PERSONAL_DIR}"
 
    )
 
endif (NOT PERSONAL_DIR STREQUAL "(not set)")
 
endif()
 

	
 
if (NOT SHARED_DIR STREQUAL "(not set)")
 
    add_definitions(
 
        -DWITH_SHARED_DIR
 
        -DSHARED_DIR="${SHARED_DIR}"
 
    )
 
endif (NOT SHARED_DIR STREQUAL "(not set)")
 
endif()
 

	
 
if (NOT GLOBAL_DIR STREQUAL "(not set)")
 
    add_definitions(
 
        -DGLOBAL_DATA_DIR="${GLOBAL_DIR}"
 
    )
 
endif (NOT GLOBAL_DIR STREQUAL "(not set)")
 
endif()
 

	
 
link_package(SSE)
 

	
 
@@ -236,11 +236,11 @@ if (WIN32)
 
        winmm
 
        imm32
 
    )
 
endif (WIN32)
 
endif()
 

	
 
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
 
    add_definitions(-D_SQ64)
 
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
 
endif()
 

	
 
include(CreateRegression)
 
create_regression()
cmake/AddCustomXXXTimestamp.cmake
Show inline comments
 
@@ -9,7 +9,7 @@ macro(_parse_arguments_with_multi_hack O
 

	
 
    foreach(MULTI IN LISTS MULTIS)
 
        string(REPLACE "${MULTI}" "${MULTI};:::" COMMAND_LINE "${COMMAND_LINE}")
 
    endforeach(MULTI)
 
    endforeach()
 

	
 
    cmake_parse_arguments(PARAM "${OPTIONS}" "${SINGLES}" "${MULTIS}" ${COMMAND_LINE})
 
endmacro()
 
@@ -21,14 +21,14 @@ macro(_reassemble_command_line)
 
    foreach(OPTION IN LISTS OPTIONS)
 
        if (PARAM_${OPTION})
 
            list(APPEND NEW_COMMAND_LINE "${OPTION}")
 
        endif (PARAM_${OPTION})
 
    endforeach(OPTION)
 
        endif()
 
    endforeach()
 

	
 
    foreach(SINGLE IN LISTS SINGLES)
 
        if (PARAM_${SINGLE})
 
            list(APPEND NEW_COMMAND_LINE "${SINGLE}" "${PARAM_${SINGLE}}")
 
        endif (PARAM_${SINGLE})
 
    endforeach(SINGLE)
 
        endif()
 
    endforeach()
 

	
 
    foreach(MULTI IN LISTS MULTIS)
 
        if (PARAM_${MULTI})
 
@@ -36,8 +36,8 @@ macro(_reassemble_command_line)
 
            # restores for example multiple COMMANDs again.
 
            string(REPLACE ":::" "${MULTI}" PARAM_${MULTI} "${PARAM_${MULTI}}")
 
            list(APPEND NEW_COMMAND_LINE "${PARAM_${MULTI}}")
 
        endif (PARAM_${MULTI})
 
    endforeach(MULTI)
 
        endif()
 
    endforeach()
 
endmacro()
 

	
 
# Generated files can be older than their dependencies, causing useless
 
@@ -91,12 +91,12 @@ function(add_custom_command_timestamp)
 
        # add_custom_target_timestamp() to know if we should point to the
 
        # '.timestamp' variant or not.
 
        set_source_files_properties(${OUTPUT} PROPERTIES BYPRODUCT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILENAME}.timestamp)
 
    endforeach(OUTPUT)
 
    endforeach()
 

	
 
    # Reassemble and call the wrapped command
 
    _reassemble_command_line()
 
    add_custom_command(${NEW_COMMAND_LINE})
 
endfunction(add_custom_command_timestamp)
 
endfunction()
 

	
 
# Generated files can be older than their dependencies, causing useless
 
# regenerations. This function adds a .timestamp file for each file in DEPENDS
 
@@ -133,13 +133,13 @@ function(add_custom_target_timestamp)
 
        if (BYPRODUCT STREQUAL "NOTFOUND")
 
            # If it is not, just keep it as DEPEND
 
            list(APPEND PARAM_DEPENDS "${DEPEND}")
 
        else (BYPRODUCT STREQUAL "NOTFOUND")
 
        else()
 
            # If it is, the BYPRODUCT property points to the timestamp we want to depend on
 
            list(APPEND PARAM_DEPENDS "${BYPRODUCT}")
 
        endif (BYPRODUCT STREQUAL "NOTFOUND")
 
    endforeach(DEPEND)
 
        endif()
 
    endforeach()
 

	
 
    # Reassemble and call the wrapped command
 
    _reassemble_command_line()
 
    add_custom_target(${NEW_COMMAND_LINE})
 
endfunction(add_custom_target_timestamp)
 
endfunction()
cmake/CompileFlags.cmake
Show inline comments
 
@@ -26,11 +26,11 @@ macro(compile_flags)
 
        if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 
            # Enable multi-threaded compilation.
 
            add_compile_options(/MP)
 
        endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 
        endif()
 

	
 
        # Add DPI manifest to project; other WIN32 targets get this via ottdres.rc
 
        list(APPEND GENERATED_SOURCE_FILES "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest")
 
    endif (MSVC)
 
    endif()
 

	
 
    # Add some -D flags for Debug builds. We cannot use add_definitions(), because
 
    # it does not appear to support the $<> tags.
 
@@ -42,7 +42,7 @@ macro(compile_flags)
 
        add_link_options(
 
            "$<$<NOT:$<CONFIG:Debug>>:-fstack-protector>" # Prevent undefined references when _FORTIFY_SOURCE > 0
 
        )
 
    endif (MINGW)
 
    endif()
 

	
 
    # Prepare a generator that checks if we are not a debug, and don't have asserts
 
    # on. We need this later on to set some compile options for stable releases.
 
@@ -87,12 +87,12 @@ macro(compile_flags)
 
                "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>"
 
                "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>"
 
            )
 
        else (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
        else()
 
            add_compile_options(
 
                "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
 
                "$<${IS_STABLE_RELEASE}:-Wno-unused-parameter>"
 
            )
 
        endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
        endif()
 

	
 
        # Ninja processes the output so the output from the compiler
 
        # isn't directly to a terminal; hence, the default is
 
@@ -104,8 +104,8 @@ macro(compile_flags)
 
                add_compile_options (-fdiagnostics-color=always)
 
            elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
                add_compile_options (-fcolor-diagnostics)
 
            endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
 
        endif (OPTION_FORCE_COLORED_OUTPUT)
 
            endif()
 
        endif()
 

	
 
        if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
            include(CheckCXXCompilerFlag)
 
@@ -126,7 +126,7 @@ macro(compile_flags)
 
                # well with our custom pool item allocator
 
                "$<$<BOOL:${LIFETIME_DSE_FOUND}>:-flifetime-dse=1>"
 
            )
 
        endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
        endif()
 
    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
 
        add_compile_options(
 
            -Wall
 
@@ -146,5 +146,5 @@ macro(compile_flags)
 
    if (NOT WIN32)
 
        # rdynamic is used to get useful stack traces from crash reports.
 
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
 
    endif (NOT WIN32)
 
    endif()
 
endmacro()
cmake/CreateGrfCommand.cmake
Show inline comments
 
@@ -26,7 +26,7 @@ function(create_grf_command)
 
        )
 

	
 
        list(APPEND GRF_PNG_BINARY_FILES ${GRF_PNG_BINARY_FILE})
 
    endforeach(GRF_PNG_SOURCE_FILE)
 
    endforeach()
 

	
 
    add_custom_command(OUTPUT ${GRF_BINARY_FILE}
 
            COMMAND ${CMAKE_COMMAND}
cmake/CreateRegression.cmake
Show inline comments
 
@@ -15,7 +15,7 @@ macro(create_regression)
 

	
 
        if ("${REGRESSION_SOURCE_FILE_NAME}" STREQUAL "regression.cfg")
 
            continue()
 
        endif ("${REGRESSION_SOURCE_FILE_NAME}" STREQUAL "regression.cfg")
 
        endif()
 

	
 
        add_custom_command(OUTPUT ${REGRESSION_BINARY_FILE}
 
                COMMAND ${CMAKE_COMMAND} -E copy
 
@@ -26,7 +26,7 @@ macro(create_regression)
 
        )
 

	
 
        list(APPEND REGRESSION_BINARY_FILES ${REGRESSION_BINARY_FILE})
 
    endforeach(REGRESSION_SOURCE_FILE)
 
    endforeach()
 

	
 
    # Copy the regression configuration in a special folder, so all autogenerated
 
    # folders end up in the same place after running regression.
 
@@ -55,7 +55,7 @@ macro(create_regression)
 

	
 
        if ("${REGRESSION_TEST_NAME}" STREQUAL "regression.cfg")
 
            continue()
 
        endif ("${REGRESSION_TEST_NAME}" STREQUAL "regression.cfg")
 
        endif()
 

	
 
        add_custom_target(regression_${REGRESSION_TEST_NAME}
 
                COMMAND ${CMAKE_COMMAND}
 
@@ -78,7 +78,7 @@ macro(create_regression)
 
                WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 

	
 
        list(APPEND REGRESSION_TARGETS regression_${REGRESSION_TEST_NAME})
 
    endforeach(REGRESSION_TEST)
 
    endforeach()
 

	
 
    # Create a new target which runs the regression
 
    add_custom_target(regression
cmake/Endian.cmake
Show inline comments
 
@@ -8,7 +8,7 @@ function(add_endian_definition)
 

	
 
    if (IS_BIG_ENDIAN)
 
        add_definitions(-DTTD_ENDIAN=TTD_BIG_ENDIAN)
 
    else (IS_BIG_ENDIAN)
 
    else()
 
        add_definitions(-DTTD_ENDIAN=TTD_LITTLE_ENDIAN)
 
    endif (IS_BIG_ENDIAN)
 
    endif()
 
endfunction()
cmake/FindEditbin.cmake
Show inline comments
 
@@ -4,12 +4,12 @@ if (NOT EDITBIN_DIRECTORY)
 
    if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 
        get_filename_component(MSVC_COMPILE_DIRECTORY ${CMAKE_CXX_COMPILER} DIRECTORY)
 
        set(EDITBIN_DIRECTORY ${MSVC_COMPILE_DIRECTORY})
 
    else (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 
    else()
 
        # For clang-cl build
 
        # find editbin.exe from environmental variable VCToolsInstallDir
 
        set(EDITBIN_DIRECTORY "$ENV{VCToolsInstallDir}/bin/Hostx64/x64")
 
    endif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 
endif (NOT EDITBIN_DIRECTORY)
 
    endif()
 
endif()
 

	
 
message(CHECK_START "Finding editbin.exe")
 
find_program(
 
@@ -19,9 +19,9 @@ find_program(
 

	
 
if (EDITBIN_EXECUTABLE)
 
    message(CHECK_PASS "found")
 
else (EDITBIN_EXECUTABLE)
 
else()
 
    message(CHECK_FAIL "not found , please manually specify EDITBIN_DIRECTORY")
 
endif (EDITBIN_EXECUTABLE)
 
endif()
 

	
 
include(FindPackageHandleStandardArgs)
 
find_package_handle_standard_args(Editbin
cmake/FindSSE.cmake
Show inline comments
 
@@ -6,7 +6,7 @@ set(CMAKE_REQUIRED_FLAGS "")
 

	
 
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
    set(CMAKE_REQUIRED_FLAGS "-msse4.1")
 
endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
endif()
 

	
 
check_cxx_source_compiles("
 
    #include <xmmintrin.h>
cmake/InstallAndPackage.cmake
Show inline comments
 
@@ -6,12 +6,12 @@ if (OPTION_INSTALL_FHS)
 
    set(DATA_DESTINATION_DIR "${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}")
 
    set(DOCS_DESTINATION_DIR "${CMAKE_INSTALL_DOCDIR}")
 
    set(MAN_DESTINATION_DIR "${CMAKE_INSTALL_MANDIR}")
 
else (OPTION_INSTALL_FHS)
 
else()
 
    set(BINARY_DESTINATION_DIR ".")
 
    set(DATA_DESTINATION_DIR ".")
 
    set(DOCS_DESTINATION_DIR ".")
 
    set(MAN_DESTINATION_DIR ".")
 
endif (OPTION_INSTALL_FHS)
 
endif()
 

	
 
install(TARGETS openttd
 
        RUNTIME
 
@@ -52,26 +52,26 @@ if (OPTION_INSTALL_FHS)
 
                    ${MAN_BINARY_FILE}.gz
 
            DESTINATION ${MAN_DESTINATION_DIR}/man6
 
            COMPONENT manual)
 
endif (OPTION_INSTALL_FHS)
 
endif()
 

	
 
# TODO -- Media files
 
# TODO -- Menu files
 

	
 
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
 
    set(ARCHITECTURE "amd64")
 
else (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
 
else()
 
    string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCHITECTURE)
 
endif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
 
endif()
 

	
 
# Windows is a bit more annoying to detect; using the size of void pointer
 
# seems to be the most robust.
 
if (WIN32)
 
    if (CMAKE_SIZEOF_VOID_P EQUAL 8)
 
        set(ARCHITECTURE "win64")
 
    else (CMAKE_SIZEOF_VOID_P EQUAL 8)
 
    else()
 
        set(ARCHITECTURE "win32")
 
    endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
 
endif (WIN32)
 
    endif()
 
endif()
 

	
 
set(CPACK_SYSTEM_NAME "${ARCHITECTURE}")
 

	
 
@@ -100,7 +100,7 @@ elseif (WIN32)
 
    if (OPTION_USE_NSIS)
 
        list(APPEND CPACK_GENERATOR "NSIS")
 
        include(PackageNSIS)
 
    endif (OPTION_USE_NSIS)
 
    endif()
 

	
 
    set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-windows-${CPACK_SYSTEM_NAME}")
 
elseif (UNIX)
 
@@ -110,9 +110,9 @@ elseif (UNIX)
 
    if (OPTION_INSTALL_FHS)
 
        set(CPACK_GENERATOR "DEB")
 
        include(PackageDeb)
 
    else (OPTION_INSTALL_FHS)
 
    else()
 
        set(CPACK_GENERATOR "TXZ")
 
    endif (OPTION_INSTALL_FHS)
 
    endif()
 

	
 
    set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${CPACK_SYSTEM_NAME}")
 
else ()
cmake/Options.cmake
Show inline comments
 
@@ -24,17 +24,17 @@ function(set_directory_options)
 
    if (NOT PERSONAL_DIR)
 
        set(PERSONAL_DIR "${DEFAULT_PERSONAL_DIR}" CACHE STRING "Personal directory")
 
        message(STATUS "Detecting Personal Data directory - ${PERSONAL_DIR}")
 
    endif (NOT PERSONAL_DIR)
 
    endif()
 

	
 
    if (NOT SHARED_DIR)
 
        set(SHARED_DIR "${DEFAULT_SHARED_DIR}" CACHE STRING "Shared directory")
 
        message(STATUS "Detecting Shared Data directory - ${SHARED_DIR}")
 
    endif (NOT SHARED_DIR)
 
    endif()
 

	
 
    if (NOT GLOBAL_DIR)
 
        set(GLOBAL_DIR "${DEFAULT_GLOBAL_DIR}" CACHE STRING "Global directory")
 
        message(STATUS "Detecting Global Data directory - ${GLOBAL_DIR}")
 
    endif (NOT GLOBAL_DIR)
 
    endif()
 
endfunction()
 

	
 
# Set some generic options that influence what is being build.
 
@@ -44,9 +44,9 @@ endfunction()
 
function(set_options)
 
    if (UNIX AND NOT APPLE)
 
        set(DEFAULT_OPTION_INSTALL_FHS ON)
 
    else (UNIX AND NOT APPLE)
 
    else()
 
        set(DEFAULT_OPTION_INSTALL_FHS OFF)
 
    endif (UNIX AND NOT APPLE)
 
    endif()
 

	
 
    option(OPTION_FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
 

	
 
@@ -76,15 +76,15 @@ endfunction()
 
function(add_definitions_based_on_options)
 
    if (OPTION_DEDICATED)
 
        add_definitions(-DDEDICATED)
 
    endif (OPTION_DEDICATED)
 
    endif()
 

	
 
    if (NOT OPTION_USE_THREADS)
 
        add_definitions(-DNO_THREADS)
 
    endif (NOT OPTION_USE_THREADS)
 
    endif()
 

	
 
    if (OPTION_USE_ASSERTS)
 
        add_definitions(-DWITH_ASSERT)
 
    else (OPTION_USE_ASSERTS)
 
    else()
 
        add_definitions(-DNDEBUG)
 
    endif (OPTION_USE_ASSERTS)
 
    endif()
 
endfunction()
cmake/SourceList.cmake
Show inline comments
 
@@ -13,13 +13,13 @@ function(add_files)
 
    if (PARAM_CONDITION)
 
        if (NOT (${PARAM_CONDITION}))
 
            return()
 
        endif (NOT (${PARAM_CONDITION}))
 
    endif (PARAM_CONDITION)
 
        endif()
 
    endif()
 

	
 
    foreach(FILE IN LISTS PARAM_FILES)
 
        target_sources(openttd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
 
    endforeach()
 
endfunction(add_files)
 
endfunction()
 

	
 
# This function works around an 'issue' with CMake, where
 
# set_source_files_properties() only works in the scope of the file. We want
 
@@ -42,7 +42,7 @@ function(set_compile_flags)
 
    endforeach()
 

	
 
    set_property(GLOBAL PROPERTY source_properties "${SOURCE_PROPERTIES}")
 
endfunction(set_compile_flags)
 
endfunction()
 

	
 
# Call this macro in the same CMakeLists.txt and after add_executable().
 
# This makes sure all the COMPILE_FLAGS of set_compile_flags() are set
 
@@ -60,4 +60,4 @@ function(process_compile_flags)
 

	
 
        set_source_files_properties(${FILE} PROPERTIES COMPILE_FLAGS ${PROPERTIES})
 
    endforeach()
 
endfunction(process_compile_flags)
 
endfunction()
cmake/scripts/Baseset.cmake
Show inline comments
 
@@ -14,11 +14,11 @@ while(ARGC LESS CMAKE_ARGC)
 

	
 
    if (ARG_READ)
 
        list(APPEND LANG_SOURCE_FILES "${ARG}")
 
    endif (ARG_READ)
 
    endif()
 

	
 
    if (ARG STREQUAL "--")
 
        set(ARG_READ YES)
 
    endif (ARG STREQUAL "--")
 
    endif()
 

	
 
    math(EXPR ARGC "${ARGC} + 1")
 
endwhile()
 
@@ -35,7 +35,7 @@ foreach(LANGFILE IN LISTS LANG_SOURCE_FI
 
    string(FIND "${LANGLINES}" "${STR_ID}" HAS_STR_ID)
 
    if (HAS_STR_ID LESS 0)
 
        continue()
 
    endif (HAS_STR_ID LESS 0)
 
    endif()
 
    string(REGEX REPLACE "##isocode ([^;]+).*" "\\1" ISOCODE "${LANGLINES}")
 
    if ("${ISOCODE}" STREQUAL "en_GB")
 
        string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}       = \\1" LANGLINES "${LANGLINES}")
 
@@ -43,7 +43,7 @@ foreach(LANGFILE IN LISTS LANG_SOURCE_FI
 
        string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}.${ISOCODE} = \\1" LANGLINES "${LANGLINES}")
 
    endif()
 
    list(APPEND ${PLACE_HOLDER} ${LANGLINES})
 
endforeach(LANGFILE)
 
endforeach()
 
list(SORT ${PLACE_HOLDER})
 
string(REPLACE ";" "\n" ${PLACE_HOLDER} "${${PLACE_HOLDER}}")
 

	
cmake/scripts/CreateGRF.cmake
Show inline comments
 
@@ -7,16 +7,16 @@ cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT NFORENUM_EXECUTABLE)
 
    message(FATAL_ERROR "Script needs NFORENUM_EXECUTABLE defined")
 
endif (NOT NFORENUM_EXECUTABLE)
 
endif()
 
if (NOT GRFCODEC_EXECUTABLE)
 
    message(FATAL_ERROR "Script needs GRFCODEC_EXECUTABLE defined")
 
endif (NOT GRFCODEC_EXECUTABLE)
 
endif()
 
if (NOT GRF_SOURCE_FOLDER)
 
    message(FATAL_ERROR "Script needs GRF_SOURCE_FOLDER defined")
 
endif (NOT GRF_SOURCE_FOLDER)
 
endif()
 
if (NOT GRF_BINARY_FILE)
 
    message(FATAL_ERROR "Script needs GRF_BINARY_FILE defined")
 
endif (NOT GRF_BINARY_FILE)
 
endif()
 

	
 
get_filename_component(GRF_SOURCE_FOLDER_NAME "${GRF_SOURCE_FOLDER}" NAME)
 

	
 
@@ -34,10 +34,10 @@ foreach(NFO_LINE IN LISTS NFO_LINES)
 
        string(REGEX REPLACE "^#include \"(.*)\"$" "\\1" INCLUDE_FILE ${NFO_LINE})
 
        file(READ ${GRF_SOURCE_FOLDER}/${INCLUDE_FILE} INCLUDE_LINES)
 
        file(APPEND sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "${INCLUDE_LINES}")
 
    else (NFO_LINE MATCHES "^#include")
 
    else()
 
        file(APPEND sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "${NFO_LINE}\n")
 
    endif (NFO_LINE MATCHES "^#include")
 
endforeach(NFO_LINE)
 
    endif()
 
endforeach()
 

	
 
execute_process(COMMAND ${NFORENUM_EXECUTABLE} -s sprites/${GRF_SOURCE_FOLDER_NAME}.nfo)
 
execute_process(COMMAND ${GRFCODEC_EXECUTABLE} -n -s -e -p1 ${GRF_SOURCE_FOLDER_NAME}.grf)
cmake/scripts/FindVersion.cmake
Show inline comments
 
@@ -123,7 +123,7 @@ message(STATUS "Version string: ${REV_VE
 
if (GENERATE_OTTDREV)
 
    message(STATUS "Generating .ottdrev")
 
    file(WRITE ${CMAKE_SOURCE_DIR}/.ottdrev "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\t${REV_YEAR}\n")
 
else (GENERATE_OTTDREV)
 
else()
 
    message(STATUS "Generating rev.cpp")
 
    configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in"
 
            "${FIND_VERSION_BINARY_DIR}/rev.cpp")
 
@@ -132,9 +132,9 @@ else (GENERATE_OTTDREV)
 
        message(STATUS "Generating ottdres.rc")
 
        configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in"
 
                "${FIND_VERSION_BINARY_DIR}/ottdres.rc")
 
    endif (WIN32)
 
    endif()
 

	
 
    message(STATUS "Generating CPackProperties.cmake")
 
    configure_file("${CMAKE_SOURCE_DIR}/CPackProperties.cmake.in"
 
            "${CPACK_BINARY_DIR}/CPackProperties.cmake" @ONLY)
 
endif (GENERATE_OTTDREV)
 
endif()
cmake/scripts/GenerateWidget.cmake
Show inline comments
 
@@ -17,10 +17,10 @@ cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT GENERATE_SOURCE_FILE)
 
    message(FATAL_ERROR "Script needs GENERATE_SOURCE_FILE defined")
 
endif (NOT GENERATE_SOURCE_FILE)
 
endif()
 
if (NOT GENERATE_BINARY_FILE)
 
    message(FATAL_ERROR "Script needs GENERATE_BINARY_FILE defined")
 
endif (NOT GENERATE_BINARY_FILE)
 
endif()
 

	
 
file(STRINGS ${GENERATE_SOURCE_FILE} ENUM_LINES REGEX "@enum")
 

	
 
@@ -62,19 +62,19 @@ foreach(ENUM IN LISTS ENUM_LINES)
 
                set(ACTIVE 1)
 
                if (ACTIVE_COMMENT GREATER 0)
 
                     string(APPEND ${PLACE_HOLDER} "\n${COMMENT}")
 
                endif (ACTIVE_COMMENT GREATER 0)
 
                endif()
 
                unset(ACTIVE_COMMENT)
 
                unset(COMMENT)
 
            endif ("${LINE}" MATCHES "^	*enum *${ENUM_PATTERN} *\{")
 
            endif()
 

	
 
            # Forget doxygen comment, if no enum follows
 
            if (ACTIVE_COMMENT EQUAL 2 AND NOT "${LINE}" STREQUAL "")
 
                unset(ACTIVE_COMMENT)
 
                unset(COMMENT)
 
            endif (ACTIVE_COMMENT EQUAL 2 AND NOT "${LINE}" STREQUAL "")
 
            endif()
 
            if (ACTIVE_COMMENT EQUAL 1 AND "${LINE}" MATCHES "\\*/")
 
                set(ACTIVE_COMMENT 2)
 
            endif (ACTIVE_COMMENT EQUAL 1 AND "${LINE}" MATCHES "\\*/")
 
            endif()
 

	
 
            if (ACTIVE)
 
                if ("${LINE}" MATCHES "^	*[A-Za-z0-9_]* *[,=]")
 
@@ -92,28 +92,28 @@ foreach(ENUM IN LISTS ENUM_LINES)
 
                    unset(SPACES)
 
                    foreach(i RANGE ${LEN})
 
                        string(APPEND SPACES " ")
 
                    endforeach(i)
 
                    endforeach()
 

	
 
                    if (CMAKE_MATCH_3)
 
                        string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}${CMAKE_MATCH_1}${CMAKE_MATCH_2}${SPACES} = ::${CMAKE_MATCH_2},${SPACES}${CMAKE_MATCH_3}")
 
                    else (CMAKE_MATCH_3)
 
                    else()
 
                        string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}${CMAKE_MATCH_1}${CMAKE_MATCH_2}${SPACES} = ::${CMAKE_MATCH_2},")
 
                    endif (CMAKE_MATCH_3)
 
                    endif()
 
                elseif ("${LINE}" STREQUAL "")
 
                    string(APPEND ${PLACE_HOLDER} "\n")
 
                else ()
 
                    string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}${LINE}")
 
                endif ()
 
            endif (ACTIVE)
 
            endif()
 

	
 
            if ("${LINE}" MATCHES "^	*\};")
 
                if (ACTIVE)
 
                    string(APPEND ${PLACE_HOLDER} "\n")
 
                endif (ACTIVE)
 
                endif()
 
                unset(ACTIVE)
 
            endif ("${LINE}" MATCHES "^	*\};")
 
         endforeach(LINE)
 
    endforeach(FILE)
 
 endforeach(ENUM)
 
            endif()
 
         endforeach()
 
    endforeach()
 
 endforeach()
 

	
 
configure_file(${GENERATE_SOURCE_FILE} ${GENERATE_BINARY_FILE})
cmake/scripts/Regression.cmake
Show inline comments
 
@@ -6,10 +6,10 @@ cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT REGRESSION_TEST)
 
    message(FATAL_ERROR "Script needs REGRESSION_TEST defined (tip: use -DREGRESSION_TEST=..)")
 
endif (NOT REGRESSION_TEST)
 
endif()
 
if (NOT OPENTTD_EXECUTABLE)
 
    message(FATAL_ERROR "Script needs OPENTTD_EXECUTABLE defined (tip: use -DOPENTTD_EXECUTABLE=..)")
 
endif (NOT OPENTTD_EXECUTABLE)
 
endif()
 

	
 
if (NOT EXISTS ai/${REGRESSION_TEST}/test.sav)
 
    message(FATAL_ERROR "Regression test ${REGRESSION_TEST} does not exist (tip: check regression folder for the correct spelling)")
 
@@ -23,7 +23,7 @@ if (EDITBIN_EXECUTABLE)
 
    set(OPENTTD_EXECUTABLE "regression/${REGRESSION_TEST}.exe")
 

	
 
    execute_process(COMMAND ${EDITBIN_EXECUTABLE} /nologo /subsystem:console ${OPENTTD_EXECUTABLE})
 
endif (EDITBIN_EXECUTABLE)
 
endif()
 

	
 
# Run the regression test
 
execute_process(COMMAND ${OPENTTD_EXECUTABLE}
 
@@ -42,11 +42,11 @@ execute_process(COMMAND ${OPENTTD_EXECUT
 

	
 
if (REGRESSION_OUTPUT)
 
    message(FATAL_ERROR "Unexpected output: ${REGRESSION_OUTPUT}")
 
endif (REGRESSION_OUTPUT)
 
endif()
 

	
 
if (NOT REGRESSION_RESULT)
 
    message(FATAL_ERROR "Regression did not output anything; did the compilation fail?")
 
endif (NOT REGRESSION_RESULT)
 
endif()
 

	
 
# For some reason pointer can be printed as '0x(nil)', '0x0000000000000000', or '0x0x0'
 
string(REPLACE "0x(nil)" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
 
@@ -80,17 +80,17 @@ foreach(RESULT IN LISTS REGRESSION_RESUL
 
        message("${ARGC}: - ${EXPECTED}")
 
        message("${ARGC}: + ${RESULT}'")
 
        set(ERROR YES)
 
    endif (NOT RESULT STREQUAL EXPECTED)
 
    endif()
 

	
 
    math(EXPR ARGC "${ARGC} + 1")
 
endforeach(RESULT)
 
endforeach()
 

	
 
if (NOT REGRESSION_EXPECTED_LENGTH EQUAL ARGC)
 
    math(EXPR MISSING "${REGRESSION_EXPECTED_LENGTH} - ${ARGC}")
 
    message("(${MISSING} more lines were expected than found)")
 
    set(ERROR YES)
 
endif (NOT REGRESSION_EXPECTED_LENGTH EQUAL ARGC)
 
endif()
 

	
 
if (ERROR)
 
    message(FATAL_ERROR "Regression failed")
 
endif (ERROR)
 
endif()
cmake/scripts/SquirrelExport.cmake
Show inline comments
 
@@ -2,19 +2,19 @@ cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT SCRIPT_API_SOURCE_FILE)
 
    message(FATAL_ERROR "Script needs SCRIPT_API_SOURCE_FILE defined")
 
endif (NOT SCRIPT_API_SOURCE_FILE)
 
endif()
 
if (NOT SCRIPT_API_BINARY_FILE)
 
    message(FATAL_ERROR "Script needs SCRIPT_API_BINARY_FILE defined")
 
endif (NOT SCRIPT_API_BINARY_FILE)
 
endif()
 
if (NOT SCRIPT_API_FILE)
 
    message(FATAL_ERROR "Script needs SCRIPT_API_FILE defined")
 
endif (NOT SCRIPT_API_FILE)
 
endif()
 
if (NOT APIUC)
 
    message(FATAL_ERROR "Script needs APIUC defined")
 
endif (NOT APIUC)
 
endif()
 
if (NOT APILC)
 
    message(FATAL_ERROR "Script needs APILC defined")
 
endif (NOT APILC)
 
endif()
 

	
 
macro(dump_fileheader)
 
    get_filename_component(SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE}" NAME)
 
@@ -22,8 +22,8 @@ macro(dump_fileheader)
 
    if (NOT "${APIUC}" STREQUAL "Template")
 
        string(REPLACE "script_" "template_" SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE_NAME}")
 
        string(APPEND SQUIRREL_EXPORT "\n#include \"../template/${SCRIPT_API_FILE_NAME}.sq\"")
 
    endif (NOT "${APIUC}" STREQUAL "Template")
 
endmacro(dump_fileheader)
 
    endif()
 
endmacro()
 

	
 
macro(dump_class_templates NAME)
 
    string(REGEX REPLACE "^Script" "" REALNAME ${NAME})
 
@@ -48,7 +48,7 @@ macro(dump_class_templates NAME)
 
    else ()
 
        string(APPEND SQUIRREL_EXPORT "\n	template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }")
 
    endif ()
 
endmacro(dump_class_templates)
 
endmacro()
 

	
 
macro(reset_reader)
 
    unset(ENUMS)
 
@@ -63,7 +63,7 @@ macro(reset_reader)
 
    unset(START_SQUIRREL_DEFINE_ON_NEXT_LINE)
 
    set(CLS_LEVEL 0)
 
    unset(CLS_IN_API)
 
endmacro(reset_reader)
 
endmacro()
 

	
 
reset_reader()
 

	
 
@@ -100,15 +100,15 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        # By default, classes are not selected
 
        if (NOT CLS_LEVEL)
 
            set(API_SELECTED FALSE)
 
        endif (NOT CLS_LEVEL)
 
        endif()
 

	
 
        if ("${APIUC}" STREQUAL "Template")
 
            set(API_SELECTED TRUE)
 
            if ("${LINE}" STREQUAL "none" OR "${LINE}" STREQUAL "-all")
 
                set(API_SELECTED FALSE)
 
            endif ("${LINE}" STREQUAL "none" OR "${LINE}" STREQUAL "-all")
 
            endif()
 
            continue()
 
        endif("${APIUC}" STREQUAL "Template")
 
        endif()
 

	
 
        if ("${LINE}" STREQUAL "none" OR "${LINE}" STREQUAL "-all")
 
            set(API_SELECTED FALSE)
 
@@ -118,25 +118,25 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            set(API_SELECTED TRUE)
 
        endif ()
 
        continue()
 
    endif ("${LINE}" MATCHES "^([	 ]*)\\* @api (.*)$")
 
    endif()
 

	
 
    # Remove the old squirrel stuff
 
    if ("${LINE}" MATCHES "#ifdef DEFINE_SQUIRREL_CLASS")
 
        set(SQUIRREL_STUFF TRUE)
 
        continue()
 
    endif ("${LINE}" MATCHES "#ifdef DEFINE_SQUIRREL_CLASS")
 
    endif()
 
    if ("${LINE}" MATCHES "^#endif /\\* DEFINE_SQUIRREL_CLASS \\*/")
 
        unset(SQUIRREL_STUFF)
 
        continue()
 
    endif ("${LINE}" MATCHES "^#endif /\\* DEFINE_SQUIRREL_CLASS \\*/")
 
    endif()
 
    if (SQUIRREL_STUFF)
 
        continue()
 
    endif (SQUIRREL_STUFF)
 
    endif()
 

	
 
    # Ignore forward declarations of classes
 
    if ("${LINE}" MATCHES "^(	*)class(.*);")
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)class(.*);")
 
    endif()
 

	
 
    # We only want to have public functions exported for now
 
    if ("${LINE}" MATCHES "^(	*)class (.*) (: public|: protected|: private|:) ([^ ]*)")
 
@@ -144,7 +144,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            if (NOT DEFINED API_SELECTED)
 
                message(WARNING "Class '${CMAKE_MATCH_2}' has no @api. It won't be published to any API.")
 
                set(API_SELECTED FALSE)
 
            endif (NOT DEFINED API_SELECTED)
 
            endif()
 
            unset(IS_PUBLIC)
 
            unset(CLS_PARAM_0)
 
            set(CLS_PARAM_1 1)
 
@@ -156,54 +156,54 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        elseif (CLS_LEVEL EQUAL 1)
 
            if (NOT DEFINED API_SELECTED)
 
                set(API_SELECTED ${CLS_IN_API})
 
            endif (NOT API_SELECTED)
 
            endif()
 

	
 
            if (API_SELECTED)
 
                list(APPEND STRUCTS "${CLS}::${CMAKE_MATCH_2}")
 
            endif (API_SELECTED)
 
            endif()
 
            unset(API_SELECTED)
 
        endif ()
 
        math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)class (.*) (: public|: protected|: private|:) ([^ ]*)")
 
    endif()
 
    if ("${LINE}" MATCHES "^(	*)public")
 
        if (CLS_LEVEL EQUAL 1)
 
            set(IS_PUBLIC TRUE)
 
        endif (CLS_LEVEL EQUAL 1)
 
        endif()
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)public")
 
    endif()
 
    if ("${LINE}" MATCHES "^(	*)protected")
 
        if (CLS_LEVEL EQUAL 1)
 
            unset(IS_PUBLIC)
 
        endif (CLS_LEVEL EQUAL 1)
 
        endif()
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)protected")
 
    endif()
 
    if ("${LINE}" MATCHES "^(	*)private")
 
        if (CLS_LEVEL EQUAL 1)
 
            unset(IS_PUBLIC)
 
        endif (CLS_LEVEL EQUAL 1)
 
        endif()
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)private")
 
    endif()
 

	
 
    # Ignore the comments
 
    if ("${LINE}" MATCHES "^#")
 
        continue()
 
    endif ("${LINE}" MATCHES "^#")
 
    endif()
 
    if ("${LINE}" MATCHES "/\\*.*\\*/")
 
        unset(COMMENT)
 
        continue()
 
    endif ("${LINE}" MATCHES "/\\*.*\\*/")
 
    endif()
 
    if ("${LINE}" MATCHES "/\\*")
 
        set(COMMENT TRUE)
 
        continue()
 
    endif ("${LINE}" MATCHES "/\\*")
 
    endif()
 
    if ("${LINE}" MATCHES "\\*/")
 
        unset(COMMENT)
 
        continue()
 
    endif ("${LINE}" MATCHES "\\*/")
 
    endif()
 
    if (COMMENT)
 
        continue()
 
    endif (COMMENT)
 
    endif()
 

	
 
    # We need to make specialized conversions for structs
 
    if ("${LINE}" MATCHES "^(	*)struct ([^ ]*)")
 
@@ -212,20 +212,20 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        # Check if we want to publish this struct
 
        if (NOT DEFINED API_SELECTED)
 
            set(API_SELECTED ${CLS_IN_API})
 
        endif (NOT DEFINED API_SELECTED)
 
        endif()
 
        if (NOT API_SELECTED)
 
            unset(API_SELECTED)
 
            continue()
 
        endif (NOT API_SELECTED)
 
        endif()
 
        unset(API_SELECTED)
 

	
 
        if (NOT IS_PUBLIC OR NOT CLS_LEVEL EQUAL 1)
 
            continue()
 
        endif (NOT IS_PUBLIC OR NOT CLS_LEVEL EQUAL 1)
 
        endif()
 

	
 
        list(APPEND STRUCTS "${CLS}::${CMAKE_MATCH_2}")
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)struct ([^ ]*)")
 
    endif()
 

	
 
    # We need to make specialized conversions for enums
 
    if ("${LINE}" MATCHES "^(	*)enum ([^ ]*)")
 
@@ -234,21 +234,21 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        # Check if we want to publish this enum
 
        if (NOT DEFINED API_SELECTED)
 
            set(API_SELECTED ${CLS_IN_API})
 
        endif (NOT DEFINED API_SELECTED)
 
        endif()
 
        if (NOT API_SELECTED)
 
            unset(API_SELECTED)
 
            continue()
 
        endif (NOT API_SELECTED)
 
        endif()
 
        unset(API_SELECTED)
 

	
 
        if (NOT IS_PUBLIC)
 
            continue()
 
        endif (NOT IS_PUBLIC)
 
        endif()
 

	
 
        set(IN_ENUM TRUE)
 
        list(APPEND ENUMS "${CLS}::${CMAKE_MATCH_2}")
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)enum ([^ ]*)")
 
    endif()
 

	
 
    # Maybe the end of the class, if so we can start with the Squirrel export pretty soon
 
    if ("${LINE}" MATCHES "};")
 
@@ -256,29 +256,29 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        if (CLS_LEVEL)
 
            unset(IN_ENUM)
 
            continue()
 
        endif (CLS_LEVEL)
 
        endif()
 

	
 
        if (CLS)
 
            set(START_SQUIRREL_DEFINE_ON_NEXT_LINE TRUE)
 
        endif (CLS)
 
        endif()
 
        continue()
 
    endif ("${LINE}" MATCHES "};")
 
    endif()
 

	
 
    # Empty/white lines. When we may do the Squirrel export, do that export.
 
    if ("${LINE}" MATCHES "^([ 	]*)$")
 
        if (NOT START_SQUIRREL_DEFINE_ON_NEXT_LINE)
 
            continue()
 
        endif (NOT START_SQUIRREL_DEFINE_ON_NEXT_LINE)
 
        endif()
 

	
 
        if (NOT CLS_IN_API)
 
            reset_reader()
 
            continue()
 
        endif (NOT CLS_IN_API)
 
        endif()
 

	
 
        if (NOT HAS_FILEHEADER)
 
            dump_fileheader()
 
            set(HAS_FILEHEADER TRUE)
 
        endif (NOT HAS_FILEHEADER)
 
        endif()
 

	
 
        unset(IS_PUBLIC)
 
        unset(NAMESPACE_OPENED)
 
@@ -294,32 +294,32 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
                if (NOT NAMESPACE_OPENED)
 
                    string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
 
                    set(NAMESPACE_OPENED TRUE)
 
                endif (NOT NAMESPACE_OPENED)
 
                endif()
 
                string(APPEND SQUIRREL_EXPORT "\n	/* Allow enums to be used as Squirrel parameters */")
 
                foreach(ENUM IN LISTS ENUMS)
 
                    string(APPEND SQUIRREL_EXPORT "\n	template <> inline ${ENUM} GetParam(ForceType<${ENUM}>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (${ENUM})tmp; }")
 
                    string(APPEND SQUIRREL_EXPORT "\n	template <> inline int Return<${ENUM}>(HSQUIRRELVM vm, ${ENUM} res) { sq_pushinteger(vm, (int32)res); return 1; }")
 
                endforeach(ENUM)
 
            endif (DEFINED ENUMS)
 
                endforeach()
 
            endif()
 

	
 
            # Then check whether we have structs/classes to print
 
            if (DEFINED STRUCTS)
 
                if (NOT NAMESPACE_OPENED)
 
                    string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
 
                    set(NAMESPACE_OPENED TRUE)
 
                endif (NOT NAMESPACE_OPENED)
 
                endif()
 
                string(APPEND SQUIRREL_EXPORT "\n	/* Allow inner classes/structs to be used as Squirrel parameters */")
 
                foreach(STRUCT IN LISTS STRUCTS)
 
                    dump_class_templates(${STRUCT})
 
                endforeach(STRUCT)
 
            endif (DEFINED STRUCTS)
 
                endforeach()
 
            endif()
 

	
 
            if (NOT NAMESPACE_OPENED)
 
                string(APPEND SQUIRREL_EXPORT "\nnamespace SQConvert {")
 
                set(NAMESPACE_OPENED TRUE)
 
            else (NOT NAMESPACE_OPENED)
 
            else()
 
                string(APPEND SQUIRREL_EXPORT "\n")
 
            endif (NOT NAMESPACE_OPENED)
 
            endif()
 
            string(APPEND SQUIRREL_EXPORT "\n	/* Allow ${CLS} to be used as Squirrel parameter */")
 
            dump_class_templates(${CLS})
 

	
 
@@ -327,7 +327,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
 

	
 
            reset_reader()
 
            continue()
 
        endif ("${APIUC}" STREQUAL "Template")
 
        endif()
 

	
 
        string(APPEND SQUIRREL_EXPORT "\n")
 
        string(APPEND SQUIRREL_EXPORT "\ntemplate <> const char *GetClassName<${CLS}, ST_${APIUC}>() { return \"${API_CLS}\"; }")
 
@@ -339,16 +339,16 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        string(APPEND SQUIRREL_EXPORT "\n	DefSQClass<${CLS}, ST_${APIUC}> SQ${API_CLS}(\"${API_CLS}\");")
 
        if ("${SUPER_CLS}" STREQUAL "Text" OR "${SUPER_CLS}" STREQUAL "ScriptObject" OR "${SUPER_CLS}" STREQUAL "AIAbstractiveList::Valuator")
 
            string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.PreRegister(engine);")
 
        else ("${SUPER_CLS}" STREQUAL "Text" OR "${SUPER_CLS}" STREQUAL "ScriptObject" OR "${SUPER_CLS}" STREQUAL "AIAbstractiveList::Valuator")
 
        else()
 
            string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.PreRegister(engine, \"${API_SUPER_CLS}\");")
 
        endif ("${SUPER_CLS}" STREQUAL "Text" OR "${SUPER_CLS}" STREQUAL "ScriptObject" OR "${SUPER_CLS}" STREQUAL "AIAbstractiveList::Valuator")
 
        endif()
 
        if (NOT "${SUPER_CLS}" STREQUAL "ScriptEvent")
 
            if ("${CLS_PARAM_2}" STREQUAL "v")
 
                string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.AddSQAdvancedConstructor(engine);")
 
            else ("${CLS_PARAM_2}" STREQUAL "v")
 
            else()
 
                string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.AddConstructor<void (${CLS}::*)(${CLS_PARAM_0}), ${CLS_PARAM_1}>(engine, \"${CLS_PARAM_2}\");")
 
            endif ("${CLS_PARAM_2}" STREQUAL "v")
 
        endif (NOT "${SUPER_CLS}" STREQUAL "ScriptEvent")
 
            endif()
 
        endif()
 
        string(APPEND SQUIRREL_EXPORT "\n")
 

	
 
        # Enum values
 
@@ -357,20 +357,20 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            string(LENGTH "${ENUM_VALUE}" LEN)
 
            if (MLEN LESS LEN)
 
                set(MLEN ${LEN})
 
            endif (MLEN LESS LEN)
 
        endforeach(ENUM_VALUE)
 
            endif()
 
        endforeach()
 
        foreach(ENUM_VALUE IN LISTS ENUM_VALUES)
 
            string(LENGTH "${ENUM_VALUE}" LEN)
 
            math(EXPR LEN "${MLEN} - ${LEN}")
 
            unset(SPACES)
 
            foreach(i RANGE ${LEN})
 
                string(APPEND SPACES " ")
 
            endforeach(i)
 
            endforeach()
 
            string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.DefSQConst(engine, ${CLS}::${ENUM_VALUE},${SPACES}\"${ENUM_VALUE}\");")
 
        endforeach(ENUM_VALUE)
 
        endforeach()
 
        if (MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Const values
 
        set(MLEN 0)
 
@@ -378,20 +378,20 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            string(LENGTH "${CONST_VALUE}" LEN)
 
            if (MLEN LESS LEN)
 
                set(MLEN ${LEN})
 
            endif (MLEN LESS LEN)
 
        endforeach(CONST_VALUE)
 
            endif()
 
        endforeach()
 
        foreach(CONST_VALUE IN LISTS CONST_VALUES)
 
            string(LENGTH "${CONST_VALUE}" LEN)
 
            math(EXPR LEN "${MLEN} - ${LEN}")
 
            unset(SPACES)
 
            foreach(i RANGE ${LEN})
 
                string(APPEND SPACES " ")
 
            endforeach(i)
 
            endforeach()
 
            string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.DefSQConst(engine, ${CLS}::${CONST_VALUE},${SPACES}\"${CONST_VALUE}\");")
 
        endforeach(CONST_VALUE)
 
        endforeach()
 
        if (MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Mapping of OTTD strings to errors
 
        set(MLEN 0)
 
@@ -401,8 +401,8 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            string(LENGTH "${ENUM_STRING}" LEN)
 
            if (MLEN LESS LEN)
 
                set(MLEN ${LEN})
 
            endif (MLEN LESS LEN)
 
        endforeach(ENUM_STRING_TO_ERROR)
 
            endif()
 
        endforeach()
 
        foreach(ENUM_STRING_TO_ERROR IN LISTS ENUM_STRING_TO_ERRORS)
 
            string(REPLACE ":" ";" ENUM_STRING_TO_ERROR "${ENUM_STRING_TO_ERROR}")
 
            list(GET ENUM_STRING_TO_ERROR 0 ENUM_STRING)
 
@@ -412,12 +412,12 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            unset(SPACES)
 
            foreach(i RANGE ${LEN})
 
                string(APPEND SPACES " ")
 
            endforeach(i)
 
            endforeach()
 
            string(APPEND SQUIRREL_EXPORT "\n	ScriptError::RegisterErrorMap(${ENUM_STRING},${SPACES}${CLS}::${ENUM_ERROR});")
 
        endforeach(ENUM_STRING_TO_ERROR)
 
        endforeach()
 
        if (MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Mapping of errors to human 'readable' strings.
 
        set(MLEN 0)
 
@@ -425,20 +425,20 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            string(LENGTH "${ENUM_ERROR_TO_STRING}" LEN)
 
            if (MLEN LESS LEN)
 
                set(MLEN ${LEN})
 
            endif (MLEN LESS LEN)
 
        endforeach(ENUM_ERROR_TO_STRING)
 
            endif()
 
        endforeach()
 
        foreach(ENUM_ERROR_TO_STRING IN LISTS ENUM_ERROR_TO_STRINGS)
 
            string(LENGTH "${ENUM_ERROR_TO_STRING}" LEN)
 
            math(EXPR LEN "${MLEN} - ${LEN}")
 
            unset(SPACES)
 
            foreach(i RANGE ${LEN})
 
                string(APPEND SPACES " ")
 
            endforeach(i)
 
            endforeach()
 
            string(APPEND SQUIRREL_EXPORT "\n	ScriptError::RegisterErrorMapString(${CLS}::${ENUM_ERROR_TO_STRING},${SPACES}\"${ENUM_ERROR_TO_STRING}\");")
 
        endforeach(ENUM_ERROR_TO_STRING)
 
        endforeach()
 
        if (MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Static methods
 
        set(MLEN 0)
 
@@ -448,8 +448,8 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            string(LENGTH "${FUNCNAME}" LEN)
 
            if (MLEN LESS LEN)
 
                set(MLEN ${LEN})
 
            endif (MLEN LESS LEN)
 
        endforeach(STATIC_METHOD)
 
            endif()
 
        endforeach()
 
        foreach(STATIC_METHOD IN LISTS STATIC_METHODS)
 
            string(REPLACE ":" ";" STATIC_METHOD "${STATIC_METHOD}")
 
            list(GET STATIC_METHOD 0 FUNCNAME)
 
@@ -460,23 +460,23 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            if ("${TYPES}" STREQUAL "v")
 
                if (LEN GREATER 8)
 
                    math(EXPR LEN "${LEN} - 8")
 
                else (LEN GREATER 8)
 
                else()
 
                    set(LEN 0)
 
                endif (LEN GREATER 8)
 
            endif ("${TYPES}" STREQUAL "v")
 
                endif()
 
            endif()
 
            unset(SPACES)
 
            foreach(i RANGE ${LEN})
 
                string(APPEND SPACES " ")
 
            endforeach(i)
 
            endforeach()
 
            if ("${TYPES}" STREQUAL "v")
 
                string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.DefSQAdvancedStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
 
            else ("${TYPES}" STREQUAL "v")
 
            else()
 
                string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.DefSQStaticMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");")
 
            endif ("${TYPES}" STREQUAL "v")
 
        endforeach(STATIC_METHOD)
 
            endif()
 
        endforeach()
 
        if (MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Non-static methods
 
        set(MLEN 0)
 
@@ -486,8 +486,8 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            string(LENGTH "${FUNCNAME}" LEN)
 
            if (MLEN LESS LEN)
 
                set(MLEN ${LEN})
 
            endif (MLEN LESS LEN)
 
        endforeach(METHOD)
 
            endif()
 
        endforeach()
 
        foreach(METHOD IN LISTS METHODS)
 
            string(REPLACE ":" ";" METHOD "${METHOD}")
 
            list(GET METHOD 0 FUNCNAME)
 
@@ -498,23 +498,23 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            if ("${TYPES}" STREQUAL "v")
 
                if (LEN GREATER 8)
 
                    math(EXPR LEN "${LEN} - 8")
 
                else (LEN GREATER 8)
 
                else()
 
                    set(LEN 0)
 
                endif (LEN GREATER 8)
 
            endif ("${TYPES}" STREQUAL "v")
 
                endif()
 
            endif()
 
            unset(SPACES)
 
            foreach(i RANGE ${LEN})
 
                string(APPEND SPACES " ")
 
            endforeach(i)
 
            endforeach()
 
            if ("${TYPES}" STREQUAL "v")
 
                string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.DefSQAdvancedMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\");")
 
            else ("${TYPES}" STREQUAL "v")
 
            else()
 
                string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.DefSQMethod(engine, &${CLS}::${FUNCNAME},${SPACES}\"${FUNCNAME}\",${SPACES}${ARGC}, \"${TYPES}\");")
 
            endif ("${TYPES}" STREQUAL "v")
 
        endforeach(METHOD)
 
            endif()
 
        endforeach()
 
        if (MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        string(APPEND SQUIRREL_EXPORT "\n	SQ${API_CLS}.PostRegister(engine);")
 
        string(APPEND SQUIRREL_EXPORT "\n}")
 
@@ -522,12 +522,12 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        reset_reader()
 

	
 
        continue()
 
    endif ("${LINE}" MATCHES "^([ 	]*)$")
 
    endif()
 

	
 
    # Skip non-public functions
 
    if (NOT IS_PUBLIC)
 
        continue()
 
    endif (NOT IS_PUBLIC)
 
    endif()
 

	
 
    # Add enums
 
    if (IN_ENUM)
 
@@ -549,37 +549,37 @@ foreach(LINE IN LISTS SOURCE_LINES)
 

	
 
                foreach(MAPPING IN LISTS MAPPINGS)
 
                    list(APPEND ENUM_STRING_TO_ERRORS "${MAPPING}:${ENUM_VALUE}")
 
                endforeach(MAPPING)
 
                endforeach()
 

	
 
                list(APPEND ENUM_ERROR_TO_STRINGS "${ENUM_VALUE}")
 
            endif ("${LINE}" MATCHES "\\[(.*)\\]")
 
        endif ("${ENUM}" MATCHES ".*::ErrorMessages")
 
            endif()
 
        endif()
 
        continue()
 
    endif (IN_ENUM)
 
    endif()
 

	
 
    # Add a const (non-enum) value
 
    if ("${LINE}" MATCHES "^[ 	]*static const [^ ]+ ([^ ]+) = -?\\(?[^ ]*\\)?[^ ]+;")
 
        list(APPEND CONST_VALUES "${CMAKE_MATCH_1}")
 
        continue()
 
    endif ("${LINE}" MATCHES "^[ 	]*static const [^ ]+ ([^ ]+) = -?\\(?[^ ]*\\)?[^ ]+;")
 
    endif()
 

	
 
    # Add a method to the list
 
    if ("${LINE}" MATCHES "^.*\\(.*\\).*$")
 
        if (NOT CLS_LEVEL EQUAL 1)
 
            continue()
 
        endif (NOT CLS_LEVEL EQUAL 1)
 
        endif()
 
        if ("${LINE}" MATCHES "~")
 
            if (DEFINED API_SELECTED)
 
                message(WARNING "Destructor for '${CLS}' has @api. Tag ignored.")
 
                unset(API_SELECTED)
 
            endif (DEFINED API_SELECTED)
 
            endif()
 
            continue()
 
        endif ("${LINE}" MATCHES "~")
 
        endif()
 

	
 
        unset(IS_STATIC)
 
        if ("${LINE}" MATCHES "static")
 
            set(IS_STATIC TRUE)
 
        endif ("${LINE}" MATCHES "static")
 
        endif()
 

	
 
        string(REGEX REPLACE "(virtual|static|const)[ 	]+" "" LINE "${LINE}")
 
        string(REGEX REPLACE "{.*" "" LINE "${LINE}")
 
@@ -597,11 +597,11 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            if (DEFINED API_SELECTED)
 
                message(WARNING "Constructor for '${CLS}' has @api. Tag ignored.")
 
                unset(API_SELECTED)
 
            endif (DEFINED API_SELECTED)
 
            endif()
 
            set(CLS_PARAM_0 "${PARAM_S}")
 
            if (NOT PARAM_S)
 
                continue()
 
            endif (NOT PARAM_S)
 
            endif()
 
        elseif (NOT FUNCNAME)
 
            continue()
 
		endif ()
 
@@ -609,9 +609,9 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        string(REPLACE "," ";" PARAMS "${PARAM_S}")
 
        if (IS_STATIC)
 
            set(TYPES ".")
 
        else (IS_STATIC)
 
        else()
 
            set(TYPES "x")
 
        endif (IS_STATIC)
 
        endif()
 

	
 
        set(LEN 1)
 
        foreach(PARAM IN LISTS PARAMS)
 
@@ -639,16 +639,16 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            else ()
 
                string(APPEND TYPES "i")
 
            endif ()
 
        endforeach(PARAM)
 
        endforeach()
 

	
 
        # Check if we want to publish this function
 
        if (NOT DEFINED API_SELECTED)
 
            set(API_SELECTED ${CLS_IN_API})
 
        endif (NOT DEFINED API_SELECTED)
 
        endif()
 
        if (NOT API_SELECTED)
 
            unset(API_SELECTED)
 
            continue()
 
        endif (NOT API_SELECTED)
 
        endif()
 
        unset(API_SELECTED)
 

	
 
        if ("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME)
 
@@ -661,7 +661,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
            list(APPEND METHODS "${FUNCNAME}:${LEN}:${TYPES}")
 
        endif ()
 
        continue()
 
    endif ("${LINE}" MATCHES "^.*\\(.*\\).*$")
 
endforeach(LINE)
 
    endif()
 
endforeach()
 

	
 
configure_file(${SCRIPT_API_SOURCE_FILE} ${SCRIPT_API_BINARY_FILE})
cmake/scripts/SquirrelIncludes.cmake
Show inline comments
 
@@ -2,16 +2,16 @@ cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT INCLUDES_SOURCE_FILE)
 
    message(FATAL_ERROR "Script needs INCLUDES_SOURCE_FILE defined")
 
endif (NOT INCLUDES_SOURCE_FILE)
 
endif()
 
if (NOT INCLUDES_BINARY_FILE)
 
    message(FATAL_ERROR "Script needs INCLUDES_BINARY_FILE defined")
 
endif (NOT INCLUDES_BINARY_FILE)
 
endif()
 
if (NOT APILC)
 
    message(FATAL_ERROR "Script needs APILC defined")
 
endif (NOT APILC)
 
endif()
 
if (NOT APIUC)
 
    message(FATAL_ERROR "Script needs APIUC defined")
 
endif (NOT APIUC)
 
endif()
 

	
 
set(ARGC 1)
 
set(ARG_READ NO)
 
@@ -23,11 +23,11 @@ while(ARGC LESS CMAKE_ARGC)
 

	
 
    if (ARG_READ)
 
        list(APPEND SCRIPT_API_BINARY_FILES "${ARG}")
 
    endif (ARG_READ)
 
    endif()
 

	
 
    if (ARG STREQUAL "--")
 
        set(ARG_READ YES)
 
    endif (ARG STREQUAL "--")
 
    endif()
 

	
 
    math(EXPR ARGC "${ARGC} + 1")
 
endwhile()
 
@@ -40,13 +40,13 @@ foreach(FILE IN LISTS SCRIPT_API_BINARY_
 
        foreach(LINE IN LISTS LINES)
 
            if ("${LINE}" MATCHES "SQ${APIUC}(List|Controller)_Register")
 
                continue()
 
            endif ("${LINE}" MATCHES "SQ${APIUC}(List|Controller)_Register")
 
            endif()
 
            string(REGEX REPLACE "^.*void " "	" LINE "${LINE}")
 
            string(REGEX REPLACE "Squirrel \\*" "" LINE "${LINE}")
 
            list(APPEND SQUIRREL_REGISTER "${LINE}")
 
        endforeach(LINE)
 
    endif (LINES)
 
endforeach(FILE)
 
        endforeach()
 
    endif()
 
endforeach()
 

	
 
list(SORT SQUIRREL_INCLUDES)
 
string(REPLACE ";" "\n" SQUIRREL_INCLUDES "${SQUIRREL_INCLUDES}")
media/baseset/CMakeLists.txt
Show inline comments
 
@@ -26,7 +26,7 @@ if (GRFCODEC_FOUND)
 

	
 
    list(APPEND BASESET_BINARY_FILES openttd.grf)
 
    list(APPEND BASESET_BINARY_FILES orig_extra.grf)
 
endif (GRFCODEC_FOUND)
 
endif()
 

	
 
set(BASESET_EXTRAGRF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf)
 

	
 
@@ -54,7 +54,7 @@ foreach(BASESET_SOURCE_FILE IN LISTS BAS
 
    )
 

	
 
    list(APPEND BASESET_BINARY_FILES ${BASESET_BINARY_FILE})
 
endforeach(BASESET_SOURCE_FILE)
 
endforeach()
 

	
 
# Walk over all the other baseset files, and generate a command to copy them
 
foreach(BASESET_OTHER_SOURCE_FILE IN LISTS BASESET_OTHER_SOURCE_FILES)
 
@@ -70,7 +70,7 @@ foreach(BASESET_OTHER_SOURCE_FILE IN LIS
 
    )
 

	
 
    list(APPEND BASESET_BINARY_FILES ${BASESET_OTHER_BINARY_FILE})
 
endforeach(BASESET_OTHER_SOURCE_FILE)
 
endforeach()
 

	
 
# Create a new target which generates all baseset metadata files
 
add_custom_target_timestamp(baseset_files
media/baseset/openttd/CMakeLists.txt
Show inline comments
 
@@ -6,4 +6,4 @@
 
if (GRFCODEC_FOUND)
 
    include(CreateGrfCommand)
 
    create_grf_command()
 
endif (GRFCODEC_FOUND)
 
endif()
media/baseset/orig_extra/CMakeLists.txt
Show inline comments
 
@@ -11,4 +11,4 @@ if (GRFCODEC_FOUND)
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/canals.png
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/chars.png
 
    )
 
endif (GRFCODEC_FOUND)
 
endif()
src/CMakeLists.txt
Show inline comments
 
@@ -28,7 +28,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
 
    set_compile_flags(
 
        viewport_sprite_sorter_sse4.cpp
 
        COMPILE_FLAGS -msse4.1)
 
endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
endif()
 

	
 
add_files(
 
    aircraft.h
src/blitter/CMakeLists.txt
Show inline comments
 
@@ -44,7 +44,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
 
        32bpp_anim_sse4.cpp
 
        32bpp_sse4.cpp
 
        COMPILE_FLAGS -msse4.1)
 
endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
endif()
 

	
 
add_files(
 
    base.hpp
src/lang/CMakeLists.txt
Show inline comments
 
@@ -78,7 +78,7 @@ foreach(LANG_SOURCE_FILE IN LISTS LANG_S
 
    )
 

	
 
    list(APPEND LANG_BINARY_FILES ${LANG_BINARY_FILE})
 
endforeach(LANG_SOURCE_FILE)
 
endforeach()
 

	
 
# Create a new target which compiles all language files
 
add_custom_target(language_files
src/music/CMakeLists.txt
Show inline comments
 
@@ -42,7 +42,7 @@ if (NOT OPTION_DEDICATED)
 
        os2_m.h
 
        CONDITION OPTION_OS2
 
    )
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
add_files(
 
    midi.h
src/script/api/CMakeLists.txt
Show inline comments
 
@@ -8,7 +8,7 @@ foreach(ENUM IN LISTS ENUM_LINES)
 
    string(REGEX REPLACE ".* ([^ @]+)@.*" "\\1" FILE_PATTERN "${ENUM}")
 
    file(GLOB FILENAMES "${FILE_PATTERN}")
 
    list(APPEND DEPENDENCIES ${FILENAMES})
 
endforeach(ENUM)
 
endforeach()
 
list(REMOVE_DUPLICATES DEPENDENCIES)
 

	
 
# Add a command to generate script_window.hpp
 
@@ -42,7 +42,7 @@ foreach(API "ai;AI" "game;GS" "template;
 
    foreach(SCRIPT_API_FILE IN LISTS SCRIPT_API_FILES)
 
        if ("${SCRIPT_API_FILE}" MATCHES ".*script_controller.*")
 
            continue()
 
        endif ("${SCRIPT_API_FILE}" MATCHES ".*script_controller.*")
 
        endif()
 
        get_filename_component(SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE}" NAME)
 
        string(REPLACE "script_" "${APILC}_" SCRIPT_API_FILE_NAME "${SCRIPT_API_FILE_NAME}")
 
        set(SCRIPT_API_BINARY_FILE "${CMAKE_BINARY_DIR}/generated/script/api/${APILC}/${SCRIPT_API_FILE_NAME}.sq")
 
@@ -62,7 +62,7 @@ foreach(API "ai;AI" "game;GS" "template;
 
                COMMENT "Generating ${APILC}/${SCRIPT_API_FILE_NAME}.sq"
 
        )
 
        list(APPEND SCRIPT_${APIUC}_BINARY_FILES ${SCRIPT_API_BINARY_FILE})
 
    endforeach(SCRIPT_API_FILE)
 
    endforeach()
 

	
 
    add_custom_target_timestamp(script_${APILC}
 
            DEPENDS
 
@@ -100,11 +100,11 @@ foreach(API "ai;AI" "game;GS" "template;
 
        add_dependencies(script_api
 
                script_${APILC}_includes
 
        )
 
    else (NOT "${APILC}" STREQUAL "template")
 
    else()
 
        add_dependencies(script_api
 
                script_${APILC}
 
        )
 
    endif (NOT "${APILC}" STREQUAL "template")
 
    endif()
 

	
 
    target_include_directories(script_api
 
            INTERFACE
 
@@ -112,7 +112,7 @@ foreach(API "ai;AI" "game;GS" "template;
 
            ${CMAKE_BINARY_DIR}/generated/script/api/${APILC}
 
            ${CMAKE_CURRENT_SOURCE_DIR}/${APILC}
 
    )
 
endforeach(API)
 
endforeach()
 

	
 
add_library(openttd::script_api ALIAS script_api)
 

	
src/sound/CMakeLists.txt
Show inline comments
 
@@ -34,7 +34,7 @@ if (NOT OPTION_DEDICATED)
 
        xaudio2_s.h
 
        CONDITION WIN32 AND XAUDIO2_FOUND
 
    )
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
add_files(
 
    sound_driver.hpp
src/video/CMakeLists.txt
Show inline comments
 
@@ -24,7 +24,7 @@ if (NOT OPTION_DEDICATED)
 
        win32_v.h
 
        CONDITION WIN32
 
    )
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
add_files(
 
    dedicated_v.cpp
0 comments (0 inline, 0 general)