From 098c409d4ddf1d94538061d5422b2a4b9c0113d2 Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Sun, 14 Nov 2021 17:08:37 +0900 Subject: [PATCH 1/4] Move original README.md --- README.md => README_glew.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => README_glew.md (100%) diff --git a/README.md b/README_glew.md similarity index 100% rename from README.md rename to README_glew.md From 570e4534e6519d5d37f08239cb7bac5d800d58c5 Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Sat, 4 Dec 2021 15:59:06 +0900 Subject: [PATCH 2/4] Add example --- glew-cmake/fetch-content.cmake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 glew-cmake/fetch-content.cmake diff --git a/glew-cmake/fetch-content.cmake b/glew-cmake/fetch-content.cmake new file mode 100644 index 0000000..274370a --- /dev/null +++ b/glew-cmake/fetch-content.cmake @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.4) +project(fetch_content) + +include(FetchContent) +FetchContent_Declare( + glew + GIT_REPOSITORY https://github.com/Perlmint/glew-cmake.git + GIT_TAG origin/master +) +FetchContent_GetProperties(glew) +if(NOT glew_POPULATED) + FetchContent_Populate(glew) + + add_subdirectory(${glew_SOURCE_DIR} ${glew_BINARY_DIR} EXCLUDE_FROM_ALL) +endif() + +add_executable(glewinfo glewinfo.c) +target_link_libraries(glewinfo PRIVATE libglew_static) From ec2cb231a48ecbc97a6bf5bbd7abcab2b23848e5 Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Sun, 14 Nov 2021 17:09:12 +0900 Subject: [PATCH 3/4] Add glew-cmake README --- README.md | 29 +++++++++++++++++++++++++++++ glew-cmake/maintain.sh | 7 ++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..838fd6f --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# GLEW-cmake - nightly pre-generated snapshot with old unofficial cmake support + +[GLEW](https://github.com/nigels-com/glew) is upstream of this project. +But *GLEW* repository does not contain generated sources. Only releases include generated sources. + +*GLEW-cmake* has generated sources based on the latest *GLEW*. Sources are generated nightly. +If you need only the latest snapshot of *GLEW*, try the build system of *GLEW*. It is placed under the `build` directory. Official `CMakeLists.txt` is placed in `build/cmake`. +Please check [README_glew.md](./README_glew.md) for using build system of *GLEW*. + +Also, *GLEW-cmake* has unofficial cmake support - It is created when the official CMake support of *GLEW* does not exist. +You can see some CMake script examples in [`glew-cmake`](./glew-cmake/) directory. But, I **strongly** recommend using official CMakeLists of *GLEW*. + +## Usage + +This project provide `libglew_static` and `libglew_shared` library targets and `glewinfo` and `visualinfo` executable targets. + +`libglew_static` provides a static library, and `libglew_shared` provides a shared library. +*glew-cmake* does not affected by [BUILD_SHARED_LIBS](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html). + +You can disable each library target by setting `glew-cmake_BUILD_SHARED` or `glew-cmake_BUILD_STATIC` falsy value (ex. `NO`, `FALSE`). + +If you need only libraries, Please set `ONLY_LIBS` to `ON`. Otherwise, cmake generates executable targets also. + +You can get pkg-config fils by setting `PKG_CONFIG_REPRESENTATIVE_TARGET` to `libglew_static` or `libglew_shared`. + +Simply specify dependency of your target with `libglew_static` or `libglew_shared` by `target_link_libraries`. +It will set the additional include directory & the libraries to link to your target. + +If you are not familiar with cmake, Some `sub-directory-test.cmake`, `fetch-content.cmake` in [`glew-cmake`](./glew-cmake/) could be helpful. diff --git a/glew-cmake/maintain.sh b/glew-cmake/maintain.sh index eb59b6d..020f44a 100755 --- a/glew-cmake/maintain.sh +++ b/glew-cmake/maintain.sh @@ -65,6 +65,10 @@ source_update () { AFTER_COMMIT=`git rev-parse HEAD` if [ "$BEFORE_COMMIT" != "$AFTER_COMMIT" ]; then echo "Source Updated" + git checkout original_repo/${GIT_BRANCH_NAME} -- README.md + git mv -f README.md README_glew.md + git checkout $BEFORE_COMMIT -- README.md + git add -f README.md README_glew.md git commit --amend -m "Merge ${ORIGINAL_REPO_URL} into ${GIT_BRANCH_NAME} HEAD at $(TZ=GMT date)" git push ${PUSH_ARG} origin $GIT_BRANCH_NAME:$GIT_BRANCH_NAME PUSH_COUNT=$((PUSH_COUNT + 1)) @@ -118,7 +122,8 @@ import_tags () { do echo "Import $TAG" git checkout $TAG -- . - git checkout master -- CMakeLists.txt GeneratePkgConfig.cmake + git mv -f README.md README_glew.md + git checkout master -- CMakeLists.txt GeneratePkgConfig.cmake README.md cd "$WORKSPACE/auto" COMMIT_TIME=`git log -1 $TAG --format=%ct` echo "Patch perl scripts for new version" From fe9f5c25c643a27be115a82b2dc1ff46c33e715e Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Sun, 12 Dec 2021 16:38:29 +0900 Subject: [PATCH 4/4] Fix github actions build error --- .github/workflows/cmake.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5a88972..aead714 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,41 +23,42 @@ jobs: # cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-latest + container: ubuntu:latest steps: - uses: actions/checkout@v2 - name: Install dependencies - run: sudo apt install libglu1-mesa-dev pkg-config + run: apt update && DEBIAN_FRONTEND=noninteractive apt install -y cmake gcc g++ libglu1-mesa-dev pkg-config libx11-dev libxext-dev - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands run: | - mkdir ${{runner.workspace}}/build_test - mkdir ${{runner.workspace}}/from_installed - mkdir ${{runner.workspace}}/pkg-config - mkdir ${{runner.workspace}}/as_subdirectory + mkdir build_test + mkdir from_installed + mkdir pkg-config + mkdir as_subdirectory - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system shell: bash - working-directory: ${{runner.workspace}}/build_test + working-directory: build_test # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE - name: Build test - working-directory: ${{runner.workspace}}/build_test + working-directory: build_test shell: bash # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE - name: Install test shell: bash - working-directory: ${{runner.workspace}}/from_installed + working-directory: from_installed run: | mkdir -p ext_project/build cp $GITHUB_WORKSPACE/src/glewinfo.c ext_project/ @@ -71,7 +72,7 @@ jobs: - name: Package config test shell: bash - working-directory: ${{runner.workspace}}/pkg-config + working-directory: pkg-config run: | mkdir -p ext_project cp $GITHUB_WORKSPACE/src/glewinfo.c ext_project/ @@ -83,7 +84,7 @@ jobs: - name: Subdirectory test shell: bash - working-directory: ${{runner.workspace}}/as_subdirectory + working-directory: as_subdirectory run: | cp $GITHUB_WORKSPACE/src/glewinfo.c ./ cp $GITHUB_WORKSPACE/glew-cmake/sub-directory-test.cmake CMakeLists.txt