<commit_before>CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
PROJECT(Asteroids)

# Modules
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# Ouput directories
if (UNIX)
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
ENDIF (UNIX)

ADD_EXECUTABLE(
    ${PROJECT_NAME}
    src/main.cpp
    src/World.cpp
    src/Drawing.cpp
    src/MathUtilities.cpp
    src/Vector2.cpp
    src/AABB2.cpp
    src/Actor.cpp
    src/Player.cpp
    src/Bullet.cpp
    src/Asteroid.cpp
    src/AsteroidFactory.cpp
    src/EnemyShip.cpp
    src/BitmapFont.cpp
    src/Texture.cpp
    src/BitmapFontXMLParser.cxx
    src/SoundManager.cpp
    src/FileSystem.cpp
    src/Game.cpp
    src/AsteroidGame.cpp
)

# OpenGL
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OpenGL_INCLUDE_DIRS})
LINK_DIRECTORIES(${OpenGL_LIBRARY_DIRS})
ADD_DEFINITIONS(${OpenGL_DEFINITIONS})
IF(NOT OPENGL_FOUND)
    MESSAGE(ERROR " OPENGL not found!")
ENDIF(NOT OPENGL_FOUND)

#---------------------
# WINDOWS
#---------------------

IF(WIN32)
    
    INCLUDE_DIRECTORIES(
        ${PROJECT_SOURCE_DIR}/deps/win32/devil/include
        ${PROJECT_SOURCE_DIR}/deps/win32/openal/include
        ${PROJECT_SOURCE_DIR}/deps/win32/xercesc/include
        ${PROJECT_SOURCE_DIR}/deps/win32/xsd/include
        ${PROJECT_SOURCE_DIR}/deps/win32/sdl2/include
    )

    TARGET_LINK_LIBRARIES(
        ${PROJECT_NAME}<commit_msg>Fixed the issue with linker option SAFESEH.<commit_after>CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
PROJECT(Asteroids)

# Modules
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# Ouput directories
IF (UNIX)
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
ENDIF (UNIX)

ADD_EXECUTABLE(
    ${PROJECT_NAME}
    src/main.cpp
    src/World.cpp
    src/Drawing.cpp
    src/MathUtilities.cpp
    src/Vector2.cpp
    src/AABB2.cpp
    src/Actor.cpp
    src/Player.cpp
    src/Bullet.cpp
    src/Asteroid.cpp
    src/AsteroidFactory.cpp
    src/EnemyShip.cpp
    src/BitmapFont.cpp
    src/Texture.cpp
    src/BitmapFontXMLParser.cxx
    src/SoundManager.cpp
    src/FileSystem.cpp
    src/Game.cpp
    src/AsteroidGame.cpp
)

IF (WIN32)
    
    # More information about the following macros:
    # https://binglongx.wordpress.com/tag/safeseh/

    # Append str to a string property of a target. 
    # target:      string: target name. 
    # property:    name of target’s property. e.g: COMPILE_FLAGS, or LINK_FLAGS 
    # str:         string: string to be appended to the property 
    MACRO(MACRO_APPEND_TARGET_PROPERTY target property str) 
      GET_TARGET_PROPERTY(current_property ${target} ${property}) 
      IF(NOT current_property) # property non-existent or empty 
          SET_TARGET_PROPERTIES(${target} PROPERTIES ${property} ${str}) 
      ELSE() 
          SET_TARGET_PROPERTIES(${target} PROPERTIES ${property} "${current_property} ${str}") 
      ENDIF() 
    ENDMACRO(MACRO_APPEND_TARGET_PROPERTY)

    # Add/append compile flags to a target. 
    # target: string: target name. 
    # flags : string: compile flags to be appended 
    MACRO(MACRO_ADD_COMPILE_FLAGS target flags) 
      MACRO_APPEND_TARGET_PROPERTY(${target} COMPILE_FLAGS ${flags}) 
    ENDMACRO(MACRO_ADD_COMPILE_FLAGS)


    # Add/append link flags to a target. 
    # target: string: target name. 
    # flags : string: link flags to be appended 
    MACRO(MACRO_ADD_LINK_FLAGS target flags) 
      MACRO_APPEND_TARGET_PROPERTY(${target} LINK_FLAGS ${flags}) 
    ENDMACRO(MACRO_ADD_LINK_FLAGS) 


    # Disable the Linker option Image Has Safe Exception Handlers (SAFESEH)
    # This cause compilation errors in VS2012, VS2013 with the OpenAL dll.
    MACRO_ADD_LINK_FLAGS(${PROJECT_NAME} "/SAFESEH:NO")

ENDIF (WIN32)



# OpenGL
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OpenGL_INCLUDE_DIRS})
LINK_DIRECTORIES(${OpenGL_LIBRARY_DIRS})
ADD_DEFINITIONS(${OpenGL_DEFINITIONS})
IF(NOT OPENGL_FOUND)
    MESSAGE(ERROR " OPENGL not found!")
ENDIF(NOT OPENGL_FOUND)

#---------------------
# WINDOWS
#---------------------

IF(WIN32)
    
    INCLUDE_DIRECTORIES(
        ${PROJECT_SOURCE_DIR}/deps/win32/devil/include
        ${PROJECT_SOURCE_DIR}/deps/win32/openal/include
        ${PROJECT_SOURCE_DIR}/deps/win32/xercesc/include
        ${PROJECT_SOURCE_DIR}/deps/win32/xsd/include
        ${PROJECT_SOURCE_DIR}/deps/win32/sdl2/include
    )

    TARGET_LINK_LIBRARIES(
        ${PROJECT_NAME}
{'fraction_non_alphanumeric': 0.11582520152736529, 'fraction_numerical': 0.010182435299109036, 'mean_word_length': 3.3983208955223883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1593456', 'n_tokens_mistral': 1786, 'n_tokens_neox': 1677, 'n_words': 271}