Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xavie_
Cef
提交
35f0a40e
C
Cef
项目概览
Xavie_
/
Cef
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cef
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
35f0a40e
编写于
12月 02, 2018
作者:
R
Richard Wilkes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the setup script more general
上级
027eef0e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
148 addition
and
53 deletion
+148
-53
MainArgs.go
MainArgs.go
+2
-2
README.md
README.md
+10
-7
cef.sh
cef.sh
+136
-0
setup.sh
setup.sh
+0
-44
未找到文件。
MainArgs.go
浏览文件 @
35f0a40e
...
...
@@ -4,8 +4,8 @@ import (
// #include <stdlib.h>
// #include "include/internal/cef_types.h"
// #cgo CFLAGS: -I ${SRCDIR}/cef
// #cgo darwin LDFLAGS: -framework Cocoa -F ${SRCDIR}/cef/
Release
-framework "Chromium Embedded Framework"
// #cgo windows LDFLAGS: -L${SRCDIR}/cef/
Release
-lcef -Wl,--subsystem,windows
// #cgo darwin LDFLAGS: -framework Cocoa -F ${SRCDIR}/cef/
lib
-framework "Chromium Embedded Framework"
// #cgo windows LDFLAGS: -L${SRCDIR}/cef/
lib
-lcef -Wl,--subsystem,windows
"C"
)
...
...
README.md
浏览文件 @
35f0a40e
...
...
@@ -5,25 +5,28 @@ Go bindings for the
Currently works for macOS and Windows. Linux support will be coming at some
point as well.
## Initial setup
Run
`setup.sh`
in this directory to pull the version of CEF these bindings
were created for.
## Extra environment setup required for Windows
## Initial setup required for Windows
-
Download and run the installer from http://www.msys2.org/
-
In the mingw64 msys2 console, run the following:
-
`pacman -Syu`
-
`pacman -Su`
-
`pacman -S mingw64/mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-go msys/git`
## Initial setup
In the root of the repo, run (if using Windows, do this from a mingw64 msys2
console):
```
./cef.sh --headers cef --libs cef/lib
```
## Example application
https://github.com/richardwilkes/webapp and
https://github.com/richardwilkes/webapp-example use these bindings to create
an example desktop application.
## Updating the CEF version to be used
The CEF version can be updated in the
`
setup
.sh`
script file by changing the
`CEF_VERSION`
variable. If a different version is pulled, the source files
The CEF version can be updated in the
`
cef
.sh`
script file by changing the
`CEF_VERSION`
variable. If a different
CEF
version is pulled, the source files
should be generated again by running
`go generate ./...`
on a macOS machine.
Code generation might be possible on other platforms, but has not been tested
there.
cef.sh
0 → 100755
浏览文件 @
35f0a40e
#!/usr/bin/env bash
set
-eo
pipefail
CEF_VERSION
=
3.3538.1852.gcb937fc
SELF
=
$0
function
help
()
{
echo
"
$SELF
[options]"
echo
""
echo
" --clear Clears the cache"
echo
" --headers <path> Install the CEF headers into <path>, replacing existing contents"
echo
" --libs <path> Install the CEF libraries into <path>, replacing existing contents"
echo
" -c Same as --clear"
echo
" -H <path> Same as --headers"
echo
" -l <path> Same as --libs"
}
# Process the command line
while
((
"$#"
))
;
do
case
"
$1
"
in
-c
|
--clear
)
CLEAR_CACHE
=
1
shift
;;
-H
|
--headers
)
if
[
"x
$2
"
==
"x"
]
;
then
echo
"
$1
requires a path"
exit
1
fi
INSTALL_HEADERS
=
$2
shift
2
;;
-l
|
--libs
)
if
[
"x
$2
"
==
"x"
]
;
then
echo
"
$1
requires a path"
exit
1
fi
INSTALL_LIBS
=
$2
shift
2
;;
*
)
help
exit
1
;;
esac
done
if
[
"x
$CLEAR_CACHE
"
==
"x"
]
&&
[
"x
$INSTALL_HEADERS
"
==
"x"
]
&&
[
"x
$INSTALL_LIBS
"
==
"x"
]
;
then
help
exit
1
fi
# Setup PLATFORM and CACHEDIR
case
$(
uname
-s
)
in
Darwin
*
)
PLATFORM
=
macosx64
CACHEDIR
=
"
$HOME
/Library/Caches"
;;
Linux
*
)
PLATFORM
=
linux64
if
[
"
$XDG_CACHE_HOME
"
!=
""
]
;
then
CACHEDIR
=
"
$XDG_CACHE_HOME
"
else
CACHEDIR
=
"
$HOME
/.cache"
fi
;;
MINGW64
*
)
PLATFORM
=
windows64
CACHEDIR
=
"
$LocalAppData
"
;;
*
)
echo
"Unsupported OS:
$(
uname
-s
)
"
exit
1
;;
esac
CACHEDIR
=
"
$CACHEDIR
/gocef"
if
[
"x
$CLEAR_CACHE
"
==
"x1"
]
;
then
/bin/rm
-rf
"
$CACHEDIR
"
fi
CEF_BASE
=
cef_binary_
${
CEF_VERSION
}
_
${
PLATFORM
}
_minimal
CEF_ARCHIVE
=
$CEF_BASE
.tar.bz2
# Function to download the CEF archive if it doesn't already exist
function
download_cef_archive
()
{
if
[
!
-f
"
$CACHEDIR
/
$CEF_ARCHIVE
"
]
;
then
mkdir
-p
"
$CACHEDIR
"
curl
-L
-o
"
$CACHEDIR
/
$CEF_ARCHIVE
"
http://opensource.spotify.com/cefbuilds/
$CEF_ARCHIVE
fi
}
# Install the CEF headers
if
[
"x
$INSTALL_HEADERS
"
!=
"x"
]
;
then
EXISTING
=
""
if
[
-e
"
$INSTALL_HEADERS
/include/cef_version.h"
]
;
then
EXISTING
=
`
grep
"#define CEF_VERSION "
"
$INSTALL_HEADERS
/include/cef_version.h"
|
cut
-f
2
-d
'"'
`
fi
if
[
$CEF_VERSION
!=
"
$EXISTING
"
]
;
then
download_cef_archive
/bin/rm
-rf
"
$INSTALL_HEADERS
"
mkdir
-p
"
$INSTALL_HEADERS
"
bunzip2
--stdout
"
$CACHEDIR
/
$CEF_ARCHIVE
"
|
tar
xf -
-C
"
$INSTALL_HEADERS
"
\
--strip-components
1
\
--include
$CEF_BASE
/include/cef_application_mac.h
\
--include
$CEF_BASE
/include/cef_version.h
\
--include
$CEF_BASE
/include/base
\
--include
$CEF_BASE
/include/internal
\
--include
$CEF_BASE
/include/capi
\
--exclude
$CEF_BASE
/include/capi/cef_
\*
_util_capi.h
\
--exclude
$CEF_BASE
/include/capi/cef_parser_capi.h
\
--exclude
$CEF_BASE
/include/capi/cef_thread_capi.h
\
--exclude
$CEF_BASE
/include/capi/cef_trace_capi.h
\
--exclude
$CEF_BASE
/include/capi/cef_xml_reader_capi.h
\
--exclude
$CEF_BASE
/include/capi/cef_zip_reader_capi.h
\
--exclude
$CEF_BASE
/include/capi/test
\
--exclude
$CEF_BASE
/include/capi/views
fi
fi
# Install the CEF libraries
if
[
"x
$INSTALL_LIBS
"
!=
"x"
]
;
then
EXISTING
=
""
if
[
-e
"
$INSTALL_LIBS
/version.txt"
]
;
then
EXISTING
=
`
cat
"
$INSTALL_LIBS
/version.txt"
`
fi
if
[
$CEF_VERSION
!=
"
$EXISTING
"
]
;
then
download_cef_archive
/bin/rm
-rf
"
$INSTALL_LIBS
"
mkdir
-p
"
$INSTALL_LIBS
"
bunzip2
--stdout
"
$CACHEDIR
/
$CEF_ARCHIVE
"
|
tar
xf -
-C
"
$INSTALL_LIBS
"
\
--strip-components
2
\
--include
$CEF_BASE
/Release
\
--exclude
$CEF_BASE
/Release/cef_sandbox.a
echo
"
$CEF_VERSION
"
>
"
$INSTALL_LIBS
/version.txt"
fi
fi
setup.sh
已删除
100755 → 0
浏览文件 @
027eef0e
#!/usr/bin/env bash
set
-eo
pipefail
CEF_VERSION
=
3.3538.1852.gcb937fc
# Setup PLATFORM
case
$(
uname
-s
)
in
Darwin
*
)
PLATFORM
=
macosx64
;;
#Linux*) PLATFORM=linux64 ;;
MINGW64
*
)
PLATFORM
=
windows64
;;
*
)
echo
"Unsupported OS:
$(
uname
-s
)
"
;
false
;;
esac
if
[
-e
cef/include/cef_version.h
]
;
then
EXISTING
=
`
grep
"#define CEF_VERSION "
cef/include/cef_version.h |
cut
-f
2
-d
'"'
`
fi
if
[
$CEF_VERSION
!=
"
$EXISTING
"
]
;
then
/bin/rm
-rf
cef cef_binary_
${
CEF_VERSION
}
_
${
PLATFORM
}
_minimal
curl
-L
http://opensource.spotify.com/cefbuilds/cef_binary_
${
CEF_VERSION
}
_
${
PLATFORM
}
_minimal.tar.bz2 | bunzip2 |
tar
xf -
mv
cef_binary_
${
CEF_VERSION
}
_
${
PLATFORM
}
_minimal cef
# Prune out the things we don't need
/bin/rm
-rf
cef/cmake cef/Debug
\
cef/include/capi/test
\
cef/include/capi/views
\
cef/include/test
\
cef/include/views
\
cef/include/wrapper
\
cef/libcef_dll
/bin/rm
-f
cef/CMakeLists.txt
\
cef/Release/cef_sandbox.a
\
cef/include/capi/cef_
*
_util_capi.h
\
cef/include/capi/cef_parser_capi.h
\
cef/include/capi/cef_thread_capi.h
\
cef/include/capi/cef_trace_capi.h
\
cef/include/capi/cef_xml_reader_capi.h
\
cef/include/capi/cef_zip_reader_capi.h
mv
cef/include/cef_version.h cef/
if
[
$PLATFORM
==
"macosx64"
]
;
then
mv
cef/include/cef_application_mac.h cef/
fi
/bin/rm
-f
cef/include/
*
.h
mv
cef/
*
.h cef/include/
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录