Changeset - r24349:3fa910f6f5ee
CMakeLists.txt
Show inline comments
 
cmake_minimum_required(VERSION 3.5)
 

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

	
 
project(${BINARY_NAME})
 

	
 
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
 
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)
 

	
 
# Use GNUInstallDirs to allow customisation
 
# but set our own default data dir
 
if (NOT CMAKE_INSTALL_DATADIR)
 
if(NOT CMAKE_INSTALL_DATADIR)
 
    set(CMAKE_INSTALL_DATADIR "share/games")
 
endif (NOT CMAKE_INSTALL_DATADIR)
 
endif()
 
include(GNUInstallDirs)
 

	
 
include(Options)
 
set_options()
 
set_directory_options()
 

	
 
@@ -34,86 +34,86 @@ find_package(Threads REQUIRED)
 

	
 
find_package(ZLIB)
 
find_package(LibLZMA)
 
find_package(LZO)
 
find_package(PNG)
 

	
 
if (NOT WIN32)
 
if(NOT WIN32)
 
    find_package(Allegro)
 
    if (NOT APPLE)
 
    if(NOT APPLE)
 
        find_package(SDL2)
 
        if (NOT SDL2_FOUND)
 
        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)
 
if(MSVC)
 
    find_package(Editbin REQUIRED)
 
endif (MSVC)
 
endif()
 

	
 
find_package(SSE)
 
find_package(Xaudio2)
 

	
 
find_package(Grfcodec)
 

	
 
# IPO is only properly supported from CMake 3.9. Despite the fact we are
 
# CMake 3.5, still enable IPO if we detect we are 3.9+.
 
if (POLICY CMP0069)
 
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)
 
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)
 
if (APPLE)
 
    if (NOT AUDIOTOOLBOX_LIBRARY)
 
    endif()
 
endif()
 
if(APPLE)
 
    if(NOT AUDIOTOOLBOX_LIBRARY)
 
        message(FATAL_ERROR "AudioToolbox is required for this platform")
 
    endif (NOT AUDIOTOOLBOX_LIBRARY)
 
    if (NOT AUDIOUNIT_LIBRARY)
 
    endif()
 
    if(NOT AUDIOUNIT_LIBRARY)
 
        message(FATAL_ERROR "AudioUnit is required for this platform")
 
    endif (NOT AUDIOUNIT_LIBRARY)
 
    if (NOT COCOA_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)
 
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)
 

	
 
set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
 

	
 
list(APPEND GENERATED_SOURCE_FILES "${CMAKE_BINARY_DIR}/generated/rev.cpp")
 
if (WIN32)
 
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
 
        ${CMAKE_COMMAND}
 
                -DFIND_VERSION_BINARY_DIR=${CMAKE_BINARY_DIR}/generated
 
                -DCPACK_BINARY_DIR=${CMAKE_BINARY_DIR}
 
@@ -152,97 +152,97 @@ target_link_libraries(openttd
 
    openttd::settings
 
    openttd::basesets
 
    openttd::script_api
 
    Threads::Threads
 
)
 

	
 
if (IPO_FOUND)
 
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)
 
if(APPLE OR UNIX)
 
    add_definitions(-DUNIX)
 
endif (APPLE OR UNIX)
 
endif()
 

	
 
include(LinkPackage)
 
link_package(PNG TARGET PNG::PNG ENCOURAGED)
 
link_package(ZLIB TARGET ZLIB::ZLIB ENCOURAGED)
 
link_package(LIBLZMA TARGET LibLZMA::LibLZMA ENCOURAGED)
 
link_package(LZO ENCOURAGED)
 
link_package(XDG_basedir)
 

	
 
if (NOT OPTION_DEDICATED)
 
if(NOT OPTION_DEDICATED)
 
    link_package(Fluidsynth)
 
    link_package(SDL)
 
    link_package(SDL2 TARGET SDL2::SDL2)
 
    link_package(Allegro)
 
    link_package(FREETYPE TARGET Freetype::Freetype)
 
    link_package(Fontconfig TARGET Fontconfig::Fontconfig)
 
    link_package(ICU_lx)
 
    link_package(ICU_i18n)
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
if (APPLE)
 
if(APPLE)
 
    link_package(Iconv TARGET Iconv::Iconv)
 

	
 
    target_link_libraries(openttd
 
        ${AUDIOTOOLBOX_LIBRARY}
 
        ${AUDIOUNIT_LIBRARY}
 
        ${COCOA_LIBRARY}
 
    )
 

	
 
    add_definitions(
 
        -DWITH_COCOA
 
        -DENABLE_COCOA_QUARTZ
 
    )
 
endif (APPLE)
 
endif()
 

	
 
if (NOT PERSONAL_DIR STREQUAL "(not set)")
 
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)")
 
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)")
 
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)
 

	
 
add_definitions_based_on_options()
 

	
 
if (WIN32)
 
if(WIN32)
 
    add_definitions(
 
        -DUNICODE
 
        -D_UNICODE
 
        -DWITH_UNISCRIBE
 
    )
 

	
 
    target_link_libraries(openttd
 
        ws2_32
 
        winmm
 
        imm32
 
    )
 
endif (WIN32)
 
endif()
 

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

	
 
include(CreateRegression)
 
create_regression()
 

	
 
include(InstallAndPackage)
cmake/AddCustomXXXTimestamp.cmake
Show inline comments
 
@@ -6,41 +6,41 @@ macro(_parse_arguments_with_multi_hack O
 
    # the wrapped command with _reassemble_command_line().
 

	
 
    set(COMMAND_LINE "${ORIGINAL_COMMAND_LINE}")
 

	
 
    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()
 

	
 
macro(_reassemble_command_line)
 
    # Reassemble the command line as we original got it.
 
    set(NEW_COMMAND_LINE ${PARAM_UNPARSED_ARGUMENTS})
 

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

	
 
    foreach(SINGLE IN LISTS SINGLES)
 
        if (PARAM_${SINGLE})
 
        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})
 
        if(PARAM_${MULTI})
 
            # Replace our special marker with the name of the MULTI again. This
 
            # 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
 
# regenerations. This function replaces each file in OUTPUT with a .timestamp
 
# file, adds a command to touch it and move the original file in BYPRODUCTS,
 
# before calling add_custom_command().
 
@@ -69,15 +69,15 @@ function(add_custom_command_timestamp)
 
    # Create a list of all the OUTPUTs (by removing our magic marker)
 
    string(REPLACE ":::;" "" OUTPUTS "${PARAM_OUTPUT}")
 

	
 
    # Reset the OUTPUT and BYPRODUCTS as an empty list (if needed).
 
    # Because they are MULTIS, we need to add our special marker here.
 
    set(PARAM_OUTPUT ":::")
 
    if (NOT PARAM_BYPRODUCTS)
 
    if(NOT PARAM_BYPRODUCTS)
 
        set(PARAM_BYPRODUCTS ":::")
 
    endif ()
 
    endif()
 

	
 
    foreach(OUTPUT IN LISTS OUTPUTS)
 
        # For every output, we add a 'cmake -E touch' entry to update the
 
        # timestamp on each run.
 
        get_filename_component(OUTPUT_FILENAME ${OUTPUT} NAME)
 
        string(APPEND PARAM_COMMAND ";:::;${CMAKE_COMMAND};-E;touch;${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILENAME}.timestamp")
 
@@ -88,18 +88,18 @@ function(add_custom_command_timestamp)
 
        list(APPEND PARAM_BYPRODUCTS ${OUTPUT})
 

	
 
        # Mark this file as being a byproduct; we use this again with
 
        # 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
 
# replaced by add_custom_command_timestamp(), before calling add_custom_target().
 
#
 
# add_custom_target_timestamp(Name [ALL] [command1 [args1...]]
 
@@ -127,19 +127,19 @@ function(add_custom_target_timestamp)
 
    set(PARAM_DEPENDS ":::")
 

	
 
    foreach(DEPEND IN LISTS DEPENDS)
 
        # Check if the output is produced by add_custom_command_timestamp()
 
        get_source_file_property(BYPRODUCT ${DEPEND} BYPRODUCT)
 

	
 
        if (BYPRODUCT STREQUAL "NOTFOUND")
 
        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
 
# Macro which contains all bits to setup the compile flags correctly.
 
#
 
# compile_flags()
 
#
 
macro(compile_flags)
 
    if (MSVC)
 
    if(MSVC)
 
        # Switch to MT (static) instead of MD (dynamic) binary
 

	
 
        # For MSVC two generators are available
 
        # - a command line generator (Ninja) using CMAKE_BUILD_TYPE to specify the
 
        #   configuration of the build tree
 
        # - an IDE generator (Visual Studio) using CMAKE_CONFIGURATION_TYPES to
 
