setup nix. clion doesn't work with 24.05 cmake
commit
ee0950e4ab
|
@ -0,0 +1,6 @@
|
|||
cmake-build*/
|
||||
build/
|
||||
out/
|
||||
./cmake-build*/
|
||||
./build/
|
||||
./out/
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "lib/blt-with-graphics"]
|
||||
path = lib/blt-with-graphics
|
||||
url = https://git.tpgc.me/tri11paragon/BLT-With-Graphics-Template
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakePythonSetting">
|
||||
<option name="pythonIntegrationState" value="YES" />
|
||||
</component>
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/voxel-game.iml" filepath="$PROJECT_DIR$/.idea/voxel-game.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics/libraries/imgui" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics/libraries/openal-soft" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.28)
|
||||
project(voxel-game VERSION 0.0.2)
|
||||
|
||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
add_subdirectory(lib/blt-with-graphics)
|
||||
|
||||
include_directories(include/)
|
||||
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||
|
||||
add_executable(voxel-game ${PROJECT_BUILD_FILES})
|
||||
|
||||
target_compile_options(voxel-game PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment)
|
||||
target_link_options(voxel-game PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment)
|
||||
|
||||
target_link_libraries(voxel-game PRIVATE BLT_WITH_GRAPHICS)
|
||||
|
||||
if (${ENABLE_ADDRSAN} MATCHES ON)
|
||||
target_compile_options(voxel-game PRIVATE -fsanitize=address)
|
||||
target_link_options(voxel-game PRIVATE -fsanitize=address)
|
||||
endif ()
|
||||
|
||||
if (${ENABLE_UBSAN} MATCHES ON)
|
||||
target_compile_options(voxel-game PRIVATE -fsanitize=undefined)
|
||||
target_link_options(voxel-game PRIVATE -fsanitize=undefined)
|
||||
endif ()
|
||||
|
||||
if (${ENABLE_TSAN} MATCHES ON)
|
||||
target_compile_options(voxel-game PRIVATE -fsanitize=thread)
|
||||
target_link_options(voxel-game PRIVATE -fsanitize=thread)
|
||||
endif ()
|
|
@ -0,0 +1,3 @@
|
|||
args="$@"
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
nix-shell --pure --run "cmake $args" $SCRIPT_DIR/default.nix
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import subprocess
|
||||
|
||||
#---------------------------------------
|
||||
# CONFIG
|
||||
#---------------------------------------
|
||||
|
||||
VERSION_BEGIN_STR = " VERSION "
|
||||
VERSION_END_STR = ")"
|
||||
PATCH_LIMIT = 100000
|
||||
|
||||
#---------------------------------------
|
||||
# DO NOT TOUCH
|
||||
#---------------------------------------
|
||||
|
||||
def load_cmake():
|
||||
cmake_file = open("CMakeLists.txt", 'r')
|
||||
cmake_text = cmake_file.read()
|
||||
cmake_file.close()
|
||||
return cmake_text
|
||||
|
||||
def write_cmake(cmake_text):
|
||||
cmake_file = open("CMakeLists.txt", 'w')
|
||||
cmake_file.write(cmake_text)
|
||||
cmake_file.close()
|
||||
|
||||
def get_version(cmake_text):
|
||||
begin = cmake_text.find(VERSION_BEGIN_STR) + len(VERSION_BEGIN_STR)
|
||||
end = cmake_text.find(VERSION_END_STR, begin)
|
||||
return (cmake_text[begin:end], begin, end)
|
||||
|
||||
def split_version(cmake_text):
|
||||
version, begin, end = get_version(cmake_text)
|
||||
version_parts = version.split('.')
|
||||
return (version_parts, begin, end)
|
||||
|
||||
def recombine(cmake_text, version_parts, begin, end):
|
||||
constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2]
|
||||
constructed_text_begin = cmake_text[0:begin]
|
||||
constrcuted_text_end = cmake_text[end::]
|
||||
return constructed_text_begin + constructed_version + constrcuted_text_end
|
||||
|
||||
|
||||
def inc_major(cmake_text):
|
||||
version_parts, begin, end = split_version(cmake_text)
|
||||
version_parts[0] = str(int(version_parts[0]) + 1)
|
||||
version_parts[1] = '0'
|
||||
version_parts[2] = '0'
|
||||
return recombine(cmake_text, version_parts, begin, end)
|
||||
|
||||
def inc_minor(cmake_text):
|
||||
version_parts, begin, end = split_version(cmake_text)
|
||||
version_parts[1] = str(int(version_parts[1]) + 1)
|
||||
version_parts[2] = '0'
|
||||
return recombine(cmake_text, version_parts, begin, end)
|
||||
|
||||
def inc_patch(cmake_text):
|
||||
version_parts, begin, end = split_version(cmake_text)
|
||||
if int(version_parts[2]) + 1 >= PATCH_LIMIT:
|
||||
return inc_minor(cmake_text)
|
||||
version_parts[2] = str(int(version_parts[2]) + 1)
|
||||
return recombine(cmake_text, version_parts, begin, end)
|
||||
|
||||
cmake_text = load_cmake()
|
||||
cmake_version = get_version(cmake_text)[0]
|
||||
print(f"Current Version: {cmake_version}")
|
||||
|
||||
try:
|
||||
type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ")
|
||||
|
||||
if type.startswith('M'):
|
||||
print("Selected major")
|
||||
write_cmake(inc_major(cmake_text))
|
||||
elif type.startswith('m'):
|
||||
print("Selected minor")
|
||||
write_cmake(inc_minor(cmake_text))
|
||||
elif type.startswith('p') or type.startswith('P') or len(type) == 0:
|
||||
print("Selected patch")
|
||||
write_cmake(inc_patch(cmake_text))
|
||||
|
||||
subprocess.call(["git", "add", "*"])
|
||||
subprocess.call(["git", "commit"])
|
||||
subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"])
|
||||
except KeyboardInterrupt:
|
||||
print("\nCancelling!")
|
|
@ -0,0 +1,42 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in pkgs.mkShell
|
||||
{
|
||||
buildInputs = with pkgs; [
|
||||
cmake
|
||||
gcc
|
||||
ninja
|
||||
];
|
||||
propagatedBuildInputs = with pkgs; [
|
||||
xorg.libX11
|
||||
xorg.libX11.dev
|
||||
xorg.libXcursor
|
||||
xorg.libXcursor.dev
|
||||
xorg.libXext
|
||||
xorg.libXext.dev
|
||||
xorg.libXinerama
|
||||
xorg.libXinerama.dev
|
||||
xorg.libXrandr
|
||||
xorg.libXrandr.dev
|
||||
xorg.libXrender
|
||||
xorg.libXrender.dev
|
||||
xorg.libxcb
|
||||
xorg.libxcb.dev
|
||||
xorg.libXi
|
||||
xorg.libXi.dev
|
||||
harfbuzz
|
||||
harfbuzz.dev
|
||||
zlib
|
||||
zlib.dev
|
||||
bzip2
|
||||
bzip2.dev
|
||||
pngpp
|
||||
brotli
|
||||
brotli.dev
|
||||
pulseaudio.dev
|
||||
git
|
||||
libGL
|
||||
libGL.dev
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Subproject commit c01cb757a1d19fa8e06292dcb61a5b5769979f11
|
|
@ -0,0 +1,6 @@
|
|||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
}
|
Loading…
Reference in New Issue