Some more work on cross-platform configuration
This commit is contained in:
14
MODULE.bazel.lock
generated
14
MODULE.bazel.lock
generated
@ -64,20 +64,20 @@
|
|||||||
"@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": {
|
"@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": {
|
||||||
"general": {
|
"general": {
|
||||||
"bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=",
|
"bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=",
|
||||||
"usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=",
|
"usagesDigest": "+hz7IHWN6A1oVJJWNDB6yZRG+RYhF76wAYItpAeIUIg=",
|
||||||
"recordedFileInputs": {},
|
"recordedFileInputs": {},
|
||||||
"recordedDirentsInputs": {},
|
"recordedDirentsInputs": {},
|
||||||
"envVariables": {},
|
"envVariables": {},
|
||||||
"generatedRepoSpecs": {
|
"generatedRepoSpecs": {
|
||||||
"local_config_apple_cc": {
|
|
||||||
"bzlFile": "@@apple_support~//crosstool:setup.bzl",
|
|
||||||
"ruleClassName": "_apple_cc_autoconf",
|
|
||||||
"attributes": {}
|
|
||||||
},
|
|
||||||
"local_config_apple_cc_toolchains": {
|
"local_config_apple_cc_toolchains": {
|
||||||
"bzlFile": "@@apple_support~//crosstool:setup.bzl",
|
"bzlFile": "@@apple_support~//crosstool:setup.bzl",
|
||||||
"ruleClassName": "_apple_cc_autoconf_toolchains",
|
"ruleClassName": "_apple_cc_autoconf_toolchains",
|
||||||
"attributes": {}
|
"attributes": {}
|
||||||
|
},
|
||||||
|
"local_config_apple_cc": {
|
||||||
|
"bzlFile": "@@apple_support~//crosstool:setup.bzl",
|
||||||
|
"ruleClassName": "_apple_cc_autoconf",
|
||||||
|
"attributes": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"recordedRepoMappingEntries": [
|
"recordedRepoMappingEntries": [
|
||||||
@ -92,7 +92,7 @@
|
|||||||
"@@platforms//host:extension.bzl%host_platform": {
|
"@@platforms//host:extension.bzl%host_platform": {
|
||||||
"general": {
|
"general": {
|
||||||
"bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=",
|
"bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=",
|
||||||
"usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=",
|
"usagesDigest": "pCYpDQmqMbmiiPI1p2Kd3VLm5T48rRAht5WdW0X2GlA=",
|
||||||
"recordedFileInputs": {},
|
"recordedFileInputs": {},
|
||||||
"recordedDirentsInputs": {},
|
"recordedDirentsInputs": {},
|
||||||
"envVariables": {},
|
"envVariables": {},
|
||||||
|
@ -3,6 +3,7 @@ cc_library(
|
|||||||
hdrs = [
|
hdrs = [
|
||||||
"annotations.hpp",
|
"annotations.hpp",
|
||||||
"assert.hpp",
|
"assert.hpp",
|
||||||
|
"config.hpp",
|
||||||
"format.hpp",
|
"format.hpp",
|
||||||
"integers.hpp",
|
"integers.hpp",
|
||||||
"io.hpp",
|
"io.hpp",
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __clang__
|
#include "asl/config.hpp"
|
||||||
#error Not a valid environment
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
|
#if ASL_COMPILER_CLANG_CL
|
||||||
#define ASL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
|
#define ASL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
|
||||||
#else
|
#elif ASL_COMPILER_CLANG
|
||||||
#define ASL_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
#define ASL_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// @Todo Make this portable-ish
|
#include "asl/config.hpp"
|
||||||
|
|
||||||
|
#if ASL_COMPILER_CLANG_CL
|
||||||
|
#define ASL_DEBUG_BREAK() __debugbreak()
|
||||||
|
#elif ASL_COMPILER_CLANG
|
||||||
|
#define ASL_DEBUG_BREAK() __builtin_debug_trap()
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ASL_ASSERT(...) \
|
#define ASL_ASSERT(...) \
|
||||||
if (__VA_ARGS__) {} \
|
if (__VA_ARGS__) {} \
|
||||||
else { __builtin_debugtrap(); }
|
else { ASL_DEBUG_BREAK(); }
|
||||||
|
17
asl/config.hpp
Normal file
17
asl/config.hpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define ASL_OS_WINDOWS 1
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#define ASL_OS_LINUX 1
|
||||||
|
#else
|
||||||
|
#error Unknown OS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__) && defined(_MSC_VER)
|
||||||
|
#define ASL_COMPILER_CLANG_CL 1
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define ASL_COMPILER_CLANG 1
|
||||||
|
#else
|
||||||
|
#error Unknown compiler
|
||||||
|
#endif
|
@ -1,16 +1,24 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "asl/config.hpp"
|
||||||
|
|
||||||
using int8_t = signed char;
|
using int8_t = signed char;
|
||||||
using int16_t = signed short;
|
using int16_t = signed short;
|
||||||
using int32_t = signed int;
|
using int32_t = signed int;
|
||||||
using int64_t = signed long;
|
#if ASL_OS_WINDOWS
|
||||||
|
using int64_t = signed long long;
|
||||||
// @Todo Proper type definition for Windows/Linux
|
#elif ASL_OS_LINUX
|
||||||
|
using int64_t = signed long;
|
||||||
|
#endif
|
||||||
|
|
||||||
using uint8_t = unsigned char;
|
using uint8_t = unsigned char;
|
||||||
using uint16_t = unsigned short;
|
using uint16_t = unsigned short;
|
||||||
using uint32_t = unsigned int;
|
using uint32_t = unsigned int;
|
||||||
using uint64_t = unsigned long;
|
#if ASL_OS_WINDOWS
|
||||||
|
using uint64_t = unsigned long long;
|
||||||
|
#elif ASL_OS_LINUX
|
||||||
|
using uint64_t = unsigned long;
|
||||||
|
#endif
|
||||||
|
|
||||||
using size_t = uint64_t;
|
using size_t = uint64_t;
|
||||||
using isize_t = int64_t;
|
using isize_t = int64_t;
|
||||||
|
Reference in New Issue
Block a user