@@ -20,40 +20,40 @@ macro(compile_flags)
 
        endforeach()
 

	
 
        # "If /Zc:rvalueCast is specified, the compiler follows section 5.4 of the
 
        # C++11 standard". We need C++11 for the way we use threads.
 
        add_compile_options(/Zc:rvalueCast)
 

	
 
        if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 
        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.
 
    add_compile_options(
 
        "$<$<CONFIG:Debug>:-D_DEBUG>"
 
        "$<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>" # FORTIFY_SOURCE should only be used in non-debug builds (requires -O1+)
 
    )
 
    if (MINGW)
 
    if(MINGW)
 
        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.
 
    set(IS_STABLE_RELEASE "$<AND:$<NOT:$<CONFIG:Debug>>,$<NOT:$<BOOL:${OPTION_USE_ASSERTS}>>>")
 

	
 
    if (MSVC)
 
    if(MSVC)
 
        add_compile_options(/W3)
 
    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
    elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
        add_compile_options(
 
            -W
 
            -Wall
 
            -Wcast-qual
 
            -Wextra
 
            -Wsign-compare
 
@@ -78,39 +78,39 @@ macro(compile_flags)
 
            -fno-strict-aliasing
 
        )
 

	
 
        # When we are a stable release (Release build + USE_ASSERTS not set),
 
        # assertations are off, which trigger a lot of warnings. We disable
 
        # these warnings for these releases.
 
        if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
        if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
            add_compile_options(
 
                "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
 
                "$<${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
 
        # non-coloured output. We can override this to get nicely
 
        # coloured output, but since that might yield odd results with
 
        # IDEs, we extract it to an option.
 
        if (OPTION_FORCE_COLORED_OUTPUT)
 
            if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
 
        if(OPTION_FORCE_COLORED_OUTPUT)
 
            if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
 
                add_compile_options (-fdiagnostics-color=always)
 
            elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
            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")
 
        if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
            include(CheckCXXCompilerFlag)
 
            check_cxx_compiler_flag("-flifetime-dse=1" LIFETIME_DSE_FOUND)
 

	
 
            add_compile_options(
 
                # GCC 4.2+ automatically assumes that signed overflows do
 
                # not occur in signed arithmetics, whereas we are not
 
@@ -123,28 +123,28 @@ macro(compile_flags)
 
                "-fno-tree-vrp"
 

	
 
                # -flifetime-dse=2 (default since GCC 6) doesn't play
 
                # well with our custom pool item allocator
 
                "$<$<BOOL:${LIFETIME_DSE_FOUND}>:-flifetime-dse=1>"
 
            )
 
        endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 
    elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
 
        endif()
 
    elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
 
        add_compile_options(
 
            -Wall
 
            # warning #873: function ... ::operator new ... has no corresponding operator delete ...
 
            -wd873
 
            # warning #1292: unknown attribute "fallthrough"
 
            -wd1292
 
            # warning #1899: multicharacter character literal (potential portability problem)
 
            -wd1899
 
            # warning #2160: anonymous union qualifier is ignored
 
            -wd2160
 
        )
 
    else ()
 
    else()
 
        message(FATAL_ERROR "No warning flags are set for this compiler yet; please consider creating a Pull Request to add support for this compiler.")
 
    endif ()
 
    endif()
 

	
 
    if (NOT WIN32)
 
    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
 
@@ -23,13 +23,13 @@ function(create_grf_command)
 
                        ${GRF_PNG_BINARY_FILE}
 
                MAIN_DEPENDENCY ${GRF_PNG_SOURCE_FILE}
 
                COMMENT "Copying ${GRF_PNG_SOURCE_FILE_NAME} sprite file"
 
        )
 

	
 
        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}
 
                    -DGRF_SOURCE_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}
 
                    -DGRF_BINARY_FILE=${GRF_BINARY_FILE}
 
                    -DNFORENUM_EXECUTABLE=${NFORENUM_EXECUTABLE}
cmake/CreateRegression.cmake
Show inline comments
 
