-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: move pixi-build example to subfolder and restore cpp-sdl example (
- Loading branch information
1 parent
3750f98
commit 2e05115
Showing
19 changed files
with
3,634 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,44 @@ | ||
[workspace] | ||
channels = ["https://prefix.dev/conda-forge"] | ||
platforms = ["win-64", "linux-64", "osx-arm64", "osx-64"] | ||
preview = ["pixi-build"] | ||
|
||
[package] | ||
[project] | ||
authors = ["Bas Zalmstra <bas@prefix.dev>"] | ||
channels = ["conda-forge"] | ||
description = "Showcases how to create a simple C++ executable with Pixi" | ||
name = "sdl_example" | ||
version = "0.1.0" | ||
|
||
[build-system] | ||
build-backend = { name = "pixi-build-cmake", version = "*" } | ||
channels = [ | ||
"https://prefix.dev/pixi-build-backends", | ||
"https://prefix.dev/conda-forge", | ||
] | ||
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"] | ||
|
||
[tasks.start] | ||
cmd = "sdl_example" | ||
|
||
[host-dependencies] | ||
# This ensures that SDL2 is available at build time. | ||
sdl2 = ">=2.26.5,<3.0" | ||
# Start the built executable | ||
cmd = ".build/bin/sdl_example" | ||
depends-on = ["build"] | ||
|
||
[dependencies] | ||
# Define a dependency on ourselves. This will invoke the build backend to build | ||
# the C++ code and install the executable in an environment ready to be used. | ||
sdl_example = { path = "." } | ||
sdl2 = "2.26.5.*" | ||
|
||
[feature.build.dependencies] | ||
cmake = "3.26.4.*" | ||
cxx-compiler = "1.5.2.*" | ||
make = ">=4.3,<5" | ||
ninja = "1.11.1.*" | ||
|
||
[feature.build.tasks.configure] | ||
# Configures CMake | ||
cmd = [ | ||
"cmake", | ||
# Use the cross-platform Ninja generator | ||
"-GNinja", | ||
# The source is in the root directory | ||
"-S.", | ||
# We wanna build in the .build directory | ||
"-B.build", | ||
] | ||
inputs = ["CMakeLists.txt"] | ||
outputs = [".build/CMakeFiles/"] | ||
|
||
# Build the executable but make sure CMake is configured first. | ||
[feature.build.tasks.build] | ||
cmd = ["cmake", "--build", ".build"] | ||
depends-on = ["configure"] | ||
inputs = ["CMakeLists.txt", "src/*"] | ||
outputs = [".build/bin/sdl_example"] | ||
|
||
[environments] | ||
build = ["build"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Pixi Build | ||
|
||
These examples utilize pixi build and require a development version of pixi to work. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# pixi environments | ||
.pixi | ||
|
||
# The build directory | ||
.build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
project(sdl_example) | ||
|
||
find_package(SDL2 REQUIRED) | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") | ||
|
||
add_executable(${PROJECT_NAME} src/main.cc) | ||
|
||
if (MSVC) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE) | ||
endif() | ||
|
||
target_link_libraries( | ||
${PROJECT_NAME} PRIVATE | ||
SDL2::SDL2 | ||
SDL2::SDL2main | ||
) | ||
|
||
include(GNUInstallDirs) | ||
install( | ||
TARGETS ${PROJECT_NAME} | ||
EXPORT ${PROJECT_NAME}Targets | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${BINDIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Simple C++ SDL Example | ||
|
||
This is a simple pixi demo that showcases how to use C++ and SDL. | ||
|
||
## How to use? | ||
|
||
Make sure you have `pixi` available in your terminal. | ||
Navigate to this directory and run: | ||
|
||
```shell | ||
# Configure the CMake project | ||
pixi run configure | ||
|
||
# Build the executable | ||
pixi run build | ||
|
||
# Start the build executable | ||
pixi run start | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[workspace] | ||
channels = ["https://prefix.dev/conda-forge"] | ||
platforms = ["win-64", "linux-64", "osx-arm64", "osx-64"] | ||
preview = ["pixi-build"] | ||
|
||
[package] | ||
authors = ["Bas Zalmstra <bas@prefix.dev>"] | ||
description = "Showcases how to create a simple C++ executable with Pixi" | ||
name = "sdl_example" | ||
version = "0.1.0" | ||
|
||
[build-system] | ||
build-backend = { name = "pixi-build-cmake", version = "*" } | ||
channels = [ | ||
"https://prefix.dev/pixi-build-backends", | ||
"https://prefix.dev/conda-forge", | ||
] | ||
|
||
[tasks.start] | ||
cmd = "sdl_example" | ||
|
||
[host-dependencies] | ||
# This ensures that SDL2 is available at build time. | ||
sdl2 = ">=2.26.5,<3.0" | ||
|
||
[dependencies] | ||
# Define a dependency on ourselves. This will invoke the build backend to build | ||
# the C++ code and install the executable in an environment ready to be used. | ||
sdl_example = { path = "." } |
Oops, something went wrong.