Skip to content

Commit

Permalink
Add VCPKG Support for building
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Sep 18, 2024
1 parent fc0a3ed commit 606b2a5
Show file tree
Hide file tree
Showing 11 changed files with 412 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,10 @@ option(EbsdLib_BUILD_TOOLS "Build example applications" ON)
if(EbsdLib_BUILD_TOOLS)
include(${EbsdLibProj_SOURCE_DIR}/Source/Apps/SourceList.cmake)
endif()


# -----------------------------------------------------------------------
# Include the packaging Cmake codes
# -----------------------------------------------------------------------
include(${EbsdLibProj_SOURCE_DIR}/cmake/Packaging.cmake)

244 changes: 244 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 24,
"patch": 0
},
"configurePresets": [
{
"name": "ci",
"displayName": "CI build",
"description": "Build configuration for Azure CI",
"generator": "Ninja",
"binaryDir": "${sourceDir}/../DREAM3D-Build/EbsdLib-CI",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
"CMAKE_OSX_DEPLOYMENT_TARGET": {
"type": "STRING",
"value": "11.0"
},
"VCPKG_MANIFEST_DIR": {
"type": "STRING",
"value": "${sourceDir}/"
},
"VCPKG_INSTALLED_DIR": {
"type": "STRING",
"value": "${sourceDir}/../vcpkg-installed"
},
"VCPKG_MANIFEST_INSTALL": {
"type": "BOOL",
"value": "ON"
},
"VCPKG_OVERLAY_TRIPLETS": {
"type": "PATH",
"value": "${sourceDir}/cmake/triplets"
},
"VCPKG_APPLOCAL_DEPS": {
"type": "BOOL",
"value": "OFF"
},
"VCPKG_MANIFEST_FEATURES": {
"type": "STRING",
"value": "parallel"
},
"EbsdLib_ENABLE_HDF5": {
"type": "BOOL",
"value": "ON"
},
"EbsdLib_BUILD_H5SUPPORT": {
"type": "BOOL",
"value": "OFF"
}
}
},
{
"name": "ci-windows-v142",
"displayName": "ci-windows-v142",
"description": "Build configuration for GitHub Actions CI",
"generator": "Visual Studio 17 2022",
"inherits": "ci",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-v142"
},
"VCPKG_HOST_TRIPLET": {
"type": "STRING",
"value": "x64-windows-v142"
}
}
},
{
"name": "ci-windows-v143",
"displayName": "ci-windows-v143",
"description": "Build configuration for GitHub Actions CI",
"generator": "Visual Studio 17 2022",
"inherits": "ci",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-v143"
},
"VCPKG_HOST_TRIPLET": {
"type": "STRING",
"value": "x64-windows-v143"
}
}
},
{
"name": "ci-macos-x64",
"displayName": "ci-macos-x64",
"description": "Build configuration for GitHub Actions CI",
"generator": "Ninja",
"inherits": "ci",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-osx-v11"
},
"VCPKG_HOST_TRIPLET": {
"type": "STRING",
"value": "x64-osx-v11"
}
}
},
{
"name": "ci-macos-arm64",
"displayName": "ci-macos-arm64",
"description": "Build configuration for GitHub Actions CI",
"generator": "Ninja",
"inherits": "ci",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "arm64-osx-dynamic"
},
"VCPKG_HOST_TRIPLET": {
"type": "STRING",
"value": "arm64-osx-dynamic"
}
},
"environment": {
"VCPKG_INSTALLATION_ROOT": "/opt/local/vcpkg"
}
},
{
"name": "ci-linux-x64",
"displayName": "ci-linux-x64",
"description": "Build configuration for GitHub Actions CI",
"generator": "Ninja",
"inherits": "ci",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-linux-dynamic"
},
"VCPKG_HOST_TRIPLET": {
"type": "STRING",
"value": "x64-linux-dynamic"
},
"CMAKE_MAKE_PROGRAM": {
"type": "FILEPATH",
"value": "$env{VCPKG_INSTALLATION_ROOT}/downloads/tools/ninja/1.10.2-linux/ninja"
}
},
"environment": {
"VCPKG_INSTALLATION_ROOT": "/opt/local/vcpkg"
}
}
],
"buildPresets": [
{
"name": "ci-windows-v142",
"displayName": "ci-windows-v142 Release build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-windows-v142",
"configuration": "Release"
},
{
"name": "ci-windows-v143",
"displayName": "ci-windows-v143 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-windows-v143",
"configuration": "Release"
},
{
"name": "ci-macos-x64",
"displayName": "ci-macos-x64 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-macos-x64",
"configuration": "Release"
},
{
"name": "ci-macos-arm64",
"displayName": "ci-macos-arm64 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-macos-arm64",
"configuration": "Release"
},
{
"name": "ci-linux-x64",
"displayName": "ci-linux-x64 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-linux-x64",
"configuration": "Release"
}
],
"testPresets": [
{
"name": "ci-windows-v142",
"displayName": "ci-windows-v142 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-windows-v142",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-windows-v143",
"displayName": "ci-windows-v143 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-windows-v143",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-macos-x64",
"displayName": "ci-macos-x64 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-macos-x64",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-macos-arm64",
"displayName": "ci-macos-arm64 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-macos-arm64",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-linux-x64",
"displayName": "ci-linux-x64 CI build",
"description": "Build configuration for GitHub actions CI",
"configurePreset": "ci-linux-x64",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
}
]
}

