mirror of
https://github.com/glfw/glfw.git
synced 2025-06-15 12:12:16 +00:00
cocoa implementation stub (needs testing)
This commit is contained in:
parent
70948d0bcc
commit
ec676bdaf8
@ -1,10 +1,10 @@
|
||||
image:
|
||||
- Visual Studio 2015
|
||||
- Visual Studio 2019
|
||||
branches:
|
||||
only:
|
||||
- ci
|
||||
- master
|
||||
- latest
|
||||
- 3.3-stable
|
||||
skip_tags: true
|
||||
environment:
|
||||
@ -21,26 +21,13 @@ environment:
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: /WX
|
||||
- GENERATOR: Visual Studio 16 2019
|
||||
BUILD_SHARED_LIBS: ON
|
||||
CFLAGS: /WX
|
||||
- GENERATOR: Visual Studio 16 2019
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: /WX
|
||||
matrix:
|
||||
fast_finish: true
|
||||
exclude:
|
||||
- image: Visual Studio 2015
|
||||
GENERATOR: Visual Studio 16 2019
|
||||
- image: Visual Studio 2019
|
||||
GENERATOR: Visual Studio 10 2010
|
||||
- image: Visual Studio 2019
|
||||
GENERATOR: MinGW Makefiles
|
||||
for:
|
||||
-
|
||||
matrix:
|
||||
except:
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
only:
|
||||
- GENERATOR: MinGW Makefiles
|
||||
build_script:
|
||||
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
|
||||
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
|
116
.github/workflows/build.yml
vendored
Normal file
116
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
name: Build
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [ ci, master, latest, 3.3-stable ]
|
||||
permissions:
|
||||
statuses: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-linux-x11-clang:
|
||||
name: X11 (Linux, Clang)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
|
||||
build-linux-wayland-clang:
|
||||
name: Wayland (Linux, Clang)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D GLFW_USE_WAYLAND=ON -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
|
||||
build-linux-null-clang:
|
||||
name: Null (Linux, Clang)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libosmesa6-dev
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static -D GLFW_USE_OSMESA=ON
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D GLFW_USE_OSMESA=ON -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
|
||||
build-macos-cocoa-clang:
|
||||
name: Cocoa (macOS, Clang)
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
CFLAGS: -Werror
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.8
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
|
||||
build-windows-win32-vs2019:
|
||||
name: Win32 (Windows, VS2019)
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
CFLAGS: /WX
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Configure static library
|
||||
run: cmake -S . -B build-static -G "Visual Studio 16 2019"
|
||||
- name: Build static library
|
||||
run: cmake --build build-static --parallel
|
||||
|
||||
- name: Configure shared library
|
||||
run: cmake -S . -B build-shared -G "Visual Studio 16 2019" -D BUILD_SHARED_LIBS=ON
|
||||
- name: Build shared library
|
||||
run: cmake --build build-shared --parallel
|
||||
|
116
.travis.yml
116
.travis.yml
@ -1,116 +0,0 @@
|
||||
language: c
|
||||
compiler: clang
|
||||
branches:
|
||||
only:
|
||||
- ci
|
||||
- master
|
||||
- 3.3-stable
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: xenial
|
||||
name: "X11 shared library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
- libxcursor-dev
|
||||
- libxi-dev
|
||||
- libxext-dev
|
||||
- libx11-dev
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=ON
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: xenial
|
||||
name: "X11 static library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
- libxcursor-dev
|
||||
- libxi-dev
|
||||
- libxext-dev
|
||||
- libx11-dev
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=OFF
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: focal
|
||||
name: "Wayland shared library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- wayland-protocols
|
||||
- libwayland-dev
|
||||
- libxkbcommon-dev
|
||||
- libegl1-mesa-dev
|
||||
env:
|
||||
- USE_WAYLAND=ON
|
||||
- BUILD_SHARED_LIBS=ON
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: focal
|
||||
name: "Wayland static library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- wayland-protocols
|
||||
- libwayland-dev
|
||||
- libxkbcommon-dev
|
||||
- libegl1-mesa-dev
|
||||
env:
|
||||
- USE_WAYLAND=ON
|
||||
- BUILD_SHARED_LIBS=OFF
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: bionic
|
||||
name: "Null shared library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libosmesa6-dev
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=ON
|
||||
- USE_OSMESA=ON
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: bionic
|
||||
name: "Null static library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libosmesa6-dev
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=OFF
|
||||
- USE_OSMESA=ON
|
||||
- CFLAGS=-Werror
|
||||
- os: osx
|
||||
name: "Cocoa shared library"
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=ON
|
||||
- CFLAGS=-Werror
|
||||
- MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
- os: osx
|
||||
name: "Cocoa static library"
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=OFF
|
||||
- CFLAGS=-Werror
|
||||
- MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
script:
|
||||
- if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then
|
||||
echo Trailing whitespace found, aborting;
|
||||
exit 1;
|
||||
fi
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} -DGLFW_USE_OSMESA=${USE_OSMESA} ..
|
||||
- cmake --build .
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- ci@glfw.org
|
||||
on_success: never
|
||||
on_failure: always
|
@ -1,6 +1,6 @@
|
||||
# GLFW
|
||||
|
||||
[](https://travis-ci.org/glfw/glfw)
|
||||
[](https://github.com/glfw/glfw/actions)
|
||||
[](https://ci.appveyor.com/project/elmindreda/glfw)
|
||||
[](https://scan.coverity.com/projects/glfw-glfw)
|
||||
|
||||
|
@ -292,12 +292,12 @@ static void generate_heightmap__circle(float* center_x, float* center_y,
|
||||
{
|
||||
float sign;
|
||||
/* random value for element in between [0-1.0] */
|
||||
*center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
|
||||
*center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
|
||||
*size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX);
|
||||
sign = (1.0f * rand()) / (1.0f * RAND_MAX);
|
||||
*center_x = (MAP_SIZE * rand()) / (float) RAND_MAX;
|
||||
*center_y = (MAP_SIZE * rand()) / (float) RAND_MAX;
|
||||
*size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX;
|
||||
sign = (1.0f * rand()) / (float) RAND_MAX;
|
||||
sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f;
|
||||
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX);
|
||||
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX;
|
||||
}
|
||||
|
||||
/* Run the specified number of iterations of the generation process for the
|
||||
|
3856
src/cocoa_window.m
3856
src/cocoa_window.m
File diff suppressed because it is too large
Load Diff
21
testing/CMakeLists.txt
Normal file
21
testing/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
project(test
|
||||
VERSION 1.0
|
||||
LANGUAGES CXX)
|
||||
|
||||
add_executable(test
|
||||
test.cpp
|
||||
)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
set(GLFW_BUILD_DOCS OFF)
|
||||
set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF)
|
||||
add_subdirectory(D:/src/glfw ${CMAKE_BINARY_DIR}/glfw-build)
|
||||
|
||||
target_include_directories(test PUBLIC D:/src/glfw/include ${OPENGL_INCLUDE_DIRS})
|
||||
target_link_libraries(test glfw ${OPENGL_LIBRARIES})
|
48
testing/test.cpp
Normal file
48
testing/test.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void printWindowTitle(GLFWwindow *window)
|
||||
{
|
||||
std::cout << "The window title should be '" << glfwGetWindowTitle(window) << "'.\n";
|
||||
}
|
||||
|
||||
void windowShow(GLFWwindow *window)
|
||||
{
|
||||
printWindowTitle(window);
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
glfwWaitEvents();
|
||||
}
|
||||
glfwSetWindowShouldClose(window, GLFW_FALSE);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (!glfwInit())
|
||||
{
|
||||
std::cerr << "Could not initialise glfw.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
GLFWwindow *window = glfwCreateWindow(800, 600, "Initial title", NULL, NULL);
|
||||
windowShow(window);
|
||||
|
||||
glfwSetWindowTitle(window, "");
|
||||
windowShow(window);
|
||||
|
||||
glfwSetWindowTitle(window, "Potato's are cool");
|
||||
windowShow(window);
|
||||
|
||||
glfwSetWindowTitle(window, u8"😀 😃 😄 😁");
|
||||
windowShow(window);
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
|
||||
window = glfwCreateWindow(800, 600, "", NULL, NULL);
|
||||
windowShow(window);
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user