diff --git a/.devcontainer b/.devcontainer new file mode 160000 index 0000000..b271b77 --- /dev/null +++ b/.devcontainer @@ -0,0 +1 @@ +Subproject commit b271b77337fe6c0b6508babb04bc669c00611320 diff --git a/.github/workflows/xpbuild.yml b/.github/workflows/xpbuild.yml new file mode 100644 index 0000000..169ff52 --- /dev/null +++ b/.github/workflows/xpbuild.yml @@ -0,0 +1,30 @@ +name: Build +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + workflow_dispatch: +jobs: + linux: + uses: externpro/externpro/.github/workflows/build-linux.yml@25.06 + with: + cmake-workflow-preset: Linux + runon: ubuntu-latest + secrets: inherit + linux-arm64: + uses: externpro/externpro/.github/workflows/build-linux.yml@25.06 + with: + cmake-workflow-preset: Linux + runon: ubuntu-24.04-arm + secrets: inherit + macos: + uses: externpro/externpro/.github/workflows/build-macos.yml@25.06 + with: + cmake-workflow-preset: Darwin + secrets: inherit + windows: + uses: externpro/externpro/.github/workflows/build-windows.yml@25.06 + with: + cmake-workflow-preset: Windows + secrets: inherit diff --git a/.github/workflows/xprelease.yml b/.github/workflows/xprelease.yml new file mode 100644 index 0000000..1461914 --- /dev/null +++ b/.github/workflows/xprelease.yml @@ -0,0 +1,20 @@ +name: Release +on: + workflow_dispatch: + inputs: + workflow_run_url: + description: 'URL of the workflow run containing artifacts to upload (e.g., https://github.com/owner/repo/actions/runs/123456789)' + required: true + type: string +jobs: + # Upload build artifacts as release assets + release-from-build: + uses: externpro/externpro/.github/workflows/release-from-build.yml@25.06 + with: + workflow_run_url: ${{ github.event.inputs.workflow_run_url }} + artifact_pattern: "*.tar.xz" + permissions: + contents: write + id-token: write + attestations: write + secrets: inherit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1fc17fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +_bld*/ +docker-compose.override.yml diff --git a/.gitmodules b/.gitmodules index 32ec896..6855a39 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "lossless"] path = lossless url = https://github.com/externpro/libjpeg.git +[submodule ".devcontainer"] + path = .devcontainer + url = https://github.com/externpro/externpro diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a5aa75..c11a9d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.31) +set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake) project(jpegxp) include(GNUInstallDirs) include(xpflags) @@ -151,17 +152,20 @@ if(MSVC) target_compile_definitions(${lib_name} PRIVATE -D_CRT_SECURE_NO_WARNINGS) endif() ####################################### +set(lib ${lib_name}) +if(DEFINED XP_NAMESPACE) + set(nameSpace NAMESPACE ${XP_NAMESPACE}::) + string(PREPEND lib ${XP_NAMESPACE}::) +endif() +if(NOT DEFINED XP_INSTALL_CMAKEDIR) + set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake) +endif() set(targetsFile ${PROJECT_NAME}-targets) +xpPackageDevel(TARGETS_FILE ${targetsFile} LIBRARIES ${lib}) install(TARGETS ${lib_name} EXPORT ${targetsFile} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(FILES ${include_srcs} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) -if(DEFINED XP_NAMESPACE) - set(nameSpace NAMESPACE ${XP_NAMESPACE}::) -endif() -if(NOT DEFINED XP_INSTALL_CMAKEDIR) - set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake) -endif() install(EXPORT ${targetsFile} DESTINATION ${XP_INSTALL_CMAKEDIR} ${nameSpace}) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..f82cfdd --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,8 @@ +{ + "version": 8, + "include": [ + ".devcontainer/cmake/presets/xpLinuxNinja.json", + ".devcontainer/cmake/presets/xpDarwinNinja.json", + ".devcontainer/cmake/presets/xpWindowsVs2022.json" + ] +} diff --git a/CMakePresetsBase.json b/CMakePresetsBase.json new file mode 100644 index 0000000..4489d79 --- /dev/null +++ b/CMakePresetsBase.json @@ -0,0 +1,19 @@ +{ + "version": 8, + "configurePresets": [ + { + "name": "config-base", + "hidden": true, + "binaryDir": "${sourceDir}/_bld-${presetName}", + "cacheVariables": { + "XP_NAMESPACE": "xpro" + } + } + ], + "buildPresets": [ + { + "name": "build-base", + "hidden": true + } + ] +} diff --git a/docker-compose.sh b/docker-compose.sh new file mode 120000 index 0000000..85f182f --- /dev/null +++ b/docker-compose.sh @@ -0,0 +1 @@ +.devcontainer/compose.pro.sh \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 120000 index 0000000..46c1f89 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1 @@ +.devcontainer/compose.bld.yml \ No newline at end of file