mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33:42 +00:00 
			
		
		
		
	handle the default build dir to be relative to the source dir
This commit is contained in:
		
							parent
							
								
									186353f77a
								
							
						
					
					
						commit
						584ef59aad
					
				
							
								
								
									
										14
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							@ -31,13 +31,13 @@ jobs:
 | 
				
			|||||||
        uses: ./
 | 
					        uses: ./
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          build-dir: test/build
 | 
					          build-dir: output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Run the build result
 | 
					      - name: Run the build result
 | 
				
			||||||
        run: test/build/hello_world
 | 
					        run: output/hello_world
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Check if the default build directory does not exist
 | 
					      - name: Check if the default build directory does not exist
 | 
				
			||||||
        run: test ! -d build
 | 
					        run: test ! -d build && test ! -d test/build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  additional-flags-usage:
 | 
					  additional-flags-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
 | 
					    runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
 | 
				
			||||||
@ -59,8 +59,8 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      - name: Run the build results
 | 
					      - name: Run the build results
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          ${{ matrix.compiler == 'msvc' && 'build\Debug\test_c.exe' || 'build/test_c' }}
 | 
					          ${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_c.exe' || 'test/build/test_c' }}
 | 
				
			||||||
          ${{ matrix.compiler == 'msvc' && 'build\Debug\test_cpp.exe' || 'build/test_cpp' }}
 | 
					          ${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_cpp.exe' || 'test/build/test_cpp' }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  specified-compiler-usage:
 | 
					  specified-compiler-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					    runs-on: ${{ matrix.os }}-latest
 | 
				
			||||||
@ -82,7 +82,7 @@ jobs:
 | 
				
			|||||||
          args: -D CHECK_USING_CLANG=ON
 | 
					          args: -D CHECK_USING_CLANG=ON
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Run the build results
 | 
					      - name: Run the build results
 | 
				
			||||||
        run: build/test_c && build/test_cpp
 | 
					        run: test/build/test_c && test/build/test_cpp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  specified-generator-usage:
 | 
					  specified-generator-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					    runs-on: ${{ matrix.os }}-latest
 | 
				
			||||||
@ -100,4 +100,4 @@ jobs:
 | 
				
			|||||||
          generator: Ninja
 | 
					          generator: Ninja
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Run the build result
 | 
					      - name: Run the build result
 | 
				
			||||||
        run: build/hello_world
 | 
					        run: test/build/hello_world
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										11
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								action.yml
									
									
									
									
									
								
							@ -11,7 +11,6 @@ inputs:
 | 
				
			|||||||
  build-dir:
 | 
					  build-dir:
 | 
				
			||||||
    description: Build directory of the CMake project
 | 
					    description: Build directory of the CMake project
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
    default: build
 | 
					 | 
				
			||||||
  targets:
 | 
					  targets:
 | 
				
			||||||
    description: List of build targets
 | 
					    description: List of build targets
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
@ -44,8 +43,14 @@ runs:
 | 
				
			|||||||
        if [ -n '${{ inputs.source-dir }}' ]; then
 | 
					        if [ -n '${{ inputs.source-dir }}' ]; then
 | 
				
			||||||
          SOURCE_DIR="${{ inputs.source-dir }}"
 | 
					          SOURCE_DIR="${{ inputs.source-dir }}"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        ARGS="'$SOURCE_DIR' -B '${{ inputs.build-dir }}'"
 | 
					        BUILD_DIR="build"
 | 
				
			||||||
        BUILD_ARGS="--build '${{ inputs.build-dir }}'"
 | 
					        if [ -n '${{ inputs.build-dir }}' ]; then
 | 
				
			||||||
 | 
					          BUILD_DIR="${{ inputs.build-dir }}"
 | 
				
			||||||
 | 
					        elif [ -n "${{ inputs.source-dir }}" ]; then
 | 
				
			||||||
 | 
					          BUILD_DIR="${{ inputs.source-dir }}/build"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        ARGS="'$SOURCE_DIR' -B '$BUILD_DIR'"
 | 
				
			||||||
 | 
					        BUILD_ARGS="--build '$BUILD_DIR'"
 | 
				
			||||||
        if [ -n '${{ inputs.targets }}' ]; then
 | 
					        if [ -n '${{ inputs.targets }}' ]; then
 | 
				
			||||||
          BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}"
 | 
					          BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user