Open oahcy opened 2 years ago
export LDFLAGS=" --rtlib=compiler-rt -fuse-ld=lld -nostdlib "
export CFLAGS="-fuse-ld=lld --target=arm-linux-ohos --gcc-toolchain=D:/openharmony-sdk/native/3.0.0.0/llvm --sysroot=D:/openharmony-sdk/native/3.0.0.0/sysroot -nostdinc "
export PATH=$PATH:/cygdrive/d/openharmony-sdk/native/3.0.0.0/llvm/bin
export CC=clang
export LD=lld
../configure --host=arm-linux
cmake_minimum_required(VERSION 3.10)
# set the project name
project(sqlite3)
#for compile warning , not
set(CMAKE_C_FLAGS "-march=armv7a ${CMAKE_C_FLAGS}")
# bug, not define map_shared on mman-common.h
add_definitions(-DMAP_SHARED=0x01)
# add the executable
add_library(sqlite3 sqlite3.c)
ARCH=armeabi-v7a
cmake -S . -B ./bld -DOHOS_ARCH=$ARCH -G Ninja --toolchain D:/openharmony-sdk/native/3.0.0.0/build/cmake/ohos.toolchain.cmake
cmake --build ./bld
32 会有链接标准库的问题 , 需要加参数:set(CMAKE_CXX_FLAGS "-march=armv7a ${CMAKE_CXX_FLAGS}")
OSDependent 需要手动改几处宏 :
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0600516e..9c13be01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,6 +45,8 @@ project(glslang LANGUAGES CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+set(CMAKE_CXX_FLAGS "-march=armv7a ${CMAKE_CXX_FLAGS}")
+
# Enable compile commands database
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt
index dab5f8bf..a38c4ceb 100644
--- a/glslang/CMakeLists.txt
+++ b/glslang/CMakeLists.txt
@@ -31,14 +31,9 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-if(WIN32)
- add_subdirectory(OSDependent/Windows)
-elseif(UNIX OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
- add_subdirectory(OSDependent/Unix)
-else(WIN32)
- message("unknown platform")
-endif(WIN32)
+ add_subdirectory(OSDependent/Unix)
+message("platform ${CMAKE_SYSTEM_NAME}")
if(EMSCRIPTEN OR ENABLE_GLSLANG_JS)
# May be enabled on non-Emscripten builds for binary-size testing.
add_subdirectory(OSDependent/Web)
diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp
index 3f029f02..b518e110 100644
--- a/glslang/OSDependent/Unix/ossource.cpp
+++ b/glslang/OSDependent/Unix/ossource.cpp
@@ -73,7 +73,7 @@ static void DetachThreadLinux(void *)
//
void OS_CleanupThreadData(void)
{
-#if defined(__ANDROID__) || defined(__Fuchsia__)
+#if (1)
DetachThreadLinux(NULL);
#else
int old_cancel_state, old_cancel_type;
#!/bin/bash
set -x
set -e
if [ $# -eq 0 ]; then
# ARCH=x86
# ARCH=x86_64
# ARCH=armeabi-v7a
ARCH=arm64-v8a
else
ARCH=$1
fi
# LLVM_STRIP=$NDK_ROOT/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe
BUILD_DIR=build-ohos-$ARCH
OHOS_SDK_ROOT=D:/openharmony-sdk/native/3.0.0.0
LLVM_STRIP=$OHOS_SDK_ROOT/llvm/bin/llvm-strip.exe
rm -rf $BUILD_DIR/output
cmake -B $BUILD_DIR \
-GNinja \
-DCMAKE_TOOLCHAIN_FILE=$OHOS_SDK_ROOT/build/cmake/ohos.toolchain.cmake \
-DOHOS_ARCH=$ARCH \
-DANDROID_PLATFORM=android-19 \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_HLSL=OFF \
-DENABLE_SPVREMAPPER=OFF \
-DSKIP_GLSLANG_INSTALL=ON \
-DSPIRV_SKIP_EXECUTABLES=ON
ninja -C $BUILD_DIR -v
mkdir $BUILD_DIR/output
find $BUILD_DIR -name "*.a" -exec $LLVM_STRIP --strip-debug {} \; -exec cp {} $BUILD_DIR/output \;
rm $BUILD_DIR/output/*SPIRV-Tools-link*
rm $BUILD_DIR/output/*SPIRV-Tools-reduce*
cmake命令
编译 cpp