Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build scripts #56

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
65402b5
CMake support
Frost-54 Jul 22, 2023
1903a18
Ignore cmake and clangd outputs
Frost-54 Jul 22, 2023
8fd2895
Add build tests
Frost-54 Jul 22, 2023
48b59de
Fix: should be run
Frost-54 Jul 22, 2023
7471864
Run apt with sudo
Frost-54 Jul 22, 2023
c349278
Disable objc on non-apple platforms
Frost-54 Jul 22, 2023
fd939db
ninja is ninja-build in apt
Frost-54 Jul 22, 2023
23a82bb
Do not use broken mingw on windows
Frost-54 Jul 22, 2023
d2fb419
Quote visual studio generator
Frost-54 Jul 22, 2023
1094d7c
Fix: -T should be defined in toolchain
Frost-54 Jul 22, 2023
02858a4
Fix: add pwd to cmake --build
Frost-54 Jul 22, 2023
693a98f
Try to fix linux build error
Frost-54 Jul 22, 2023
887781a
Should be CXX
Frost-54 Jul 22, 2023
323e360
Fix: MSVC does not support warnings other than -Wall
Frost-54 Jul 22, 2023
4ea20b6
Use stdafx on windows
Frost-54 Jul 22, 2023
d84f84a
Try if clang works
Frost-54 Jul 22, 2023
e332478
Fix: should be stdafx.h
Frost-54 Jul 22, 2023
3f206ba
Enable exception for clang
Frost-54 Jul 22, 2023
ec7a0e7
Add compiler to windows run name
Frost-54 Jul 22, 2023
280f469
Fix linux compiler error
Frost-54 Jul 22, 2023
5c674b5
Linux compiler error fixed.
Frost-54 Jul 22, 2023
35e8c79
Fix: should be -fcxx-exceptions
Frost-54 Jul 22, 2023
a47052e
Fix: clang-cl uses different command line syntax
Frost-54 Jul 22, 2023
bfd6e9f
Use MSVC style
Frost-54 Jul 22, 2023
5660d75
Fix linux compiler error
Frost-54 Jul 22, 2023
e712745
Capital EH
Frost-54 Jul 22, 2023
326fabf
Use fexceptions for both gcc and clang
Frost-54 Jul 22, 2023
a536432
libxxf86vm-dev is also required
Frost-54 Jul 22, 2023
2a7b195
Enable EHa
Frost-54 Jul 22, 2023
8526522
Include Platform.h to undefine linux
Frost-54 Jul 22, 2023
838b4ff
Windows 8.0+ is required for xaudio
Frost-54 Jul 22, 2023
c80ab14
MAKEINTATOM returns LPTSTR, but a LPCWSTR is expected
Frost-54 Jul 22, 2023
5799f53
MAKEINTATOM returns LPTSTR, but a LPCWSTR is expected
Frost-54 Jul 22, 2023
ff60271
Add required libraries
Frost-54 Jul 22, 2023
deb5d4c
Fix constexpr variable 'closeSocket' must be initialized by a constan…
Frost-54 Jul 22, 2023
89e88c4
Fix windows linking errors
Frost-54 Jul 22, 2023
e5ae402
Fix xaudio CreateMasteringVoice error
Frost-54 Jul 23, 2023
e664b9f
Fix: CreateMasteringVoice does not take in DeviceId
Frost-54 Jul 23, 2023
b439bb3
Fix linking error
Frost-54 Jul 23, 2023
39b5530
Fix more link errors
Frost-54 Jul 23, 2023
cc4639b
Remove .lib in link libraries
Frost-54 Jul 23, 2023
d201e8f
Fix windows entry point: WinMain is for WINDOWS subsystem
Frost-54 Jul 23, 2023
dcedf9c
Fix: Xaudio error is larger than integer max
Frost-54 Jul 23, 2023
1ff45cc
Add missing ':'
Frost-54 Jul 23, 2023
8f2eebe
Add missing ':'
Frost-54 Jul 23, 2023
e0124f0
Fix windows error code larger than int max
Frost-54 Jul 23, 2023
c394da6
Fix syntax error
Frost-54 Jul 23, 2023
4bc87d9
Fix syntax error
Frost-54 Jul 23, 2023
72aa4dd
Add return type
Frost-54 Jul 23, 2023
df5287c
HRESULT is not large enough on clang-cl
Frost-54 Jul 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/build-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