@@ -10,26 +10,26 @@ macro(create_regression)
 
    # build folder before we can run the regression
 
    file(GLOB_RECURSE REGRESSION_SOURCE_FILES ${CMAKE_SOURCE_DIR}/regression/*)
 
    foreach(REGRESSION_SOURCE_FILE IN LISTS REGRESSION_SOURCE_FILES)
 
        string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/regression/" "${CMAKE_BINARY_DIR}/ai/" REGRESSION_BINARY_FILE "${REGRESSION_SOURCE_FILE}")
 
        string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}")
 

	
 
        if ("${REGRESSION_SOURCE_FILE_NAME}" STREQUAL "regression.cfg")
 
        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
 
                        ${REGRESSION_SOURCE_FILE}
 
                        ${REGRESSION_BINARY_FILE}
 
                MAIN_DEPENDENCY ${REGRESSION_SOURCE_FILE}
 
                COMMENT "Copying ${REGRESSION_SOURCE_FILE_NAME} regression file"
 
        )
 

	
 
        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.
 
    add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/regression/regression.cfg
 
            COMMAND ${CMAKE_COMMAND} -E copy
 
                    ${CMAKE_SOURCE_DIR}/regression/regression.cfg
 
@@ -50,15 +50,15 @@ macro(create_regression)
 

	
 
    # Find all the tests we have, and create a target for them
 
    file(GLOB REGRESSION_TESTS ${CMAKE_SOURCE_DIR}/regression/*)
 
    foreach(REGRESSION_TEST IN LISTS REGRESSION_TESTS)
 
        get_filename_component(REGRESSION_TEST_NAME "${REGRESSION_TEST}" NAME)
 

	
 
        if ("${REGRESSION_TEST_NAME}" STREQUAL "regression.cfg")
 
        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}
 
                        -DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
 
                        -DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
 
                        -DREGRESSION_TEST=${REGRESSION_TEST_NAME}
 
@@ -75,12 +75,12 @@ macro(create_regression)
 
                        -DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
 
                        -DREGRESSION_TEST=${REGRESSION_TEST_NAME}
 
                        -P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
 
                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
 
            DEPENDS ${REGRESSION_TARGETS})
 
endmacro()
cmake/Endian.cmake
Show inline comments
 
@@ -3,12 +3,12 @@
 
# add_endian_definition()
 
#
 
function(add_endian_definition)
 
    include(TestBigEndian)
 
    TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
 

	
 
    if (IS_BIG_ENDIAN)
 
    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/FindAllegro.cmake
Show inline comments
 
@@ -51,15 +51,15 @@ find_package_handle_standard_args(Allegr
 
    REQUIRED_VARS
 
        Allegro_LIBRARY
 
        Allegro_INCLUDE_DIR
 
    VERSION_VAR Allegro_VERSION
 
)
 

	
 
if (Allegro_FOUND)
 
if(Allegro_FOUND)
 
    set(Allegro_LIBRARIES ${Allegro_LIBRARY})
 
    set(Allegro_INCLUDE_DIRS ${Allegro_INCLUDE_DIR})
 
endif ()
 
endif()
 

	
 
mark_as_advanced(
 
    Allegro_INCLUDE_DIR
 
    Allegro_LIBRARY
 
)
cmake/FindEditbin.cmake
Show inline comments
 
# Autodetect editbin. Only useful for MSVC.
 

	
 
if (NOT EDITBIN_DIRECTORY)
 
    if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 
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(
 
    EDITBIN_EXECUTABLE editbin.exe
 
    HINTS ${EDITBIN_DIRECTORY}
 
)
 

	
 
if (EDITBIN_EXECUTABLE)
 
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
 
    FOUND_VAR EDITBIN_FOUND
 
    REQUIRED_VARS EDITBIN_EXECUTABLE
 
)
cmake/FindFluidsynth.cmake
Show inline comments
 
@@ -51,15 +51,15 @@ find_package_handle_standard_args(Fluids
 
    REQUIRED_VARS
 
        Fluidsynth_LIBRARY
 
        Fluidsynth_INCLUDE_DIR
 
    VERSION_VAR Fluidsynth_VERSION
 
)
 

	
 
if (Fluidsynth_FOUND)
 
if(Fluidsynth_FOUND)
 
    set(Fluidsynth_LIBRARIES ${Fluidsynth_LIBRARY})
 
    set(Fluidsynth_INCLUDE_DIRS ${Fluidsynth_INCLUDE_DIR})
 
endif ()
 
endif()
 

	
 
mark_as_advanced(
 
    Fluidsynth_INCLUDE_DIR
 
    Fluidsynth_LIBRARY
 
)
cmake/FindFontconfig.cmake
Show inline comments
 
@@ -52,13 +52,13 @@ find_library( Fontconfig_LIBRARY
 
  NAMES
 
    fontconfig
 
  PATHS
 
    ${PKG_FONTCONFIG_LIBRARY_DIRS}
 
)
 

	
 
if (Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
 
if(Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
 
  file(STRINGS ${Fontconfig_INCLUDE_DIR}/fontconfig/fontconfig.h _contents REGEX "^#define[ \t]+FC_[A-Z]+[ \t]+[0-9]+$")
 
  unset(Fontconfig_VERSION)
 
  foreach(VPART MAJOR MINOR REVISION)
 
    foreach(VLINE ${_contents})
 
      if(VLINE MATCHES "^#define[\t ]+FC_${VPART}[\t ]+([0-9]+)$")
 
        set(Fontconfig_VERSION_PART "${CMAKE_MATCH_1}")
 
@@ -67,13 +67,13 @@ if (Fontconfig_INCLUDE_DIR AND NOT Fontc
 
        else()
 
          set(Fontconfig_VERSION "${Fontconfig_VERSION_PART}")
 
        endif()
 
      endif()
 
    endforeach()
 
  endforeach()
 
endif ()
 
endif()
 

	
 
include(FindPackageHandleStandardArgs)
 
find_package_handle_standard_args(Fontconfig
 
  FOUND_VAR
 
    Fontconfig_FOUND
 
  REQUIRED_VARS
cmake/FindICU.cmake
Show inline comments
 
@@ -26,30 +26,30 @@ This will define the following variables
 

	
 
find_package(PkgConfig QUIET)
 

	
 
set(ICU_KNOWN_COMPONENTS "uc" "i18n" "le" "lx" "io")
 

	
 
foreach(MOD_NAME IN LISTS ICU_FIND_COMPONENTS)
 
    if (NOT MOD_NAME IN_LIST ICU_KNOWN_COMPONENTS)
 
    if(NOT MOD_NAME IN_LIST ICU_KNOWN_COMPONENTS)
 
        message(FATAL_ERROR "Unknown ICU component: ${MOD_NAME}")
 
    endif()
 
    pkg_check_modules(PC_ICU_${MOD_NAME} QUIET icu-${MOD_NAME})
 

	
 
    # Check the libraries returned by pkg-config really exist.
 
    unset(PC_LIBRARIES)
 
    foreach(LIBRARY IN LISTS PC_ICU_${MOD_NAME}_LIBRARIES)
 
        unset(PC_LIBRARY CACHE)
 
        find_library(PC_LIBRARY NAMES ${LIBRARY})
 
        if (NOT PC_LIBRARY)
 
        if(NOT PC_LIBRARY)
 
            unset(PC_ICU_${MOD_NAME}_FOUND)
 
        endif()
 
        list(APPEND PC_LIBRARIES ${PC_LIBRARY})
 
    endforeach()
 
    unset(PC_LIBRARY CACHE)
 

	
 
    if (${PC_ICU_${MOD_NAME}_FOUND})
 
    if(${PC_ICU_${MOD_NAME}_FOUND})
 
        set(ICU_COMPONENT_FOUND TRUE)
 
        set(ICU_${MOD_NAME}_FOUND TRUE)
 
        set(ICU_${MOD_NAME}_LIBRARIES ${PC_LIBRARIES})
 
        set(ICU_${MOD_NAME}_INCLUDE_DIRS ${PC_ICU_${MOD_NAME}_INCLUDE_DIRS})
 
        set(ICU_VERSION ${PC_ICU_${MOD_NAME}_VERSION})
 
    endif()
cmake/FindLZO.cmake
Show inline comments
 
@@ -52,14 +52,14 @@ find_library(LZO_LIBRARY
 
# with Windows.
 
#
 
# NOTE: this is based on the assumption that the debug file has the same
 
# name as the optimized file. This is not always the case, but so far
 
# experiences has shown that in those case vcpkg CMake files do the right
 
# thing.
 
if (VCPKG_TOOLCHAIN AND LZO_LIBRARY)
 
    if (LZO_LIBRARY MATCHES "/debug/")
 
if(VCPKG_TOOLCHAIN AND LZO_LIBRARY)
 
    if(LZO_LIBRARY MATCHES "/debug/")
 
        set(LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
 
        string(REPLACE "/debug/lib/" "/lib/" LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
 
    else()
 
        set(LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
 
        string(REPLACE "/lib/" "/debug/lib/" LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
 
    endif()
 
@@ -75,15 +75,15 @@ find_package_handle_standard_args(LZO
 
    REQUIRED_VARS
 
        LZO_LIBRARY
 
        LZO_INCLUDE_DIR
 
    VERSION_VAR LZO_VERSION
 
)
 

	
 
if (LZO_FOUND)
 
if(LZO_FOUND)
 
    set(LZO_LIBRARIES ${LZO_LIBRARY})
 
    set(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})
 
endif ()
 
endif()
 

	
 
mark_as_advanced(
 
    LZO_INCLUDE_DIR
 
    LZO_LIBRARY
 
)
cmake/FindSSE.cmake
Show inline comments
 
# Autodetect if SSE4.1 can be used. If so, the assumption is, so can the other
 
# SSE version (SSE 2.0, SSSE 3.0).
 

	
 
include(CheckCXXSourceCompiles)
 
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")
 
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>
 
    #include <smmintrin.h>
 
    #include <tmmintrin.h>
 
    int main() { return 0; }"
cmake/FindXDG_basedir.cmake
Show inline comments
 
@@ -51,15 +51,15 @@ find_package_handle_standard_args(XDG_ba
 
    REQUIRED_VARS
 
        XDG_basedir_LIBRARY
 
        XDG_basedir_INCLUDE_DIR
 
    VERSION_VAR XDG_basedir_VERSION
 
)
 

	
 
if (XDG_basedir_FOUND)
 
if(XDG_basedir_FOUND)
 
    set(XDG_basedir_LIBRARIES ${XDG_basedir_LIBRARY})
 
    set(XDG_basedir_INCLUDE_DIRS ${XDG_basedir_INCLUDE_DIR})
 
endif ()
 
endif()
 

	
 
mark_as_advanced(
 
    XDG_basedir_INCLUDE_DIR
 
    XDG_basedir_LIBRARY
 
)
cmake/InstallAndPackage.cmake
Show inline comments
 
include(GNUInstallDirs)
 

	
 
# If requested, use FHS layout; otherwise fall back to a flat layout.
 
if (OPTION_INSTALL_FHS)
 
if(OPTION_INSTALL_FHS)
 
    set(BINARY_DESTINATION_DIR "${CMAKE_INSTALL_BINDIR}")
 
    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
 
            DESTINATION ${BINARY_DESTINATION_DIR}
 
            COMPONENT Runtime
 
        )
 
@@ -36,45 +36,45 @@ install(FILES
 
                ${CMAKE_SOURCE_DIR}/known-bugs.txt
 
        DESTINATION ${DOCS_DESTINATION_DIR}
 
        COMPONENT docs)
 

	
 
# A Linux manual only makes sense when using FHS. Otherwise it is a very odd
 
# file with little context to what it is.
 
if (OPTION_INSTALL_FHS)
 
if(OPTION_INSTALL_FHS)
 
    set(MAN_SOURCE_FILE ${CMAKE_SOURCE_DIR}/docs/openttd.6)
 
    set(MAN_BINARY_FILE ${CMAKE_BINARY_DIR}/docs/${BINARY_NAME}.6)
 
    install(CODE
 
            "
 
                execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${MAN_SOURCE_FILE} ${MAN_BINARY_FILE})
 
                execute_process(COMMAND gzip -9 -f ${MAN_BINARY_FILE})
 
            "
 
            COMPONENT manual)
 
    install(FILES
 
                    ${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")
 
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)
 
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}")
 

	
 
set(CPACK_PACKAGE_NAME "openttd")
 
set(CPACK_PACKAGE_VENDOR "OpenTTD")
 
set(CPACK_PACKAGE_DESCRIPTION "OpenTTD")
 
@@ -87,36 +87,36 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE
 
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
 
set(CPACK_MONOLITHIC_INSTALL YES)
 
set(CPACK_PACKAGE_EXECUTABLES "openttd;OpenTTD")
 
set(CPACK_STRIP_FILES YES)
 
set(CPACK_OUTPUT_FILE_PREFIX "bundles")
 

	
 
if (APPLE)
 
if(APPLE)
 
    set(CPACK_GENERATOR "Bundle")
 
    include(PackageBundle)
 

	
 
    set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-macosx")
 
elseif (WIN32)
 
elseif(WIN32)
 
    set(CPACK_GENERATOR "ZIP")
 
    if (OPTION_USE_NSIS)
 
    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)
 
elseif(UNIX)
 
    # With FHS, we can create deb/rpm/... Without it, they would be horribly broken
 
    # and not work. The other way around is also true; with FHS they are not
 
    # usable, and only flat formats work.
 
    if (OPTION_INSTALL_FHS)
 
    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 ()
 
else()
 
    message(FATAL_ERROR "Unknown OS found for packaging; please consider creating a Pull Request to add support for this OS.")
 
endif ()
 
endif()
 

	
 
include(CPack)
cmake/LinkPackage.cmake
Show inline comments
 
function(link_package NAME)
 
    cmake_parse_arguments(LP "ENCOURAGED" "TARGET" "" ${ARGN})
 

	
 
    if (${NAME}_FOUND)
 
    if(${NAME}_FOUND)
 
        string(TOUPPER "${NAME}" UCNAME)
 
        add_definitions(-DWITH_${UCNAME})
 
        if (LP_TARGET AND TARGET ${LP_TARGET})
 
        if(LP_TARGET AND TARGET ${LP_TARGET})
 
            target_link_libraries(openttd ${LP_TARGET})
 
            message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${LP_TARGET}")
 
        else()
 
            include_directories(${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR})
 
            target_link_libraries(openttd ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY})
 
            message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR} -- ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY}")
 
        endif()
 
    elseif (LP_ENCOURAGED)
 
    elseif(LP_ENCOURAGED)
 
        message(WARNING "${NAME} not found; compiling OpenTTD without ${NAME} is strongly disencouraged")
 
    endif()
 
endfunction()
cmake/Options.cmake
Show inline comments
 
@@ -2,54 +2,54 @@ include(GNUInstallDirs)
 

	
 
# Set the options for the directories (personal, shared, global).
 
#
 
# set_directory_options()
 
#
 
function(set_directory_options)
 
    if (APPLE)
 
    if(APPLE)
 
        set(DEFAULT_PERSONAL_DIR "Documents/OpenTTD")
 
        set(DEFAULT_SHARED_DIR "/Library/Application Support/OpenTTD")
 
        set(DEFAULT_GLOBAL_DIR "(not set)")
 
    elseif (WIN32)
 
    elseif(WIN32)
 
        set(DEFAULT_PERSONAL_DIR "OpenTTD")
 
        set(DEFAULT_SHARED_DIR "(not set)")
 
        set(DEFAULT_GLOBAL_DIR "(not set)")
 
    elseif (UNIX)
 
    elseif(UNIX)
 
        set(DEFAULT_PERSONAL_DIR ".${BINARY_NAME}")
 
        set(DEFAULT_SHARED_DIR "(not set)")
 
        set(DEFAULT_GLOBAL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${BINARY_NAME}")
 
    else ()
 
    else()
 
        message(FATAL_ERROR "Unknown OS found; please consider creating a Pull Request to add support for this OS.")
 
    endif ()
 
    endif()
 

	
 
    if (NOT PERSONAL_DIR)
 
    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)
 
    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)
 
    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.
 
#
 
# set_options()
 
#
 
function(set_options)
 
    if (UNIX AND NOT APPLE)
 
    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)
 

	
 
    option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF)
 
    option(OPTION_INSTALL_FHS "Install with Filesystem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS})
 
    option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" ON)
 
@@ -71,20 +71,20 @@ endfunction()
 

	
 
# Add the definitions for the options that are selected.
 
#
 
# add_definitions_based_on_options()
 
#
 
function(add_definitions_based_on_options)
 
    if (OPTION_DEDICATED)
 
    if(OPTION_DEDICATED)
 
        add_definitions(-DDEDICATED)
 
    endif (OPTION_DEDICATED)
 
    endif()
 

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

	
 
    if (OPTION_USE_ASSERTS)
 
    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
 
@@ -7,22 +7,22 @@
 
# For example: ADD_IF SDL_FOUND AND Allegro_FOUND
 
#
 
function(add_files)
 
    cmake_parse_arguments(PARAM "" "" "CONDITION" ${ARGN})
 
    set(PARAM_FILES "${PARAM_UNPARSED_ARGUMENTS}")
 

	
 
    if (PARAM_CONDITION)
 
        if (NOT (${PARAM_CONDITION}))
 
    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
 
# to set properties for the source file on a more global level. To solve this,
 
# this function records the flags you want, and a macro adds them in the root
 
# CMakeLists.txt.
 
@@ -39,13 +39,13 @@ function(set_compile_flags)
 

	
 
    foreach(FILE IN LISTS PARAM_FILES)
 
        list(APPEND SOURCE_PROPERTIES "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}::${PARAM_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
 
# correctly.
 
#
 
# process_compile_flags()
 
@@ -57,7 +57,7 @@ function(process_compile_flags)
 
        string(REPLACE "::" ";" ENTRY "${ENTRY}")
 
        list(GET ENTRY 0 FILE)
 
        list(GET ENTRY 1 PROPERTIES)
 

	
 
        set_source_files_properties(${FILE} PROPERTIES COMPILE_FLAGS ${PROPERTIES})
 
    endforeach()
 
endfunction(process_compile_flags)
 
endfunction()
cmake/Static.cmake
Show inline comments
 
# Set static linking if the platform requires it.
 
#
 
# set_static()
 
#
 
function(set_static_if_needed)
 
     if (MINGW)
 
     if(MINGW)
 
        # Let exectutables run outside MinGW environment
 
        # Force searching static libs
 
        set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" PARENT_SCOPE)
 

	
 
        # Force static linking
 
        link_libraries(-static -static-libgcc -static-libstdc++)
cmake/scripts/Baseset.cmake
Show inline comments
 
@@ -9,19 +9,19 @@ set(ARG_READ NO)
 

	
 
# Read all the arguments given to CMake; we are looking for -- and everything
 
# that follows. Those are our language files.
 
while(ARGC LESS CMAKE_ARGC)
 
    set(ARG ${CMAKE_ARGV${ARGC}})
 

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

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

	
 
    math(EXPR ARGC "${ARGC} + 1")
 
endwhile()
 

	
 
# Place holder format is @<ini_key>_<str_id>@
 
file(STRINGS "${BASESET_SOURCE_FILE}" PLACE_HOLDER REGEX "^@")
 
@@ -30,23 +30,23 @@ string(REGEX REPLACE "@[^_]+_(.*)@" "\\1
 
string(REGEX REPLACE "@(.*)@" "\\1" PLACE_HOLDER "${PLACE_HOLDER}")
 

	
 
# Get the translations
 
foreach(LANGFILE IN LISTS LANG_SOURCE_FILES)
 
    file(STRINGS "${LANGFILE}" LANGLINES REGEX "^(##isocode|${STR_ID})" ENCODING UTF-8)
 
    string(FIND "${LANGLINES}" "${STR_ID}" HAS_STR_ID)
 
    if (HAS_STR_ID LESS 0)
 
    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")
 
    if("${ISOCODE}" STREQUAL "en_GB")
 
        string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}       = \\1" LANGLINES "${LANGLINES}")
 
    else()
 
        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}}")
 

	
 
# Get the grf md5
 
file(MD5 ${BASESET_EXTRAGRF_FILE} ORIG_EXTRA_GRF_MD5)
 

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

	
 
#
 
# Create a single GRF file based on sprites/<grfname>.nfo and sprites/*.png
 
# files.
 
#
 

	
 
if (NOT NFORENUM_EXECUTABLE)
 
if(NOT NFORENUM_EXECUTABLE)
 
    message(FATAL_ERROR "Script needs NFORENUM_EXECUTABLE defined")
 
endif (NOT NFORENUM_EXECUTABLE)
 
if (NOT GRFCODEC_EXECUTABLE)
 
endif()
 
if(NOT GRFCODEC_EXECUTABLE)
 
    message(FATAL_ERROR "Script needs GRFCODEC_EXECUTABLE defined")
 
endif (NOT GRFCODEC_EXECUTABLE)
 
if (NOT GRF_SOURCE_FOLDER)
 
endif()
 
if(NOT GRF_SOURCE_FOLDER)
 
    message(FATAL_ERROR "Script needs GRF_SOURCE_FOLDER defined")
 
endif (NOT GRF_SOURCE_FOLDER)
 
if (NOT GRF_BINARY_FILE)
 
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)
 

	
 
file(WRITE sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "")
 
file(READ ${GRF_SOURCE_FOLDER}/${GRF_SOURCE_FOLDER_NAME}.nfo NFO_LINES)
 
# Replace ; with \;, and make a list out of this based on \n
 
@@ -27,18 +27,18 @@ string(REPLACE ";" "\\;" NFO_LINES "${NF
 
string(REPLACE "\n" ";" NFO_LINES "${NFO_LINES}")
 

	
 
foreach(NFO_LINE IN LISTS NFO_LINES)
 
    # Recover the ; that was really in the text (and not a newline)
 
    string(REPLACE "\\;" ";" NFO_LINE "${NFO_LINE}")
 

	
 
    if (NFO_LINE MATCHES "^#include")
 
    if(NFO_LINE MATCHES "^#include")
 
        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)
 
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${GRF_SOURCE_FOLDER_NAME}.grf ${GRF_BINARY_FILE})
cmake/scripts/FindVersion.cmake
Show inline comments
 
@@ -3,13 +3,13 @@ cmake_minimum_required(VERSION 3.5)
 
#
 
# Finds the current version of the current folder.
 
#
 

	
 
find_package(Git QUIET)
 
# ${CMAKE_SOURCE_DIR}/.git may be a directory or a regular file
 
if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
 
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
 
    # Make sure LC_ALL is set to something desirable
 
    set(SAVED_LC_ALL "$ENV{LC_ALL}")
 
    set(ENV{LC_ALL} C)
 

	
 
    # Assume the dir is not modified
 
    set(REV_MODIFIED 0)
 
@@ -23,13 +23,13 @@ if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE
 
    # See if git tree is modified
 
    execute_process(COMMAND ${GIT_EXECUTABLE} diff-index HEAD
 
                    OUTPUT_VARIABLE IS_MODIFIED
 
                    OUTPUT_STRIP_TRAILING_WHITESPACE
 
                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 
    )
 
    if (NOT IS_MODIFIED STREQUAL "")
 
    if(NOT IS_MODIFIED STREQUAL "")
 
        set(REV_MODIFIED 2)
 
    endif()
 

	
 
    # Get last commit hash
 
    execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
 
                    OUTPUT_VARIABLE FULLHASH
 
@@ -66,75 +66,75 @@ if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE
 
                    OUTPUT_STRIP_TRAILING_WHITESPACE
 
                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 
                    ERROR_QUIET
 
    )
 
    string(REGEX REPLACE "\^0$" "" TAG "${TAG}")
 

	
 
    if (REV_MODIFIED EQUAL 0)
 
    if(REV_MODIFIED EQUAL 0)
 
        set(HASHPREFIX "-g")
 
    elseif (REV_MODIFIED EQUAL 2)
 
    elseif(REV_MODIFIED EQUAL 2)
 
        set(HASHPREFIX "-m")
 
    else ()
 
    else()
 
        set(HASHPREFIX "-u")
 
    endif()
 

	
 
    # Set the version string
 
    if (NOT TAG STREQUAL "")
 
    if(NOT TAG STREQUAL "")
 
        set(REV_VERSION "${TAG}")
 
        set(REV_ISTAG 1)
 

	
 
        string(REGEX REPLACE "^[0-9.]+$" "" STABLETAG "${TAG}")
 
        if (NOT STABLETAG STREQUAL "")
 
        if(NOT STABLETAG STREQUAL "")
 
            set(REV_ISSTABLETAG 1)
 
        else ()
 
        else()
 
            set(REV_ISSTABLETAG 0)
 
        endif ()
 
    else ()
 
        endif()
 
    else()
 
        set(REV_VERSION "${REV_ISODATE}-${BRANCH}${HASHPREFIX}${SHORTHASH}")
 
        set(REV_ISTAG 0)
 
        set(REV_ISSTABLETAG 0)
 
    endif ()
 
    endif()
 

	
 
    # Restore LC_ALL
 
    set(ENV{LC_ALL} "${SAVED_LC_ALL}")
 
elseif (EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
 
elseif(EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
 
    file(READ "${CMAKE_SOURCE_DIR}/.ottdrev" OTTDREV)
 
    string(REPLACE "\n" "" OTTDREV "${OTTDREV}")
 
    string(REPLACE "\t" ";" OTTDREV "${OTTDREV}")
 
    list(GET OTTDREV 0 REV_VERSION)
 
    list(GET OTTDREV 1 REV_ISODATE)
 
    list(GET OTTDREV 2 REV_MODIFIED)
 
    list(GET OTTDREV 3 REV_HASH)
 
    list(GET OTTDREV 4 REV_ISTAG)
 
    list(GET OTTDREV 5 REV_ISSTABLETAG)
 
    list(GET OTTDREV 6 REV_YEAR)
 
else ()
 
else()
 
    message(WARNING "No version detected; this build will NOT be network compatible")
 
    set(REV_VERSION "norev0000")
 
    set(REV_ISODATE "19700101")
 
    set(REV_MODIFIED 1)
 
    set(REV_HASH "unknown")
 
    set(REV_ISTAG 0)
 
    set(REV_ISSTABLETAG 0)
 
    set(REV_YEAR "1970")
 
endif ()
 
endif()
 

	
 
message(STATUS "Version string: ${REV_VERSION}")
 

	
 
if (GENERATE_OTTDREV)
 
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")
 

	
 
    if (WIN32)
 
    if(WIN32)
 
        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
 
@@ -12,18 +12,18 @@ cmake_minimum_required(VERSION 3.5)
 
#
 
# The parameter "enumname" specifies the enumeration to extract. This can also be a regular expression.
 
# The parameter "filename" specifies the relative path to the file, where the enumeration is extracted from. This can also be a glob expression.
 
#
 
#
 

	
 
if (NOT GENERATE_SOURCE_FILE)
 
if(NOT GENERATE_SOURCE_FILE)
 
    message(FATAL_ERROR "Script needs GENERATE_SOURCE_FILE defined")
 
endif (NOT GENERATE_SOURCE_FILE)
 
if (NOT GENERATE_BINARY_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")
 

	
 
foreach(ENUM IN LISTS ENUM_LINES)
 
    string(REGEX REPLACE "^(	)// @enum ([^ ]+) ([^ ]+)@([^ ]+)@" "\\4" PLACE_HOLDER "${ENUM}")
 
    set(ADD_INDENT "${CMAKE_MATCH_1}")
 
@@ -43,44 +43,44 @@ foreach(ENUM IN LISTS ENUM_LINES)
 
        string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}/* automatically generated from ${FILE} */")
 

	
 
        foreach(LINE IN LISTS SOURCE_LINES)
 
            string(REPLACE "${RM_INDENT}" "" LINE "${LINE}")
 

	
 
            # Remember possible doxygen comment before enum declaration
 
            if ((NOT ACTIVE) AND "${LINE}" MATCHES "/\\*\\*")
 
            if((NOT ACTIVE) AND "${LINE}" MATCHES "/\\*\\*")
 
                set(COMMENT "${ADD_INDENT}${LINE}")
 
                set(ACTIVE_COMMENT 1)
 
            elseif (ACTIVE_COMMENT EQUAL 1)
 
            elseif(ACTIVE_COMMENT EQUAL 1)
 
                string(APPEND COMMENT "\n${ADD_INDENT}${LINE}")
 
            endif()
 

	
 
            # Check for enum match
 
            if ("${LINE}" MATCHES "^	*enum *${ENUM_PATTERN} *\{")
 
            if("${LINE}" MATCHES "^	*enum *${ENUM_PATTERN} *\{")
 
                # REGEX REPLACE does a REGEX MATCHALL and fails if an empty string is matched
 
                string(REGEX MATCH "[^	]*" RESULT "${LINE}")
 
                string(REPLACE "${RESULT}" "" RM_INDENT "${LINE}")
 

	
 
                set(ACTIVE 1)
 
                if (ACTIVE_COMMENT GREATER 0)
 
                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 "")
 
            if(ACTIVE_COMMENT EQUAL 2 AND NOT "${LINE}" STREQUAL "")
 
                unset(ACTIVE_COMMENT)
 
                unset(COMMENT)
 
            endif (ACTIVE_COMMENT EQUAL 2 AND NOT "${LINE}" STREQUAL "")
 
            if (ACTIVE_COMMENT EQUAL 1 AND "${LINE}" MATCHES "\\*/")
 
            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_]* *[,=]")
 
            if(ACTIVE)
 
                if("${LINE}" MATCHES "^	*[A-Za-z0-9_]* *[,=]")
 
                    # Transform enum values
 
                    # REGEX REPLACE does a REGEX MATCHALL and replaces too much
 
                    string(REGEX MATCH " *=[^,]*" RESULT "${LINE}")
 
                    string(REPLACE "${RESULT}" "" LINE "${LINE}")
 

	
 
                    string(REGEX REPLACE " *//" " //" LINE "${LINE}")
 
