godotengine / godotengine/godot-cpp
GodotExtension: SCons use_static_cpp inconsistent when building for linux and windows
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
### Godot version
4.4-stable
### godot-cpp version
4.4-stable
### System information
Linux fedora 41
### Issue description
I was trying to cross-compile a GodotExtension, which is dependent on a third party library. When build for linux everything went fine. But cross-compiling for windows reported, that it cannot find the library, although I specified the paths correctly. With verbose output I found out, that when building for windows, it wants to build a statically by default (use_static_cpp=true), while building for linux is shared by default (use_static_cpp=false).
Is there a reason behind this? Wouldn't it make more sense to have a consistent build option across systems?
Build for windows:
`scons platform=windows debug_symbols=yes`
build for linux:
`scons platform=linux debug_symbols=yes`
SConstruct file:
```
#!/usr/bin/env python
import os
import sys
env = SConscript("../godot-cpp/SConstruct")
# For reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
if env["platform"] == "windows":
library = env.SharedLibrary(
"bin/mylib{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
LIBS=["", f"godot-cpp{env["suffix"]}"],
LIBPATH=["", "../godot-cpp/bin"],
)
else:
library = env.SharedLibrary(
"bin/mylib{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
LIBS=["", f"godot-cpp{env["suffix"]}"],
LIBPATH=["", "../godot-cpp/bin"],
)
Default(library)
```
### Steps to reproduce
Build for windows:
`scons platform=windows debug_symbols=yes`
build for linux:
`cons platform=linux debug_symbols=yes`
### Minimal reproduction project
N/A
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.