run-name: ouzel build test
on: [push]
jobs:
linux:
name: ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
steps:
- name: Checkoout ouzel
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libgles2-mesa-dev libopenal-dev libasound2-dev libxi-dev libxcursor-dev libxrandr-dev libxss-dev libxxf86vm-dev
sudo apt-get install cmake ninja-build

- name: Generate ninja files
run: cmake . -Bbuild -GNinja

- name: Build
run: cd build && ninja

mac:
name: ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [macos-11, macos-latest]

steps:
- name: Checkoout ouzel
uses: actions/checkout@v2

- name: Install ninja
run: brew install ninja

- name: Generate ninja files
run: cmake . -Bbuild -GNinja

- name: Build
run: cd build && ninja

windows:
name: ${{matrix.os}}-${{matrix.compiler}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [windows-2019, windows-latest]
compiler: [cl, clang]
include:
- os: windows-2019
compiler: cl
generator: Visual Studio 16 2019
toolchain:
- os: windows-latest
compiler: cl
generator: Visual Studio 17 2022
toolchain:
- os: windows-2019
compiler: clang
generator: Visual Studio 16 2019
toolchain: -T ClangCL
- os: windows-latest
compiler: clang
generator: Visual Studio 17 2022
toolchain: -T ClangCL

steps:
- name: Checkoout ouzel
uses: actions/checkout@v2

- name: Build
run: cmake . -Bbuild -G "${{matrix.generator}}" ${{matrix.toolchain}}

- name: Build
run: cd build && cmake --build .

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ test/test.xcodeproj/xcuserdata
test/test
samples/app/src/main/libs
samples/app/src/main/obj
build/
.cache/
.DS_Store
compile_commands.json
64 changes: 64 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 3.16)

if (APPLE)
project(ouzel LANGUAGES C CXX OBJC OBJCXX)
else()
project(ouzel LANGUAGES C CXX)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_OBJCXX_STANDARD 17)

set(CMAKE_C_FLAGS
"-Wall"
)

set(CMAKE_CXX_FLAGS
"-Wall"
)

set(CMAKE_OBJC_FLAGS
"-Wall"
)

set(CMAKE_OBJCXX_FLAGS
"-Wall"
)

if(NOT MSVC)
set(CMAKE_C_FLAGS
"-Wpedantic -Wextra -Wshadow -Wdouble-promotion -Woverloaded-virtual"
)
set(CMAKE_CXX_FLAGS
"-Wpedantic -Wextra -Wshadow -Wdouble-promotion -Woverloaded-virtual -Wold-style-cast"
)
set(CMAKE_OBJC_FLAGS
"-fno-objc-arc -Wpedantic -Wextra -Wshadow -Wdouble-promotion -Woverloaded-virtual"
)
set(CMAKE_OBJCXX_FLAGS
"-fno-objc-arc -Wpedantic -Wextra -Wshadow -Wdouble-promotion -Woverloaded-virtual -Wold-style-cas"
)
endif()

if(MSVC)
set(CMAKE_CXX_FLAGS "/EHca")
set(CMAKE_OBJCXX_FLAGS "/EHca")
else()
set(CMAKE_CXX_FLAGS "-fexceptions")
set(CMAKE_OBJCXX_FLAGS "-fexceptions")
endif()

set(EXTERNAL_LIB_INCLUDE_DIRS
${CMAKE_CURRENT_LIST_DIR}/external/khronos
${CMAKE_CURRENT_LIST_DIR}/external/smbPitchShift
${CMAKE_CURRENT_LIST_DIR}/external/stb
)

set(SHADER_DIRS
${CMAKE_CURRENT_LIST_DIR}/shaders
)

add_subdirectory(engine)
add_subdirectory(samples)
add_subdirectory(tools)
add_subdirectory(test)
Loading