@@ -89,31 +89,31 @@ foreach(ENUM IN LISTS ENUM_LINES)
 

	
 
                    string(LENGTH "${CMAKE_MATCH_2}" LEN)
 
                    math(EXPR LEN "43 - ${LEN}")
 
                    unset(SPACES)
 
                    foreach(i RANGE ${LEN})
 
                        string(APPEND SPACES " ")
 
                    endforeach(i)
 
                    endforeach()
 

	
 
                    if (CMAKE_MATCH_3)
 
                    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)
 
                elseif ("${LINE}" STREQUAL "")
 
                    endif()
 
                elseif("${LINE}" STREQUAL "")
 
                    string(APPEND ${PLACE_HOLDER} "\n")
 
                else ()
 
                else()
 
                    string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}${LINE}")
 
                endif ()
 
            endif (ACTIVE)
 
                endif()
 
            endif()
 

	
 
            if ("${LINE}" MATCHES "^	*\};")
 
                if (ACTIVE)
 
            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
 
cmake_minimum_required(VERSION 3.5)
 

	
 
#
 
# Runs a single regressoion test
 
#
 

	
 
if (NOT REGRESSION_TEST)
 
if(NOT REGRESSION_TEST)
 
    message(FATAL_ERROR "Script needs REGRESSION_TEST defined (tip: use -DREGRESSION_TEST=..)")
 
