external/audio_codec_common.cmake
author Ozkan Sezer
Tue, 17 Dec 2019 21:56:50 +0300
changeset 1091 8a09f3c0c340
parent 1050 300088719593
permissions -rw-r--r--
add patch note for Mix_MusicDuration addition
sylvain@934
     1
if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
sylvain@934
     2
    set(EMSCRIPTEN 1)
sylvain@934
     3
endif()
sylvain@934
     4
sezeroz@1050
     5
if(MSVC)
sezeroz@1050
     6
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
sezeroz@1050
     7
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
sezeroz@1050
     8
    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
sezeroz@1050
     9
else()
sezeroz@1050
    10
    add_definitions(-Wall)
sylvain@934
    11
    if(EMSCRIPTEN)
sezeroz@1050
    12
        string(REGEX REPLACE "-O3" "-Os" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
sezeroz@1050
    13
        string(REGEX REPLACE "-O3" "-Os" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
sylvain@934
    14
    else()
sezeroz@1050
    15
        string(REGEX REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
sezeroz@1050
    16
        string(REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
sylvain@934
    17
    endif()
sylvain@934
    18
    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-omit-frame-pointer")
sylvain@934
    19
    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-omit-frame-pointer")
sylvain@934
    20
endif()
sylvain@934
    21
sylvain@934
    22
if(NOT CMAKE_BUILD_TYPE)
sylvain@934
    23
    set(CMAKE_BUILD_TYPE "Release")
sylvain@934
    24
endif()
sylvain@934
    25
sylvain@934
    26
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
sylvain@934
    27
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
sylvain@934
    28
    add_definitions(-DNDEBUG)
sylvain@934
    29
endif()
sylvain@934
    30
sylvain@934
    31
# Prevent shared libraries has "lib" prefix on Windows DLL files
sylvain@934
    32
if(WIN32)
sylvain@934
    33
    set(CMAKE_SHARED_LIBRARY_PREFIX "")
sylvain@934
    34
endif()
sylvain@934
    35