Skip to content

Commit

Permalink
cmake: Move generated files under build directory
Browse files Browse the repository at this point in the history
Also fixes `PKG_SUFFIX` was not set correctly by `option`.
  • Loading branch information
norihiro committed May 6, 2024
1 parent 2dda3ff commit c8283f2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
path: '${{ env.FILE_NAME }}'
- name: Check package
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
set -ex
sudo apt install '${{ env.FILE_NAME }}'
case ${{ matrix.obs }} in
Expand Down Expand Up @@ -190,12 +190,11 @@ jobs:
-D PKG_SUFFIX=$PKG_SUFFIX \
"${cmake_opt[@]}"
cmake --build build --config RelWithDebInfo
echo "PKG_SUFFIX='$PKG_SUFFIX'" >> ci/ci_includes.generated.sh
- name: Prepare package
run: |
set -ex
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
cmake --install build --config RelWithDebInfo --prefix=release
case ${{ matrix.obs }} in
27)
Expand All @@ -211,7 +210,7 @@ jobs:
- name: Codesign
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
set -ex
case ${{ matrix.obs }} in
27)
Expand All @@ -236,7 +235,7 @@ jobs:
- name: Package
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
set -ex
zipfile=$PWD/package/${PLUGIN_NAME}${PKG_SUFFIX}.zip
mkdir package
Expand All @@ -252,10 +251,10 @@ jobs:
- name: Productsign
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
pkgfile=package/${PLUGIN_NAME}${PKG_SUFFIX}.pkg
set -e
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
productsign --sign "${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" $pkgfile package/${PLUGIN_NAME}-signed.pkg
mv package/${PLUGIN_NAME}-signed.pkg $pkgfile
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@

.vscode
.idea

# ignore generated files
*.generated.*
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ include(cmake/ObsPluginHelpers.cmake)

configure_file(
src/plugin-macros.h.in
../src/plugin-macros.generated.h
plugin-macros.generated.h
)
configure_file(
installer/installer-Windows.iss.in
../installer/installer-Windows.generated.iss
installer-Windows.generated.iss
)

configure_file(
ci/ci_includes.sh.in
../ci/ci_includes.generated.sh
ci/ci_includes.generated.sh
)
configure_file(
ci/ci_includes.cmd.in
../ci/ci_includes.generated.cmd
ci/ci_includes.generated.cmd
)

set(PLUGIN_SOURCES
Expand All @@ -55,7 +55,10 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
OBS::libobs
)

target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE vban)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
vban
${CMAKE_CURRENT_BINARY_DIR}
)

if(OS_WINDOWS)
# Enable Multicore Builds and disable FH4 (to not depend on VCRUNTIME140_1.DLL when building with VS2019)
Expand Down
3 changes: 2 additions & 1 deletion ci/ci_includes.sh.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PLUGIN_NAME="@CMAKE_PROJECT_NAME@"
PLUGIN_VERSION="@CMAKE_PROJECT_VERSION@"
MACOS_BUNDLEID="@MACOS_BUNDLEID@"
LINUX_MAINTAINER_EMAIL="@LINUX_MAINTAINER_EMAIL@"
LINUX_MAINTAINER_EMAIL="@LINUX_MAINTAINER_EMAIL@"
PKG_SUFFIX='@PKG_SUFFIX@'
4 changes: 2 additions & 2 deletions ci/windows/package-windows.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
call "%~dp0..\ci_includes.generated.cmd"
call "build\ci\ci_includes.generated.cmd"

mkdir package
cd package
Expand All @@ -13,7 +13,7 @@ REM Package ZIP archive
7z a "%PluginName%-%PackageVersion%-obs%1-Windows.zip" "..\release\*"

REM Build installer
iscc ..\installer\installer-Windows.generated.iss /O. /F"%PluginName%-%PackageVersion%-obs%1-Windows-Installer"
iscc ..\build\installer-Windows.generated.iss /O. /F"%PluginName%-%PackageVersion%-obs%1-Windows-Installer"

certutil.exe -hashfile "%PluginName%-%PackageVersion%-obs%1-Windows.zip" SHA1
certutil.exe -hashfile "%PluginName%-%PackageVersion%-obs%1-Windows-Installer.exe" SHA1
2 changes: 1 addition & 1 deletion cmake/ObsPluginHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ else()
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${LINUX_MAINTAINER_EMAIL}")
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}")
option(PKG_SUFFIX "Suffix of package name" "-linux-x86_64")
set(PKG_SUFFIX "-linux-x86_64" CACHE STRING "Suffix of package name")
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}${PKG_SUFFIX}")

Expand Down

0 comments on commit c8283f2

Please sign in to comment.