endif (NOT REGRESSION_TEST)
 
if (NOT OPENTTD_EXECUTABLE)
 
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)
 
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)")
 
endif ()
 
endif()
 

	
 
# If editbin is given, copy the executable to a new folder, and change the
 
# subsystem to console. The copy is needed as multiple regressions can run
 
# at the same time.
 
if (EDITBIN_EXECUTABLE)
 
if(EDITBIN_EXECUTABLE)
 
    execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${OPENTTD_EXECUTABLE} regression/${REGRESSION_TEST}.exe)
 
    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}
 
                        -x
 
                        -c regression/regression.cfg
 
                        -g ai/${REGRESSION_TEST}/test.sav
 
@@ -37,19 +37,19 @@ execute_process(COMMAND ${OPENTTD_EXECUT
 
                        -d misc=9
 
                OUTPUT_VARIABLE REGRESSION_OUTPUT
 
                ERROR_VARIABLE REGRESSION_RESULT
 
                OUTPUT_STRIP_TRAILING_WHITESPACE
 
)
 

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

	
 
if (NOT REGRESSION_RESULT)
 
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}")
 
string(REPLACE "0x0000000000000000" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
 
string(REPLACE "0x0x0" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
 

	
 
@@ -73,24 +73,24 @@ set(ERROR NO)
 
list(LENGTH REGRESSION_EXPECTED REGRESSION_EXPECTED_LENGTH)
 

	
 
# Compare the output
 
foreach(RESULT IN LISTS REGRESSION_RESULT)
 
    list(GET REGRESSION_EXPECTED ${ARGC} EXPECTED)
 

	
 
    if (NOT RESULT STREQUAL EXPECTED)
 
    if(NOT RESULT STREQUAL EXPECTED)
 
        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)
 
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)
 
if(ERROR)
 
    message(FATAL_ERROR "Regression failed")
 
endif (ERROR)
 
endif()
cmake/scripts/SquirrelExport.cmake
Show inline comments
 
cmake_minimum_required(VERSION 3.5)
 

	
 
if (NOT SCRIPT_API_SOURCE_FILE)
 
if(NOT SCRIPT_API_SOURCE_FILE)
 
    message(FATAL_ERROR "Script needs SCRIPT_API_SOURCE_FILE defined")
 
endif (NOT SCRIPT_API_SOURCE_FILE)
 
if (NOT SCRIPT_API_BINARY_FILE)
 
endif()
 
if(NOT SCRIPT_API_BINARY_FILE)
 
    message(FATAL_ERROR "Script needs SCRIPT_API_BINARY_FILE defined")
 
endif (NOT SCRIPT_API_BINARY_FILE)
 
if (NOT SCRIPT_API_FILE)
 
endif()
 
if(NOT SCRIPT_API_FILE)
 
    message(FATAL_ERROR "Script needs SCRIPT_API_FILE defined")
 
endif (NOT SCRIPT_API_FILE)
 
if (NOT APIUC)
 
endif()
 
if(NOT APIUC)
 
    message(FATAL_ERROR "Script needs APIUC defined")
 
endif (NOT APIUC)
 
if (NOT APILC)
 
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)
 
    string(APPEND SQUIRREL_EXPORT "\n#include \"../${SCRIPT_API_FILE_NAME}\"")
 
    if (NOT "${APIUC}" STREQUAL "Template")
 
    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})
 

	
 
    string(APPEND SQUIRREL_EXPORT "\n	template <> inline ${NAME} *GetParam(ForceType<${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (${NAME} *)instance; }")
 
    string(APPEND SQUIRREL_EXPORT "\n	template <> inline ${NAME} &GetParam(ForceType<${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(${NAME} *)instance; }")
 
    string(APPEND SQUIRREL_EXPORT "\n	template <> inline const ${NAME} *GetParam(ForceType<const ${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (${NAME} *)instance; }")
 
    string(APPEND SQUIRREL_EXPORT "\n	template <> inline const ${NAME} &GetParam(ForceType<const ${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(${NAME} *)instance; }")
 
    if ("${NAME}" STREQUAL "ScriptEvent")
 
    if("${NAME}" STREQUAL "ScriptEvent")
 
        string(APPEND SQUIRREL_EXPORT "\n	template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }")
 
    elseif ("${NAME}" STREQUAL "ScriptText")
 
    elseif("${NAME}" STREQUAL "ScriptText")
 
        string(APPEND SQUIRREL_EXPORT "\n")
 
        string(APPEND SQUIRREL_EXPORT "\n	template <> inline Text *GetParam(ForceType<Text *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) {")
 
        string(APPEND SQUIRREL_EXPORT "\n		if (sq_gettype(vm, index) == OT_INSTANCE) {")
 
        string(APPEND SQUIRREL_EXPORT "\n			return GetParam(ForceType<ScriptText *>(), vm, index, ptr);")
 
        string(APPEND SQUIRREL_EXPORT "\n		}")
 
        string(APPEND SQUIRREL_EXPORT "\n		if (sq_gettype(vm, index) == OT_STRING) {")
 
        string(APPEND SQUIRREL_EXPORT "\n			return new RawText(GetParam(ForceType<const char *>(), vm, index, ptr));")
 
        string(APPEND SQUIRREL_EXPORT "\n		}")
 
        string(APPEND SQUIRREL_EXPORT "\n		return nullptr;")
 
        string(APPEND SQUIRREL_EXPORT "\n	}")
 
    else ()
 
    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)
 
    endif()
 
endmacro()
 

	
 
macro(reset_reader)
 
    unset(ENUMS)
 
    unset(ENUM_VALUES)
 
    unset(CONST_VALUES)
 
    unset(STRUCTS)
 
