Merge pull request #4808 from Orphis/cmake_cleanup

CMake cleanup: start organizing targets, remove some unwanted ones
This commit is contained in:
Mat M 2017-02-03 08:32:03 -05:00 committed by GitHub
commit 7f2bb0ba6c
4 changed files with 19 additions and 13 deletions

View File

@ -81,6 +81,9 @@ include(CheckAndAddFlag)
include(CheckCCompilerFlag)
include(DolphinCompileDefinitions)
# Enable folders for IDE
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Libraries to link
set(LIBS)
@ -567,7 +570,7 @@ if(NOT ANDROID)
option(PA_USE_ASIO "Enable PortAudio support for ASIO" OFF)
option(PA_USE_DS "Enable PortAudio support for DirectSound" OFF)
option(PA_USE_WDMKS "Enable PortAudio support for WDMKS" OFF)
add_subdirectory(Externals/portaudio)
add_subdirectory(Externals/portaudio EXCLUDE_FROM_ALL)
set(PORTAUDIO_LIBRARIES portaudio_static)
endif()
endif()

View File

@ -146,7 +146,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY)
target_link_libraries(mbedtls ${libs} mbedx509)
endif(USE_SHARED_MBEDTLS_LIBRARY)
add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls)
if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static)
endif()
#add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls)
#if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
# add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static)
#endif()

View File

@ -345,11 +345,11 @@ ELSE()
SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_LITTLE_ENDIAN)
ENDIF()
ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES} ${PA_EXTRA_SHARED_SOURCES})
SET_PROPERTY(TARGET portaudio APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(portaudio BEFORE PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
TARGET_INCLUDE_DIRECTORIES(portaudio BEFORE PUBLIC include)
TARGET_LINK_LIBRARIES(portaudio ${PA_LIBRARY_DEPENDENCIES})
#ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES} ${PA_EXTRA_SHARED_SOURCES})
#SET_PROPERTY(TARGET portaudio APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
#TARGET_INCLUDE_DIRECTORIES(portaudio BEFORE PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
#TARGET_INCLUDE_DIRECTORIES(portaudio BEFORE PUBLIC include)
#TARGET_LINK_LIBRARIES(portaudio ${PA_LIBRARY_DEPENDENCIES})
ADD_LIBRARY(portaudio_static STATIC ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES})
SET_PROPERTY(TARGET portaudio_static APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
@ -370,7 +370,7 @@ IF(WIN32 AND MSVC)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32)
ENDIF()
ENDIF()
SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX} FOLDER "Portaudio")
#SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX} FOLDER "Portaudio")
SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX} FOLDER "Portaudio")
ELSE()
IF(APPLE AND CMAKE_VERSION VERSION_GREATER 3.4.2)
@ -390,7 +390,7 @@ ELSE()
CONFIGURE_FILE(cmake_support/portaudio-2.0.pc.in ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${PA_PUBLIC_INCLUDES} DESTINATION include)
INSTALL(TARGETS portaudio DESTINATION lib)
#INSTALL(TARGETS portaudio DESTINATION lib)
ENDIF()
ENDIF()

View File

@ -13,7 +13,10 @@ macro(add_dolphin_test target srcs)
# Host_ functions.
set(srcs2 ${srcs} ${CMAKE_SOURCE_DIR}/Source/UnitTests/TestUtils/StubHost.cpp)
add_executable(Test_${target} EXCLUDE_FROM_ALL ${srcs2})
set_target_properties(Test_${target} PROPERTIES OUTPUT_NAME Tests/${target})
set_target_properties(Test_${target} PROPERTIES
OUTPUT_NAME Tests/${target}
FOLDER Tests
)
target_link_libraries(Test_${target} ${LIBS})
add_dependencies(unittests Test_${target})
add_test(NAME ${target} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests/${target})