24 changes: 24 additions & 0 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## enable_testing()
## include(CTest)
set(CTEST_PROJECT_NAME "DREAM3D")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")

set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=DREAM3D")
set(CTEST_DROP_SITE_CDASH TRUE)

# Use multiple CPU cores to build
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
if(CTEST_CMAKE_GENERATOR MATCHES "Make" OR CTEST_CMAKE_GENERATOR MATCHES "Ninja")
set(CTEST_BUILD_FLAGS "-j${N}")
endif()
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
endif()
10 changes: 5 additions & 5 deletions Source/Apps/SourceList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ if(EbsdLib_INSTALL_FILES)
install(FILES
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Cubic m-3 (Th)/Cubic m-3 (Th).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Cubic m-3m (Oh)/Cubic m-3m (Oh).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Hexagonal 6|m (C6h)//Hexagonal 6|m (C6h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Hexagonal 6|mmm (D6h)/Hexagonal 6|mmm (D6h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Monoclinic 2|m (C2h)/Monoclinic 2|m (C2h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Hexagonal 6_m (C6h)/Hexagonal 6_m (C6h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Hexagonal 6_mmm (D6h)/Hexagonal 6_mmm (D6h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Monoclinic 2_m (C2h)/Monoclinic 2_m (C2h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Orthorhombic mmm (D2h)/Orthorhombic mmm (D2h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Tetragonal 4|m (C4h)/Tetragonal 4|m (C4h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Tetragonal 4|mmm (D4h)//Tetragonal 4|mmm (D4h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Tetragonal 4_m (C4h)/Tetragonal 4_m (C4h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Tetragonal 4_mmm (D4h)//Tetragonal 4_mmm (D4h).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Triclinic -1 (Ci)/Triclinic -1 (Ci).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Trigonal -3 (C3i)/Trigonal -3 (C3i).tiff"
"${EbsdLibProj_SOURCE_DIR}/Data/IPF_Legend/Trigonal -3m (D3d)/Trigonal -3m (D3d).tiff"
Expand Down
49 changes: 49 additions & 0 deletions cmake/Packaging.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
set(CPACK_PACKAGE_VENDOR "BlueQuartz Software")

if(UNIX OR APPLE)
set(CPACK_BINARY_BUNDLE "OFF")
set(CPACK_BINARY_DEB "OFF")
set(CPACK_BINARY_DRAGNDROP "OFF")
set(CPACK_BINARY_FREEBSD "OFF")
set(CPACK_BINARY_IFW "OFF")
set(CPACK_BINARY_NSIS "OFF")
set(CPACK_BINARY_OSXX11 "OFF")
set(CPACK_BINARY_PACKAGEMAKER "OFF")
set(CPACK_BINARY_PRODUCTBUILD "OFF")
set(CPACK_BINARY_RPM "OFF")
set(CPACK_BINARY_STGZ "OFF")
set(CPACK_BINARY_TBZ2 "OFF")
set(CPACK_BINARY_TGZ "ON")
set(CPACK_BINARY_TXZ "OFF")
set(CPACK_BINARY_TZ "OFF")
else()
set(CPACK_BINARY_NSIS OFF)
set(CPACK_BINARY_ZIP ON)
endif()

if(WIN32)
set(EbsdLib_HOST_NAME "windows")
elseif(APPLE)
set(EbsdLib_HOST_NAME "macos")
else()
set(EbsdLib_HOST_NAME "linux")
endif()



set(EbsdLib_MAIN_PACKAGE_NAME "EbsdLib")


set(CPACK_COMPONENTS_ALL "Applications;Unspecified;license")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.github.com/bluequartzsoftware/ebsdlib")
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "EbsdLib: C++ Codes to import and analyze EBSD data.")
set(CPACK_PACKAGE_NAME "EbsdLib")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY EbsdLib)
set(CPACK_PACKAGE_FILE_NAME "EbsdLib-${EbsdLibProj_VERSION}-${EbsdLib_HOST_NAME}-${CMAKE_SYSTEM_PROCESSOR}")



# THIS MUST BE THE LAST LINE OF THIS FILE BECAUSE ALL THE CPACK VARIABLES MUST BE
# DEFINED BEFORE CPack IS INCLUDED
INCLUDE(CPack)

7 changes: 7 additions & 0 deletions cmake/triplets/arm64-osx-v11.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)
set(VCPKG_OSX_DEPLOYMENT_TARGET 11.0)
7 changes: 7 additions & 0 deletions cmake/triplets/x64-osx-v11.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)
set(VCPKG_OSX_DEPLOYMENT_TARGET 11.0)
4 changes: 4 additions & 0 deletions cmake/triplets/x64-windows-v142.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET "v142")
4 changes: 4 additions & 0 deletions cmake/triplets/x64-windows-v143.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET v143)
Loading

0 comments on commit 606b2a5

Please sign in to comment.