@@ -60,529 +60,529 @@ macro(reset_reader)
 
    unset(METHODS)
 
    unset(STATIC_METHODS)
 
    unset(CLS)
 
    unset(START_SQUIRREL_DEFINE_ON_NEXT_LINE)
 
    set(CLS_LEVEL 0)
 
    unset(CLS_IN_API)
 
endmacro(reset_reader)
 
endmacro()
 

	
 
reset_reader()
 

	
 
file(STRINGS "${SCRIPT_API_FILE}" SOURCE_LINES)
 

	
 
foreach(LINE IN LISTS SOURCE_LINES)
 
    # Ignore special doxygen blocks
 
    if ("${LINE}" MATCHES "^#ifndef DOXYGEN_API")
 
    if("${LINE}" MATCHES "^#ifndef DOXYGEN_API")
 
        set(DOXYGEN_SKIP "next")
 
        continue()
 
    endif ()
 
    if ("${LINE}" MATCHES "^#ifdef DOXYGEN_API")
 
    endif()
 
    if("${LINE}" MATCHES "^#ifdef DOXYGEN_API")
 
        set(DOXYGEN_SKIP "true")
 
        continue()
 
    endif ()
 
    if ("${LINE}" MATCHES "^#endif /\\* DOXYGEN_API \\*/")
 
    endif()
 
    if("${LINE}" MATCHES "^#endif /\\* DOXYGEN_API \\*/")
 
        unset(DOXYGEN_SKIP)
 
        continue()
 
    endif ()
 
    if ("${LINE}" MATCHES "^#else")
 
        if ("${DOXYGEN_SKIP}" STREQUAL "next")
 
    endif()
 
    if("${LINE}" MATCHES "^#else")
 
        if("${DOXYGEN_SKIP}" STREQUAL "next")
 
            set(DOXYGEN_SKIP "true")
 
        else()
 
            unset(DOXYGEN_SKIP)
 
        endif()
 
        continue()
 
    endif ()
 
    if ("${DOXYGEN_SKIP}" STREQUAL "true")
 
    endif()
 
    if("${DOXYGEN_SKIP}" STREQUAL "true")
 
        continue()
 
    endif()
 

	
 
    if ("${LINE}" MATCHES "^([	 ]*)\\* @api (.*)$")
 
    if("${LINE}" MATCHES "^([	 ]*)\\* @api (.*)$")
 
        set(LINE ${CMAKE_MATCH_2})
 
        # By default, classes are not selected
 
        if (NOT CLS_LEVEL)
 
        if(NOT CLS_LEVEL)
 
            set(API_SELECTED FALSE)
 
        endif (NOT CLS_LEVEL)
 
        endif()
 

	
 
        if ("${APIUC}" STREQUAL "Template")
 
        if("${APIUC}" STREQUAL "Template")
 
            set(API_SELECTED TRUE)
 
            if ("${LINE}" STREQUAL "none" OR "${LINE}" STREQUAL "-all")
 
            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")
 
        if("${LINE}" STREQUAL "none" OR "${LINE}" STREQUAL "-all")
 
            set(API_SELECTED FALSE)
 
        elseif ("${LINE}" MATCHES "-${APILC}")
 
        elseif("${LINE}" MATCHES "-${APILC}")
 
            set(API_SELECTED FALSE)
 
        elseif ("${LINE}" MATCHES "${APILC}")
 
        elseif("${LINE}" MATCHES "${APILC}")
 
            set(API_SELECTED TRUE)
 
        endif ()
 
        endif()
 
        continue()
 
    endif ("${LINE}" MATCHES "^([	 ]*)\\* @api (.*)$")
 
    endif()
 

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

	
 
    # Ignore forward declarations of classes
 
    if ("${LINE}" MATCHES "^(	*)class(.*);")
 
    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|:) ([^ ]*)")
 
        if (NOT CLS_LEVEL)
 
            if (NOT DEFINED API_SELECTED)
 
    if("${LINE}" MATCHES "^(	*)class (.*) (: public|: protected|: private|:) ([^ ]*)")
 
        if(NOT CLS_LEVEL)
 
            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)
 
            set(CLS_PARAM_2 "x")
 
            set(CLS_IN_API ${API_SELECTED})
 
            unset(API_SELECTED)
 
            set(CLS "${CMAKE_MATCH_2}")
 
            set(SUPER_CLS "${CMAKE_MATCH_4}")
 
        elseif (CLS_LEVEL EQUAL 1)
 
            if (NOT DEFINED API_SELECTED)
 
        elseif(CLS_LEVEL EQUAL 1)
 
            if(NOT DEFINED API_SELECTED)
 
                set(API_SELECTED ${CLS_IN_API})
 
            endif (NOT API_SELECTED)
 
            endif()
 

	
 
            if (API_SELECTED)
 
            if(API_SELECTED)
 
                list(APPEND STRUCTS "${CLS}::${CMAKE_MATCH_2}")
 
            endif (API_SELECTED)
 
            endif()
 
            unset(API_SELECTED)
 
        endif ()
 
        endif()
 
        math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)class (.*) (: public|: protected|: private|:) ([^ ]*)")
 
    if ("${LINE}" MATCHES "^(	*)public")
 
        if (CLS_LEVEL EQUAL 1)
 
    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")
 
    if ("${LINE}" MATCHES "^(	*)protected")
 
        if (CLS_LEVEL EQUAL 1)
 
    endif()
 
    if("${LINE}" MATCHES "^(	*)protected")
 
        if(CLS_LEVEL EQUAL 1)
 
            unset(IS_PUBLIC)
 
        endif (CLS_LEVEL EQUAL 1)
 
        endif()
 
        continue()
 
    endif ("${LINE}" MATCHES "^(	*)protected")
 
    if ("${LINE}" MATCHES "^(	*)private")
 
        if (CLS_LEVEL EQUAL 1)
 
    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 "^#")
 
    if("${LINE}" MATCHES "^#")
 
        continue()
 
    endif ("${LINE}" MATCHES "^#")
 
    if ("${LINE}" MATCHES "/\\*.*\\*/")
 
    endif()
 
    if("${LINE}" MATCHES "/\\*.*\\*/")
 
        unset(COMMENT)
 
        continue()
 
    endif ("${LINE}" MATCHES "/\\*.*\\*/")
 
    if ("${LINE}" MATCHES "/\\*")
 
    endif()
 
    if("${LINE}" MATCHES "/\\*")
 
        set(COMMENT TRUE)
 
        continue()
 
    endif ("${LINE}" MATCHES "/\\*")
 
    if ("${LINE}" MATCHES "\\*/")
 
    endif()
 
    if("${LINE}" MATCHES "\\*/")
 
        unset(COMMENT)
 
        continue()
 
    endif ("${LINE}" MATCHES "\\*/")
 
    if (COMMENT)
 
    endif()
 
    if(COMMENT)
 
        continue()
 
    endif (COMMENT)
 
    endif()
 

	
 
    # We need to make specialized conversions for structs
 
    if ("${LINE}" MATCHES "^(	*)struct ([^ ]*)")
 
    if("${LINE}" MATCHES "^(	*)struct ([^ ]*)")
 
        math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
 

	
 
        # Check if we want to publish this struct
 
        if (NOT DEFINED API_SELECTED)
 
        if(NOT DEFINED API_SELECTED)
 
            set(API_SELECTED ${CLS_IN_API})
 
        endif (NOT DEFINED API_SELECTED)
 
        if (NOT 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)
 
        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 ([^ ]*)")
 
    if("${LINE}" MATCHES "^(	*)enum ([^ ]*)")
 
        math(EXPR CLS_LEVEL "${CLS_LEVEL} + 1")
 

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

	
 
        if (NOT IS_PUBLIC)
 
        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 "};")
 
    if("${LINE}" MATCHES "};")
 
        math(EXPR CLS_LEVEL "${CLS_LEVEL} - 1")
 
        if (CLS_LEVEL)
 
        if(CLS_LEVEL)
 
            unset(IN_ENUM)
 
            continue()
 
        endif (CLS_LEVEL)
 
        endif()
 

	
 
        if (CLS)
 
        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)
 
    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)
 
        if(NOT CLS_IN_API)
 
            reset_reader()
 
            continue()
 
        endif (NOT CLS_IN_API)
 
        endif()
 

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

	
 
        unset(IS_PUBLIC)
 
        unset(NAMESPACE_OPENED)
 

	
 
        string(REGEX REPLACE "^Script" "${APIUC}" API_CLS "${CLS}")
 
        string(REGEX REPLACE "^Script" "${APIUC}" API_SUPER_CLS "${SUPER_CLS}")
 

	
 
        string(APPEND SQUIRREL_EXPORT "\n")
 

	
 
        if ("${APIUC}" STREQUAL "Template")
 
        if("${APIUC}" STREQUAL "Template")
 
            # First check whether we have enums to print
 
            if (DEFINED ENUMS)
 
                if (NOT NAMESPACE_OPENED)
 
            if(DEFINED ENUMS)
 
                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)
 
            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)
 
            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})
 

	
 
            string(APPEND SQUIRREL_EXPORT "\n} // namespace SQConvert")
 

	
 
            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}\"; }")
 
        string(APPEND SQUIRREL_EXPORT "\n")
 

	
 
        # Then do the registration functions of the class.
 
        string(APPEND SQUIRREL_EXPORT "\nvoid SQ${API_CLS}_Register(Squirrel *engine)")
 
        string(APPEND SQUIRREL_EXPORT "\n{")
 
        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")
 
        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")
 
        if (NOT "${SUPER_CLS}" STREQUAL "ScriptEvent")
 
            if ("${CLS_PARAM_2}" STREQUAL "v")
 
        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
 
        set(MLEN 0)
 
        foreach(ENUM_VALUE IN LISTS ENUM_VALUES)
 
            string(LENGTH "${ENUM_VALUE}" LEN)
 
            if (MLEN LESS 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)
 
        if (MLEN)
 
        endforeach()
 
        if(MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Const values
 
        set(MLEN 0)
 
        foreach(CONST_VALUE IN LISTS CONST_VALUES)
 
            string(LENGTH "${CONST_VALUE}" LEN)
 
            if (MLEN LESS 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)
 
        if (MLEN)
 
        endforeach()
 
        if(MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Mapping of OTTD strings to errors
 
        set(MLEN 0)
 
        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)
 
            string(LENGTH "${ENUM_STRING}" LEN)
 
            if (MLEN LESS 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)
 
            list(GET ENUM_STRING_TO_ERROR 1 ENUM_ERROR)
 
            string(LENGTH "${ENUM_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::RegisterErrorMap(${ENUM_STRING},${SPACES}${CLS}::${ENUM_ERROR});")
 
        endforeach(ENUM_STRING_TO_ERROR)
 
        if (MLEN)
 
        endforeach()
 
        if(MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Mapping of errors to human 'readable' strings.
 
        set(MLEN 0)
 
        foreach(ENUM_ERROR_TO_STRING IN LISTS ENUM_ERROR_TO_STRINGS)
 
            string(LENGTH "${ENUM_ERROR_TO_STRING}" LEN)
 
            if (MLEN LESS 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)
 
        if (MLEN)
 
        endforeach()
 
        if(MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Static methods
 
        set(MLEN 0)
 
        foreach(STATIC_METHOD IN LISTS STATIC_METHODS)
 
            string(REPLACE ":" ";" STATIC_METHOD "${STATIC_METHOD}")
 
            list(GET STATIC_METHOD 0 FUNCNAME)
 
            string(LENGTH "${FUNCNAME}" LEN)
 
            if (MLEN LESS 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)
 
            list(GET STATIC_METHOD 1 ARGC)
 
            list(GET STATIC_METHOD 2 TYPES)
 
            string(LENGTH "${FUNCNAME}" LEN)
 
            math(EXPR LEN "${MLEN} - ${LEN}")
 
            if ("${TYPES}" STREQUAL "v")
 
                if (LEN GREATER 8)
 
            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)
 
            if ("${TYPES}" STREQUAL "v")
 
            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)
 
        if (MLEN)
 
            endif()
 
        endforeach()
 
        if(MLEN)
 
            string(APPEND SQUIRREL_EXPORT "\n")
 
        endif (MLEN)
 
        endif()
 

	
 
        # Non-static methods
 
        set(MLEN 0)
 
        foreach(METHOD IN LISTS METHODS)
 
            string(REPLACE ":" ";" METHOD "${METHOD}")
 
            list(GET METHOD 0 FUNCNAME)
 
            string(LENGTH "${FUNCNAME}" LEN)
 
            if (MLEN LESS 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)
 
            list(GET METHOD 1 ARGC)
 
            list(GET METHOD 2 TYPES)
 
            string(LENGTH "${FUNCNAME}" LEN)
 
            math(EXPR LEN "${MLEN} - ${LEN}")
 
            if ("${TYPES}" STREQUAL "v")
 
                if (LEN GREATER 8)
 
            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)
 
            if ("${TYPES}" STREQUAL "v")
 
            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)
 
        if (MLEN)
 
            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}")
 

	
 
        reset_reader()
 

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

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

	
 
    # Add enums
 
    if (IN_ENUM)
 
    if(IN_ENUM)
 
        string(REGEX MATCH "([^,	 ]+)" ENUM_VALUE "${LINE}")
 
        list(APPEND ENUM_VALUES "${ENUM_VALUE}")
 

	
 
        # Check if this a special error enum
 
        list(GET ENUMS -1 ENUM)
 
        if ("${ENUM}" MATCHES ".*::ErrorMessages")
 
        if("${ENUM}" MATCHES ".*::ErrorMessages")
 
            # syntax:
 
            # enum ErrorMessages {
 
            #	ERR_SOME_ERROR,	// [STR_ITEM1, STR_ITEM2, ...]
 
            # }
 

	
 
            # Set the mappings
 
            if ("${LINE}" MATCHES "\\[(.*)\\]")
 
            if("${LINE}" MATCHES "\\[(.*)\\]")
 
                string(REGEX REPLACE "[ 	]" "" MAPPINGS "${CMAKE_MATCH_1}")
 
                string(REPLACE "," ";" MAPPINGS "${MAPPINGS}")
 

	
 
                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 [^ ]+ ([^ ]+) = -?\\(?[^ ]*\\)?[^ ]+;")
 
    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)
 
    if("${LINE}" MATCHES "^.*\\(.*\\).*$")
 
        if(NOT CLS_LEVEL EQUAL 1)
 
            continue()
 
        endif (NOT CLS_LEVEL EQUAL 1)
 
        if ("${LINE}" MATCHES "~")
 
            if (DEFINED API_SELECTED)
 
        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")
 
        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}")
 
        set(PARAM_S "${LINE}")
 
        string(REGEX REPLACE "\\*" "" LINE "${LINE}")
 
        string(REGEX REPLACE "\\(.*" "" LINE "${LINE}")
 
