mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
cmake: Better handling of CMAKE_BUILD_TYPE
There are four main variable for CMAKE_BUILD_TYPE, 'Debug', 'Release', 'RelWithDebInfo' and 'MinSizeRel'. Additionally there is 'None' which acts as a plain build.
This commit is contained in:
parent
e25cb4f111
commit
72062a142e
|
@ -163,6 +163,25 @@ if(MUPENPLUSAPI_GLIDENUI OR NOT MUPENPLUSAPI)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Build type
|
||||||
|
|
||||||
|
if( NOT CMAKE_BUILD_TYPE)
|
||||||
|
set( CMAKE_BUILD_TYPE Release)
|
||||||
|
endif( NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||||
|
set(GLIDEN64_BUILD_TYPE Release)
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(GLIDEN64_BUILD_TYPE Debug)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set( DEBUG_BUILD TRUE)
|
||||||
|
add_definitions(
|
||||||
|
-DGL_DEBUG
|
||||||
|
)
|
||||||
|
endif( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
#check if we're running on Raspberry Pi
|
#check if we're running on Raspberry Pi
|
||||||
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA)
|
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA)
|
||||||
message("bcm_host.h found")
|
message("bcm_host.h found")
|
||||||
|
@ -365,7 +384,7 @@ if(ANDROID)
|
||||||
SHARED
|
SHARED
|
||||||
IMPORTED )
|
IMPORTED )
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
set( BUILD_VARIANT "debug" )
|
set( BUILD_VARIANT "debug" )
|
||||||
else()
|
else()
|
||||||
set( BUILD_VARIANT "release" )
|
set( BUILD_VARIANT "release" )
|
||||||
|
@ -444,19 +463,12 @@ if(X86_OPT)
|
||||||
)
|
)
|
||||||
endif(X86_OPT)
|
endif(X86_OPT)
|
||||||
|
|
||||||
# Build type
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if( NOT CMAKE_BUILD_TYPE)
|
|
||||||
set( CMAKE_BUILD_TYPE Release)
|
|
||||||
endif( NOT CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set( CMAKE_BUILD_TYPE Debug)
|
|
||||||
set( DEBUG_BUILD TRUE)
|
set( DEBUG_BUILD TRUE)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DGL_DEBUG
|
-DGL_DEBUG
|
||||||
)
|
)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
endif( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if(GL_PROFILE)
|
if(GL_PROFILE)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
|
@ -502,12 +514,33 @@ set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||||
|
|
||||||
add_library( ${GLideN64_DLL_NAME} SHARED ${GLideN64_SOURCES} ${PATH_REVISION})
|
add_library( ${GLideN64_DLL_NAME} SHARED ${GLideN64_SOURCES} ${PATH_REVISION})
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
set_target_properties(
|
||||||
SET_TARGET_PROPERTIES(
|
|
||||||
${GLideN64_DLL_NAME}
|
${GLideN64_DLL_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
|
LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
|
)
|
||||||
|
|
||||||
|
if(GLIDEN64_BUILD_TYPE STREQUAL "Release")
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT result)
|
||||||
|
if(result)
|
||||||
|
message("Interprocedural optimizations enabled")
|
||||||
|
set_property(TARGET ${GLideN64_DLL_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -O3")
|
||||||
|
endif()
|
||||||
|
SET_TARGET_PROPERTIES(
|
||||||
|
${GLideN64_DLL_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/Release
|
||||||
|
)
|
||||||
|
|
||||||
|
endif(GLIDEN64_BUILD_TYPE STREQUAL "Release")
|
||||||
|
|
||||||
|
if(GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
SET_TARGET_PROPERTIES(
|
||||||
|
${GLideN64_DLL_NAME}
|
||||||
|
PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/Debug
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/Debug
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -524,39 +557,21 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osald GLideNHQd )
|
target_link_libraries(${GLideN64_DLL_NAME} PRIVATE ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osald GLideNHQd )
|
||||||
endif (NOHQ)
|
endif (NOHQ)
|
||||||
endif(SDL)
|
endif(SDL)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
else(GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
||||||
include(CheckIPOSupported)
|
|
||||||
check_ipo_supported(RESULT result)
|
|
||||||
if(result)
|
|
||||||
message("Interprocedural optimizations enabled")
|
|
||||||
set_property(TARGET ${GLideN64_DLL_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -O3")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(
|
|
||||||
${GLideN64_DLL_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
|
|
||||||
PREFIX ""
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/Release
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SDL)
|
if(SDL)
|
||||||
if (NOHQ)
|
if (NOHQ)
|
||||||
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal )
|
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal )
|
||||||
else (NOHQ)
|
else (NOHQ)
|
||||||
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal GLideNHQ )
|
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal GLideNHQ )
|
||||||
endif (NOHQ)
|
endif (NOHQ)
|
||||||
else(SDL)
|
else(SDL)
|
||||||
if (NOHQ)
|
if (NOHQ)
|
||||||
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal )
|
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal )
|
||||||
else (NOHQ)
|
else (NOHQ)
|
||||||
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal GLideNHQ )
|
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${FREETYPE_LIBRARIES} ${LOG_LIB} ${GLIDENUI_LIBRARIES} osal GLideNHQ )
|
||||||
endif (NOHQ)
|
endif (NOHQ)
|
||||||
endif(SDL)
|
endif(SDL)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
endif(GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
install(TARGETS ${GLideN64_DLL_NAME}
|
install(TARGETS ${GLideN64_DLL_NAME}
|
||||||
|
|
|
@ -54,17 +54,12 @@ endif(WIN32)
|
||||||
|
|
||||||
# Build type
|
# Build type
|
||||||
|
|
||||||
if( NOT CMAKE_BUILD_TYPE)
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
set( CMAKE_BUILD_TYPE Release)
|
|
||||||
endif( NOT CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set( CMAKE_BUILD_TYPE Debug)
|
|
||||||
set( DEBUG_BUILD TRUE)
|
set( DEBUG_BUILD TRUE)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DDEBUG
|
-DDEBUG
|
||||||
)
|
)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
endif( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
add_definitions( -D__MSC__)
|
add_definitions( -D__MSC__)
|
||||||
|
@ -81,12 +76,12 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions( -DTXFILTER_LIB)
|
add_definitions( -DTXFILTER_LIB)
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
SET( BUILD_VARIANT "debug" )
|
SET( BUILD_VARIANT "debug" )
|
||||||
else()
|
else()
|
||||||
SET( BUILD_VARIANT "release" )
|
SET( BUILD_VARIANT "release" )
|
||||||
endif()
|
endif()
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES})
|
add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES})
|
||||||
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1)
|
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||||
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1)
|
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||||
|
@ -113,9 +108,7 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
osald
|
osald
|
||||||
)
|
)
|
||||||
endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS)
|
endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
else( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
||||||
add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES})
|
add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES})
|
||||||
|
|
||||||
# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1)
|
# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||||
|
@ -152,4 +145,4 @@ if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
osal
|
osal
|
||||||
)
|
)
|
||||||
endif(PANDORA)
|
endif(PANDORA)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
endif( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
|
@ -28,17 +28,12 @@ endif(WIN32)
|
||||||
|
|
||||||
# Build type
|
# Build type
|
||||||
|
|
||||||
if( NOT CMAKE_BUILD_TYPE)
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
set( CMAKE_BUILD_TYPE Release)
|
|
||||||
endif( NOT CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set( CMAKE_BUILD_TYPE Debug)
|
|
||||||
set( DEBUG_BUILD TRUE)
|
set( DEBUG_BUILD TRUE)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DDEBUG
|
-DDEBUG
|
||||||
)
|
)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
endif( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
add_definitions( -D__MSC__)
|
add_definitions( -D__MSC__)
|
||||||
|
@ -53,10 +48,8 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQ
|
||||||
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static ${PIC_FLAGS} " )
|
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static ${PIC_FLAGS} " )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_library( osald STATIC ${OSAL_SOURCES})
|
add_library( osald STATIC ${OSAL_SOURCES})
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
else( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
||||||
add_library( osal STATIC ${OSAL_SOURCES})
|
add_library( osal STATIC ${OSAL_SOURCES})
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
endif( GLIDEN64_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user