aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordweckmann <didier.weckmann@ircad.fr>2020-12-29 04:35:08 +0100
committerGitHub <noreply@github.com>2020-12-28 19:35:08 -0800
commite2d34085478b0a8d13120287894a52b7e104fd3f (patch)
tree484cf0ca53f090785569cde02679566a9e5f0aa1
parent6d84d56cd5ebc4c61ad093bd4de803ac3fea412f (diff)
downloadvcpkg-e2d34085478b0a8d13120287894a52b7e104fd3f.tar.gz
vcpkg-e2d34085478b0a8d13120287894a52b7e104fd3f.zip
[cppunit] add linux support and bump version to 1.15.1 (#15018)
-rw-r--r--docs/examples/packaging-github-repos.md1
-rw-r--r--docs/examples/packaging-zipfiles.md1
-rw-r--r--docs/maintainers/vcpkg_build_msbuild.md1
-rw-r--r--ports/cppunit/0001-static-crt-linkage.patch40
-rw-r--r--ports/cppunit/CMakeLists.txt51
-rw-r--r--ports/cppunit/CONTROL3
-rw-r--r--ports/cppunit/CppUnitConfig.cmake83
-rw-r--r--ports/cppunit/portfile.cmake121
-rw-r--r--ports/cppunit/vcpkg.json7
-rw-r--r--scripts/ci.baseline.txt5
-rw-r--r--scripts/cmake/vcpkg_build_msbuild.cmake1
11 files changed, 206 insertions, 108 deletions
diff --git a/docs/examples/packaging-github-repos.md b/docs/examples/packaging-github-repos.md
index 287354ff2..4d9f7e11a 100644
--- a/docs/examples/packaging-github-repos.md
+++ b/docs/examples/packaging-github-repos.md
@@ -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
diff --git a/docs/examples/packaging-zipfiles.md b/docs/examples/packaging-zipfiles.md
index 9ece22d93..334316403 100644
--- a/docs/examples/packaging-zipfiles.md
+++ b/docs/examples/packaging-zipfiles.md
@@ -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
diff --git a/docs/maintainers/vcpkg_build_msbuild.md b/docs/maintainers/vcpkg_build_msbuild.md
index 9f458f352..47fb6855d 100644
--- a/docs/maintainers/vcpkg_build_msbuild.md
+++ b/docs/maintainers/vcpkg_build_msbuild.md
@@ -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)
diff --git a/ports/cppunit/0001-static-crt-linkage.patch b/ports/cppunit/0001-static-crt-linkage.patch
deleted file mode 100644
index f058c32f9..000000000
--- a/ports/cppunit/0001-static-crt-linkage.patch
+++ /dev/null
@@ -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>
diff --git a/ports/cppunit/CMakeLists.txt b/ports/cppunit/CMakeLists.txt
new file mode 100644
index 000000000..68b684db8
--- /dev/null
+++ b/ports/cppunit/CMakeLists.txt
@@ -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}"
+)
diff --git a/ports/cppunit/CONTROL b/ports/cppunit/CONTROL
deleted file mode 100644
index 9c3dee7b6..000000000
--- a/ports/cppunit/CONTROL
+++ /dev/null
@@ -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. \ No newline at end of file
diff --git a/ports/cppunit/CppUnitConfig.cmake b/ports/cppunit/CppUnitConfig.cmake
new file mode 100644
index 000000000..b3e6146d1
--- /dev/null
+++ b/ports/cppunit/CppUnitConfig.cmake
@@ -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) \ No newline at end of file
diff --git a/ports/cppunit/portfile.cmake b/ports/cppunit/portfile.cmake
index ab41ffcaf..85beec692 100644
--- a/ports/cppunit/portfile.cmake
+++ b/ports/cppunit/portfile.cmake
@@ -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"
+) \ No newline at end of file
diff --git a/ports/cppunit/vcpkg.json b/ports/cppunit/vcpkg.json
new file mode 100644
index 000000000..3dbcc9ccf
--- /dev/null
+++ b/ports/cppunit/vcpkg.json
@@ -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"
+}
diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt
index 61caf3bfa..f8f070c72 100644
--- a/scripts/ci.baseline.txt
+++ b/scripts/ci.baseline.txt
@@ -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
diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake
index a682c6a17..a19f73dce 100644
--- a/scripts/cmake/vcpkg_build_msbuild.cmake
+++ b/scripts/cmake/vcpkg_build_msbuild.cmake
@@ -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)