@@ -590,78 +590,78 @@ foreach(LINE IN LISTS SOURCE_LINES)
 
        string(REGEX REPLACE ".*\\(" "" PARAM_S "${PARAM_S}")
 
        string(REGEX REPLACE "\\).*" "" PARAM_S "${PARAM_S}")
 

	
 
        string(REGEX MATCH "([^ 	]+)( ([^ ]+))?" RESULT "${LINE}")
 
        set(FUNCTYPE "${CMAKE_MATCH_1}")
 
        set(FUNCNAME "${CMAKE_MATCH_3}")
 
        if ("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME)
 
            if (DEFINED API_SELECTED)
 
        if("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME)
 
            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)
 
            if(NOT PARAM_S)
 
                continue()
 
            endif (NOT PARAM_S)
 
        elseif (NOT FUNCNAME)
 
            endif()
 
        elseif(NOT FUNCNAME)
 
            continue()
 
		endif ()
 
		endif()
 

	
 
        string(REPLACE "," ";" PARAMS "${PARAM_S}")
 
        if (IS_STATIC)
 
        if(IS_STATIC)
 
            set(TYPES ".")
 
        else (IS_STATIC)
 
        else()
 
            set(TYPES "x")
 
        endif (IS_STATIC)
 
        endif()
 

	
 
        set(LEN 1)
 
        foreach(PARAM IN LISTS PARAMS)
 
            math(EXPR LEN "${LEN} + 1")
 
            string(STRIP "${PARAM}" PARAM)
 
            if ("${PARAM}" MATCHES "\\*|&")
 
                if ("${PARAM}" MATCHES "^char")
 
            if("${PARAM}" MATCHES "\\*|&")
 
                if("${PARAM}" MATCHES "^char")
 
                    # Many types can be converted to string, so use '.', not 's'. (handled by our glue code)
 
                    string(APPEND TYPES ".")
 
                elseif ("${PARAM}" MATCHES "^void")
 
                elseif("${PARAM}" MATCHES "^void")
 
                    string(APPEND TYPES "p")
 
                elseif ("${PARAM}" MATCHES "^Array")
 
                elseif("${PARAM}" MATCHES "^Array")
 
                    string(APPEND TYPES "a")
 
                elseif ("${PARAM}" MATCHES "^struct Array")
 
                elseif("${PARAM}" MATCHES "^struct Array")
 
                    string(APPEND TYPES "a")
 
                elseif ("${PARAM}" MATCHES "^Text")
 
                elseif("${PARAM}" MATCHES "^Text")
 
                    string(APPEND TYPES ".")
 
                else ()
 
                else()
 
                    string(APPEND TYPES "x")
 
                endif ()
 
            elseif ("${PARAM}" MATCHES "^bool")
 
                endif()
 
            elseif("${PARAM}" MATCHES "^bool")
 
                string(APPEND TYPES "b")
 
            elseif ("${PARAM}" MATCHES "^HSQUIRRELVM")
 
            elseif("${PARAM}" MATCHES "^HSQUIRRELVM")
 
                set(TYPES "v")
 
            else ()
 
            else()
 
                string(APPEND TYPES "i")
 
            endif ()
 
        endforeach(PARAM)
 
            endif()
 
        endforeach()
 

	
 
        # Check if we want to publish this function
 
        if (NOT DEFINED API_SELECTED)
 
        if(NOT DEFINED API_SELECTED)
 
            set(API_SELECTED ${CLS_IN_API})
 
        endif (NOT DEFINED API_SELECTED)
 
        if (NOT 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)
 
        if("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME)
 
            set(CLS_PARAM_1 ${LEN})
 
            set(CLS_PARAM_2 "${TYPES}")
 
        elseif ("${FUNCNAME}" MATCHES "^_" AND NOT "${TYPES}" STREQUAL "v")
 
        elseif (IS_STATIC)
 
        elseif("${FUNCNAME}" MATCHES "^_" AND NOT "${TYPES}" STREQUAL "v")
 
        elseif(IS_STATIC)
 
            list(APPEND STATIC_METHODS "${FUNCNAME}:${LEN}:${TYPES}")
 
        else ()
 
        else()
 
            list(APPEND METHODS "${FUNCNAME}:${LEN}:${TYPES}")
 
        endif ()
 
        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
 
cmake_minimum_required(VERSION 3.5)
 

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

	
 
set(ARGC 1)
 
set(ARG_READ NO)
 

	
 
# Read all the arguments given to CMake; we are looking for -- and everything
 
# that follows. Those are our api files.
 
while(ARGC LESS CMAKE_ARGC)
 
    set(ARG ${CMAKE_ARGV${ARGC}})
 

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

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

	
 
    math(EXPR ARGC "${ARGC} + 1")
 
endwhile()
 

	
 
foreach(FILE IN LISTS SCRIPT_API_BINARY_FILES)
 
    file(STRINGS "${FILE}" LINES REGEX "^void SQ${APIUC}.*_Register\\(Squirrel \\*engine\\)$")
 
    if (LINES)
 
    if(LINES)
 
        string(REGEX REPLACE ".*api/${APILC}/(.*)" "#include \"\\1\"" FILE "${FILE}")
 
        list(APPEND SQUIRREL_INCLUDES "${FILE}")
 
        foreach(LINE IN LISTS LINES)
 
            if ("${LINE}" MATCHES "SQ${APIUC}(List|Controller)_Register")
 
            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}")
 

	
 
string(REGEX REPLACE "_Register" "0000Register" SQUIRREL_REGISTER "${SQUIRREL_REGISTER}")
 
list(SORT SQUIRREL_REGISTER)
media/baseset/CMakeLists.txt
Show inline comments
 
@@ -17,19 +17,19 @@ set(BASESET_OTHER_SOURCE_FILES
 
        ${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf
 
        ${CMAKE_CURRENT_SOURCE_DIR}/opntitle.dat
 
        ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf
 
)
 

	
 
# Done by the subdirectories, if nforenum / grfcodec is installed
 
if (GRFCODEC_FOUND)
 
if(GRFCODEC_FOUND)
 
    set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf PROPERTIES GENERATED TRUE)
 
    set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf PROPERTIES GENERATED TRUE)
 

	
 
    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)
 

	
 
