mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 02:11:58 +08:00
[cppunit] add linux support and bump version to 1.15.1 (#15018)
This commit is contained in:
parent
6d84d56cd5
commit
e2d3408547
@ -51,7 +51,6 @@ In the `ports/` directory are many libraries that can be used as examples, inclu
|
||||
- rapidjson
|
||||
- range-v3
|
||||
- MSBuild-based
|
||||
- cppunit
|
||||
- mpg123
|
||||
- Non-CMake, custom buildsystem
|
||||
- openssl
|
||||
|
@ -70,7 +70,6 @@ In the `ports/` directory are many libraries that can be used as examples, inclu
|
||||
- rapidjson
|
||||
- range-v3
|
||||
- MSBuild-based
|
||||
- cppunit
|
||||
- mpg123
|
||||
- Non-CMake, custom buildsystem
|
||||
- openssl
|
||||
|
@ -59,7 +59,6 @@ Additional options passed to msbuild for Debug builds. These are in addition to
|
||||
## Examples
|
||||
|
||||
* [chakracore](https://github.com/Microsoft/vcpkg/blob/master/ports/chakracore/portfile.cmake)
|
||||
* [cppunit](https://github.com/Microsoft/vcpkg/blob/master/ports/cppunit/portfile.cmake)
|
||||
|
||||
## Source
|
||||
[scripts/cmake/vcpkg_build_msbuild.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_build_msbuild.cmake)
|
||||
|
@ -1,40 +0,0 @@
|
||||
diff --git a/src/cppunit/cppunit.vcxproj b/src/cppunit/cppunit.vcxproj
|
||||
index 0367d20..f799518 100644
|
||||
--- a/src/cppunit/cppunit.vcxproj
|
||||
+++ b/src/cppunit/cppunit.vcxproj
|
||||
@@ -84,7 +84,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@@ -119,7 +119,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@@ -154,7 +154,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@@ -189,7 +189,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
51
ports/cppunit/CMakeLists.txt
Normal file
51
ports/cppunit/CMakeLists.txt
Normal file
@ -0,0 +1,51 @@
|
||||
project(cppunit)
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin"
|
||||
CACHE PATH "Installation directory for executables"
|
||||
)
|
||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib"
|
||||
CACHE PATH "Installation directory for libraries"
|
||||
)
|
||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include"
|
||||
CACHE PATH "Installation directory for headers"
|
||||
)
|
||||
|
||||
file(GLOB CPPUNIT_SRC RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/cppunit/*.cpp")
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
set(DLLPLUGINTESTER_SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/DllPlugInTester/CommandLineParser.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/DllPlugInTester/DllPlugInTester.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/DllPlugInTester)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(cppunit SHARED ${CPPUNIT_SRC})
|
||||
add_definitions(-DCPPUNIT_BUILD_DLL)
|
||||
else()
|
||||
add_library(cppunit STATIC ${CPPUNIT_SRC})
|
||||
endif()
|
||||
|
||||
add_executable(DllPlugInTester ${DLLPLUGINTESTER_SRC})
|
||||
target_link_libraries(DllPlugInTester cppunit)
|
||||
|
||||
install(TARGETS cppunit
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
|
||||
)
|
||||
|
||||
install(TARGETS DllPlugInTester
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
)
|
||||
|
||||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/cppunit"
|
||||
DESTINATION "${INSTALL_INC_DIR}"
|
||||
)
|
@ -1,3 +0,0 @@
|
||||
Source: cppunit
|
||||
Version: 1.14.0-1
|
||||
Description: CppUnit is the C++ port of the famous JUnit framework for unit testing. Test output is in XML for automatic testing and GUI based for supervised tests.
|
83
ports/cppunit/CppUnitConfig.cmake
Normal file
83
ports/cppunit/CppUnitConfig.cmake
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
find_path(CppUnit_INCLUDE_DIR TestCase.h PATH_SUFFIXES cppunit)
|
||||
find_library(CppUnit_LIBRARY_RELEASE NAMES cppunit PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH)
|
||||
find_library(CppUnit_LIBRARY_DEBUG NAMES cppunitd cppunit PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH)
|
||||
select_library_configurations(CppUnit)
|
||||
|
||||
if(NOT CppUnit_LIBRARY)
|
||||
set(CppUnit_FOUND FALSE)
|
||||
set(CPPUNIT_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
find_file(CppUnit_LIBRARY_RELEASE_DLL NAMES cppunit.dll PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin" NO_DEFAULT_PATH)
|
||||
find_file(CppUnit_LIBRARY_DEBUG_DLL NAMES cppunitd.dll PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/bin" NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
# Manage Release Windows shared
|
||||
if(EXISTS "${CppUnit_LIBRARY_RELEASE_DLL}")
|
||||
add_library(CppUnit SHARED IMPORTED)
|
||||
set_target_properties(CppUnit PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS Release
|
||||
IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE_DLL}"
|
||||
IMPORTED_IMPLIB_RELEASE "${CppUnit_LIBRARY_RELEASE}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Manage Debug Windows shared
|
||||
if(EXISTS "${CppUnit_LIBRARY_DEBUG_DLL}")
|
||||
if(EXISTS "${CppUnit_LIBRARY_RELEASE_DLL}")
|
||||
set_target_properties(CppUnit PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS "Release;Debug"
|
||||
IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE_DLL}"
|
||||
IMPORTED_IMPLIB_RELEASE "${CppUnit_LIBRARY_RELEASE}"
|
||||
IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG_DLL}"
|
||||
IMPORTED_IMPLIB_DEBUG "${CppUnit_LIBRARY_DEBUG}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}"
|
||||
)
|
||||
else()
|
||||
add_library(CppUnit SHARED IMPORTED)
|
||||
set_target_properties(CppUnit PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS Debug
|
||||
IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG_DLL"
|
||||
IMPORTED_IMPLIB_DEBUG "${CppUnit_LIBRARY_DEBUG}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Manage Release Windows static and Linux shared/static
|
||||
if((NOT EXISTS "${CppUnit_LIBRARY_RELEASE_DLL}") AND (EXISTS "${CppUnit_LIBRARY_RELEASE}"))
|
||||
add_library(CppUnit UNKNOWN IMPORTED)
|
||||
set_target_properties(CppUnit PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS Release
|
||||
IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Manage Debug Windows static and Linux shared/static
|
||||
if((NOT EXISTS "${CppUnit_LIBRARY_DEBUG_DLL}") AND (EXISTS "${CppUnit_LIBRARY_DEBUG}"))
|
||||
if(EXISTS "${CppUnit_LIBRARY_RELEASE}")
|
||||
set_target_properties(CppUnit PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS "Release;Debug"
|
||||
IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE}"
|
||||
IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}"
|
||||
)
|
||||
else()
|
||||
add_library(CppUnit UNKNOWN IMPORTED)
|
||||
set_target_properties(CppUnit PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS Debug
|
||||
IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CppUnit_FOUND TRUE)
|
||||
set(CPPUNIT_FOUND TRUE)
|
@ -1,56 +1,65 @@
|
||||
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
message(FATAL_ERROR "\n${PORT} does not support your system, only Windows for now. Please open a ticket issue on github.com/microsoft/vcpkg if necessary\n")
|
||||
endif()
|
||||
|
||||
set(VERSION 1.14.0)
|
||||
if (VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
set(STATIC_PATCH "0001-static-crt-linkage.patch")
|
||||
endif()
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://dev-www.libreoffice.org/src/cppunit-${VERSION}.tar.gz"
|
||||
FILENAME "cppunit-${VERSION}.tar.gz"
|
||||
SHA512 4ea1da423c6f7ab37e4144689f593396829ce74d43872d6b10709c1ad5fbda4ee945842f7e9803592520ef81ac713e95a3fe130295bf048cd32a605d1959882e
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
PATCHES
|
||||
${STATIC_PATCH}
|
||||
)
|
||||
|
||||
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
|
||||
set(BUILD_ARCH "Win32")
|
||||
set(OUTPUT_DIR "Win32")
|
||||
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
|
||||
set(BUILD_ARCH "x64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
|
||||
endif()
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
vcpkg_build_msbuild(
|
||||
PROJECT_PATH ${SOURCE_PATH}/src/cppunit/cppunit_dll.vcxproj
|
||||
PLATFORM ${BUILD_ARCH})
|
||||
elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
vcpkg_build_msbuild(
|
||||
PROJECT_PATH ${SOURCE_PATH}/src/cppunit/cppunit.vcxproj
|
||||
PLATFORM ${BUILD_ARCH})
|
||||
endif()
|
||||
|
||||
file(COPY ${SOURCE_PATH}/include/cppunit DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
file(COPY ${SOURCE_PATH}/lib/cppunitd_dll.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(COPY ${SOURCE_PATH}/lib/cppunitd_dll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
file(COPY ${SOURCE_PATH}/lib/cppunit_dll.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(COPY ${SOURCE_PATH}/lib/cppunit_dll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
||||
elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(COPY ${SOURCE_PATH}/lib/cppunitd.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
file(COPY ${SOURCE_PATH}/lib/cppunit.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppunit RENAME copyright)
|
||||
# UWP is not supported
|
||||
vcpkg_fail_port_install(ON_TARGET "uwp")
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://dev-www.libreoffice.org/src/cppunit-1.15.1.tar.gz"
|
||||
FILENAME "cppunit-1.15.1.tar.gz"
|
||||
SHA512 0feb47faec451357bb4c4e287efa17bb60fd3ad966d5350e9f25b414aaab79e94921024b0c0497672f8d3eeb22a599213d2d71d9e1d28b243b3e37f3a9a43691
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
# Use a simple CMakeLists.txt to build CppUnit on windows
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
# Move EXE to 'tools'
|
||||
vcpkg_copy_tools(TOOL_NAMES DllPlugInTester AUTO_CLEAN)
|
||||
else()
|
||||
# Use a configure on unix. It should be doable to use the cmake, but may require some patching
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(LINKAGE_DYNAMIC yes)
|
||||
set(LINKAGE_STATIC no)
|
||||
else()
|
||||
set(LINKAGE_DYNAMIC no)
|
||||
set(LINKAGE_STATIC yes)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
AUTOCONFIG
|
||||
OPTIONS
|
||||
"--enable-shared=${LINKAGE_DYNAMIC}"
|
||||
"--enable-static=${LINKAGE_STATIC}"
|
||||
"--prefix=${CURRENT_INSTALLED_DIR}"
|
||||
"--disable-doxygen"
|
||||
OPTIONS_DEBUG
|
||||
"--enable-debug"
|
||||
)
|
||||
|
||||
vcpkg_install_make()
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
# Install CppUnitConfig.cmake
|
||||
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/CppUnitConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
||||
# Cleanup
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
)
|
7
ports/cppunit/vcpkg.json
Normal file
7
ports/cppunit/vcpkg.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "cppunit",
|
||||
"version-string": "1.15.1",
|
||||
"description": "Unit testing framework module for the C++ programming language",
|
||||
"homepage": "https://www.freedesktop.org/wiki/Software/cppunit",
|
||||
"supports": "!uwp"
|
||||
}
|
@ -148,11 +148,6 @@ cpp-netlib:x64-uwp=fail
|
||||
cppcoro:x64-linux=fail
|
||||
cppcoro:arm-uwp=fail
|
||||
cppcoro:x64-uwp=fail
|
||||
cppunit:arm64-windows=fail
|
||||
cppunit:arm-uwp=fail
|
||||
cppunit:x64-linux=fail
|
||||
cppunit:x64-osx=fail
|
||||
cppunit:x64-uwp=fail
|
||||
cpuinfo:arm64-windows=fail
|
||||
crashpad:arm64-windows=fail
|
||||
crashpad:arm-uwp=fail
|
||||
|
@ -60,7 +60,6 @@ Additional options passed to msbuild for Debug builds. These are in addition to
|
||||
## Examples
|
||||
|
||||
* [chakracore](https://github.com/Microsoft/vcpkg/blob/master/ports/chakracore/portfile.cmake)
|
||||
* [cppunit](https://github.com/Microsoft/vcpkg/blob/master/ports/cppunit/portfile.cmake)
|
||||
#]===]
|
||||
|
||||
function(vcpkg_build_msbuild)
|
||||
|
Loading…
x
Reference in New Issue
Block a user