# Walk over all the baseset files, and generate a command to configure them
 
foreach(BASESET_SOURCE_FILE IN LISTS BASESET_SOURCE_FILES)
 
    get_filename_component(BASESET_SOURCE_FILE_NAME "${BASESET_SOURCE_FILE}" NAME)
 
@@ -51,13 +51,13 @@ foreach(BASESET_SOURCE_FILE IN LISTS BAS
 
                    ${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake
 
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
            COMMENT "Generating ${BASESET_SOURCE_FILE_NAME} baseset metadata file"
 
    )
 

	
 
    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)
 
    get_filename_component(BASESET_OTHER_SOURCE_FILE_NAME "${BASESET_OTHER_SOURCE_FILE}" NAME)
 
    set(BASESET_OTHER_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_OTHER_SOURCE_FILE_NAME}")
 

	
 
@@ -67,13 +67,13 @@ foreach(BASESET_OTHER_SOURCE_FILE IN LIS
 
                    ${BASESET_OTHER_BINARY_FILE}
 
            MAIN_DEPENDENCY ${BASESET_OTHER_SOURCE_FILE}
 
            COMMENT "Copying ${BASESET_OTHER_SOURCE_FILE_NAME} baseset file"
 
    )
 

	
 
    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
 
        DEPENDS
 
        ${BASESET_BINARY_FILES}
 
)
media/baseset/openttd/CMakeLists.txt
Show inline comments
 
# In case both NFORenum and GRFCodec are found, generate the GRF.
 
# Otherwise, just use them from the cache (read: git).
 
# This is mainly because not many people have both of these tools installed,
 
# so it is cheaper to cache them in git, and only regenerate when you are
 
# working on it / have the tools installed.
 
if (GRFCODEC_FOUND)
 
if(GRFCODEC_FOUND)
 
    include(CreateGrfCommand)
 
    create_grf_command()
 
endif (GRFCODEC_FOUND)
 
endif()
media/baseset/orig_extra/CMakeLists.txt
Show inline comments
 
# In case both NFORenum and GRFCodec are found, generate the GRF.
 
# Otherwise, just use them from the cache (read: git).
 
# This is mainly because not many people have both of these tools installed,
 
# so it is cheaper to cache them in git, and only regenerate when you are
 
# working on it / have the tools installed.
 
if (GRFCODEC_FOUND)
 
if(GRFCODEC_FOUND)
 
    include(CreateGrfCommand)
 
    create_grf_command(
 
        # We share some files with 'openttd' grf
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/airports.png
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/canals.png
 
        ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/chars.png
 
    )
 
endif (GRFCODEC_FOUND)
 
endif()
src/CMakeLists.txt
Show inline comments
 
@@ -21,17 +21,17 @@ add_subdirectory(video)
 
add_subdirectory(widgets)
 

	
 
add_files(
 
    viewport_sprite_sorter_sse4.cpp
 
    CONDITION SSE_FOUND
 
)
 
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
    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
 
    aircraft_cmd.cpp
 
    aircraft_gui.cpp
 
    airport.cpp
src/blitter/CMakeLists.txt
Show inline comments
 
@@ -29,25 +29,25 @@ add_files(
 
    32bpp_sse_type.h
 
    32bpp_ssse3.cpp
 
    32bpp_ssse3.hpp
 
    CONDITION NOT OPTION_DEDICATED AND SSE_FOUND
 
)
 

	
 
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
 
    set_compile_flags(
 
        32bpp_anim_sse2.cpp
 
        32bpp_sse2.cpp
 
        COMPILE_FLAGS -msse2)
 
    set_compile_flags(
 
        32bpp_ssse3.cpp
 
        COMPILE_FLAGS -mssse3)
 
    set_compile_flags(
 
        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
 
    common.hpp
 
    factory.hpp
 
    null.cpp
src/lang/CMakeLists.txt
Show inline comments
 
@@ -75,13 +75,13 @@ foreach(LANG_SOURCE_FILE IN LISTS LANG_S
 
            MAIN_DEPENDENCY ${LANG_SOURCE_FILE}
 
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
            COMMENT "Compiling language ${LANG_SOURCE_FILE_NAME_WE}"
 
    )
 

	
 
    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
 
        DEPENDS
 
        ${LANG_BINARY_FILES}
 
)
src/music/CMakeLists.txt
Show inline comments
 
if (NOT OPTION_DEDICATED)
 
if(NOT OPTION_DEDICATED)
 
    add_files(
 
        allegro_m.cpp
 
        allegro_m.h
 
        CONDITION Allegro_FOUND
 
    )
 

	
 
@@ -39,13 +39,13 @@ if (NOT OPTION_DEDICATED)
 

	
 
    add_files(
 
        os2_m.cpp
 
        os2_m.h
 
        CONDITION OPTION_OS2
 
    )
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
add_files(
 
    midi.h
 
    midifile.cpp
 
    midifile.hpp
 
    music_driver.hpp
src/script/api/CMakeLists.txt
Show inline comments
 
@@ -5,13 +5,13 @@ add_library(script_api
 
# Get script_window.hpp dependencies
 
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/script_window.hpp.in ENUM_LINES REGEX "@enum")
 
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
 
add_custom_command_timestamp(OUTPUT ${CMAKE_BINARY_DIR}/generated/script/api/script_window.hpp
 
        COMMAND ${CMAKE_COMMAND}
 
                -DGENERATE_SOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/script_window.hpp.in
 
@@ -37,15 +37,15 @@ list(APPEND SCRIPT_API_FILES ${CMAKE_BIN
 

	
 
foreach(API "ai;AI" "game;GS" "template;Template")
 
    list(GET API 0 APILC)
 
    list(GET API 1 APIUC)
 

	
 
    foreach(SCRIPT_API_FILE IN LISTS SCRIPT_API_FILES)
 
        if ("${SCRIPT_API_FILE}" MATCHES ".*script_controller.*")
 
        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")
 

	
 
        add_custom_command_timestamp(OUTPUT ${SCRIPT_API_BINARY_FILE}
 
                COMMAND ${CMAKE_COMMAND}
 
@@ -59,23 +59,23 @@ foreach(API "ai;AI" "game;GS" "template;
 
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/squirrel_export.hpp.sq.in
 
                        ${CMAKE_SOURCE_DIR}/cmake/scripts/SquirrelExport.cmake
 
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
                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
 
            ${SCRIPT_${APIUC}_BINARY_FILES}
 
    )
 
    add_dependencies(script_${APILC}
 
            script_window
 
    )
 

	
 
    if (NOT "${APILC}" STREQUAL "template")
 
    if(NOT "${APILC}" STREQUAL "template")
 
        list(APPEND SCRIPT_${APIUC}_BINARY_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${APILC}/${APILC}_controller.hpp.sq")
 
        set(INCLUDES_BINARY_FILE "${CMAKE_BINARY_DIR}/generated/script/api/${APILC}/${APILC}_includes.hpp")
 
        add_custom_command_timestamp(OUTPUT ${INCLUDES_BINARY_FILE}
 
                COMMAND ${CMAKE_COMMAND}
 
                        -DINCLUDES_SOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/script_includes.hpp.in
 
                        -DINCLUDES_BINARY_FILE=${INCLUDES_BINARY_FILE}
 
@@ -97,25 +97,25 @@ foreach(API "ai;AI" "game;GS" "template;
 
        add_dependencies(script_${APILC}_includes
 
            script_${APILC}
 
        )
 
        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
 
            ${CMAKE_BINARY_DIR}/generated/script
 
            ${CMAKE_BINARY_DIR}/generated/script/api/${APILC}
 
            ${CMAKE_CURRENT_SOURCE_DIR}/${APILC}
 
    )
 
endforeach(API)
 
endforeach()
 

	
 
add_library(openttd::script_api ALIAS script_api)
 

	
 

	
 
add_files(
 
    ai_changelog.hpp
src/sound/CMakeLists.txt
Show inline comments
 
if (NOT OPTION_DEDICATED)
 
if(NOT OPTION_DEDICATED)
 
    add_files(
 
        allegro_s.cpp
 
        allegro_s.h
 
        CONDITION Allegro_FOUND
 
    )
 

	
 
@@ -31,13 +31,13 @@ if (NOT OPTION_DEDICATED)
 

	
 
    add_files(
 
        xaudio2_s.cpp
 
        xaudio2_s.h
 
        CONDITION WIN32 AND XAUDIO2_FOUND
 
    )
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

	
 
add_files(
 
    sound_driver.hpp
 
    null_s.cpp
 
    null_s.h
 
)
src/video/CMakeLists.txt
Show inline comments
 
add_subdirectory(cocoa)
 

	
 
if (NOT OPTION_DEDICATED)
 
if(NOT OPTION_DEDICATED)
 
    add_files(
 
        allegro_v.cpp
 
        allegro_v.h
 
        CONDITION Allegro_FOUND
 
    )
 

	
 
@@ -21,13 +21,13 @@ if (NOT OPTION_DEDICATED)
 

	
 
    add_files(
 
        win32_v.cpp
 
        win32_v.h
 
        CONDITION WIN32
 
    )
 
endif (NOT OPTION_DEDICATED)
 
endif()
 

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