mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-12-21 14:56:47 +01:00
More standalone build setup work.
This commit is contained in:
parent
aaebd450bb
commit
73c3997813
78
SConstruct
78
SConstruct
@ -631,3 +631,81 @@ def print_elapsed_time():
|
||||
|
||||
|
||||
atexit.register(print_elapsed_time)
|
||||
|
||||
env.modules_sources = []
|
||||
module_env = env.Clone()
|
||||
|
||||
module_env.pmlpp_build_tests = True
|
||||
|
||||
if ARGUMENTS.get('pmlpp_build_tests', 'yes') == 'no':
|
||||
module_env.pmlpp_build_tests = False
|
||||
|
||||
sources = [
|
||||
"register_types.cpp",
|
||||
|
||||
"lin_alg/mlpp_vector.cpp",
|
||||
"lin_alg/mlpp_matrix.cpp",
|
||||
"lin_alg/mlpp_tensor3.cpp",
|
||||
|
||||
"activation/activation.cpp",
|
||||
"ann/ann.cpp",
|
||||
"auto_encoder/auto_encoder.cpp",
|
||||
"bernoulli_nb/bernoulli_nb.cpp",
|
||||
"c_log_log_reg/c_log_log_reg.cpp",
|
||||
"convolutions/convolutions.cpp",
|
||||
"cost/cost.cpp",
|
||||
"data/data.cpp",
|
||||
"dual_svc/dual_svc.cpp",
|
||||
"exp_reg/exp_reg.cpp",
|
||||
"gan/gan.cpp",
|
||||
"gaussian_nb/gaussian_nb.cpp",
|
||||
"gauss_markov_checker/gauss_markov_checker.cpp",
|
||||
"hidden_layer/hidden_layer.cpp",
|
||||
"hypothesis_testing/hypothesis_testing.cpp",
|
||||
"kmeans/kmeans.cpp",
|
||||
"knn/knn.cpp",
|
||||
"lin_alg/lin_alg.cpp",
|
||||
"lin_reg/lin_reg.cpp",
|
||||
"log_reg/log_reg.cpp",
|
||||
"mann/mann.cpp",
|
||||
"mlp/mlp.cpp",
|
||||
"multinomial_nb/multinomial_nb.cpp",
|
||||
"multi_output_layer/multi_output_layer.cpp",
|
||||
"numerical_analysis/numerical_analysis.cpp",
|
||||
"outlier_finder/outlier_finder.cpp",
|
||||
"output_layer/output_layer.cpp",
|
||||
"pca/pca.cpp",
|
||||
"probit_reg/probit_reg.cpp",
|
||||
"regularization/reg.cpp",
|
||||
"softmax_net/softmax_net.cpp",
|
||||
"softmax_reg/softmax_reg.cpp",
|
||||
"stat/stat.cpp",
|
||||
"svc/svc.cpp",
|
||||
"tanh_reg/tanh_reg.cpp",
|
||||
"transforms/transforms.cpp",
|
||||
"uni_lin_reg/uni_lin_reg.cpp",
|
||||
"utilities/utilities.cpp",
|
||||
"wgan/wgan.cpp",
|
||||
]
|
||||
|
||||
if module_env.pmlpp_build_tests:
|
||||
module_env.Prepend(CPPDEFINES=["TESTS_ENABLED"])
|
||||
|
||||
sources += [
|
||||
"test/mlpp_tests.cpp",
|
||||
"test/mlpp_matrix_tests.cpp",
|
||||
]
|
||||
|
||||
|
||||
if ARGUMENTS.get('pmlpp_shared', 'no') == 'yes':
|
||||
# Shared lib compilation
|
||||
module_env.Append(CCFLAGS=['-fPIC'])
|
||||
module_env['LIBS'] = []
|
||||
shared_lib = module_env.SharedLibrary(target='#bin/pmlpp', source=sources)
|
||||
shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0]
|
||||
env.Append(LIBS=[shared_lib_shim])
|
||||
env.Append(LIBPATH=['#bin'])
|
||||
else:
|
||||
# Static compilation
|
||||
module_env.add_source_files(env.modules_sources, sources)
|
||||
|
||||
|
@ -10,3 +10,10 @@ env.add_source_files(env.platform_sources, "sfwl.cpp")
|
||||
|
||||
lib = env.add_library("platform", env.platform_sources)
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
||||
# TODO Move this to somewhere else, so it can be easily overridden
|
||||
env.main_sources = []
|
||||
|
||||
env.add_source_files(env.main_sources, "main.cpp")
|
||||
lib = env.add_library("main", env.main_sources)
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
5
platform/main.cpp
Normal file
5
platform/main.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
int main() {
|
||||
|
||||
return 0;
|
||||
}
|
14
platform/osx/SCsub
Normal file
14
platform/osx/SCsub
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
from platform_methods import run_in_subprocess
|
||||
import platform_osx_builders
|
||||
|
||||
files = [
|
||||
]
|
||||
|
||||
prog = env.add_program("#bin/pandemonium", files)
|
||||
|
||||
if env["debug_symbols"] and env["separate_debug_symbols"]:
|
||||
env.AddPostAction(prog, run_in_subprocess(platform_osx_builders.make_debug_osx))
|
21
platform/osx/platform_osx_builders.py
Normal file
21
platform/osx/platform_osx_builders.py
Normal file
@ -0,0 +1,21 @@
|
||||
"""Functions used to generate source files during build time
|
||||
|
||||
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
|
||||
|
||||
"""
|
||||
import os
|
||||
from platform_methods import subprocess_main
|
||||
|
||||
|
||||
def make_debug_osx(target, source, env):
|
||||
if env["macports_clang"] != "no":
|
||||
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
|
||||
mpclangver = env["macports_clang"]
|
||||
os.system(mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-dsymutil {0} -o {0}.dSYM".format(target[0]))
|
||||
else:
|
||||
os.system("dsymutil {0} -o {0}.dSYM".format(target[0]))
|
||||
os.system("strip -u -r {0}".format(target[0]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
subprocess_main(globals())
|
21
platform/windows/SCsub
Normal file
21
platform/windows/SCsub
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
import os
|
||||
from platform_methods import run_in_subprocess
|
||||
import platform_windows_builders
|
||||
|
||||
common_win = [
|
||||
]
|
||||
|
||||
prog = env.add_program("#bin/pandemonium", common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
|
||||
|
||||
# Microsoft Visual Studio Project Generation
|
||||
if env["vsproj"]:
|
||||
for x in common_win:
|
||||
env.vs_srcs += ["platform/windows/" + str(x)]
|
||||
|
||||
if not os.getenv("VCINSTALLDIR"):
|
||||
if env["debug_symbols"] and env["separate_debug_symbols"]:
|
||||
env.AddPostAction(prog, run_in_subprocess(platform_windows_builders.make_debug_mingw))
|
22
platform/windows/platform_windows_builders.py
Normal file
22
platform/windows/platform_windows_builders.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""Functions used to generate source files during build time
|
||||
|
||||
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
|
||||
|
||||
"""
|
||||
import os
|
||||
from platform_methods import subprocess_main
|
||||
|
||||
|
||||
def make_debug_mingw(target, source, env):
|
||||
mingw_prefix = ""
|
||||
if env["bits"] == "32":
|
||||
mingw_prefix = env["mingw_prefix_32"]
|
||||
else:
|
||||
mingw_prefix = env["mingw_prefix_64"]
|
||||
os.system(mingw_prefix + "objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
|
||||
os.system(mingw_prefix + "strip --strip-debug --strip-unneeded {0}".format(target[0]))
|
||||
os.system(mingw_prefix + "objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
subprocess_main(globals())
|
17
platform/x11/SCsub
Normal file
17
platform/x11/SCsub
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
from platform_methods import run_in_subprocess
|
||||
import platform_x11_builders
|
||||
|
||||
common_x11 = [
|
||||
]
|
||||
|
||||
if "udev" in env and env["udev"]:
|
||||
common_x11.append("libudev-so_wrap.c")
|
||||
|
||||
prog = env.add_program("#bin/pandemonium", common_x11)
|
||||
|
||||
if env["debug_symbols"] and env["separate_debug_symbols"]:
|
||||
env.AddPostAction(prog, run_in_subprocess(platform_x11_builders.make_debug_x11))
|
17
platform/x11/platform_x11_builders.py
Normal file
17
platform/x11/platform_x11_builders.py
Normal file
@ -0,0 +1,17 @@
|
||||
"""Functions used to generate source files during build time
|
||||
|
||||
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
|
||||
|
||||
"""
|
||||
import os
|
||||
from platform_methods import subprocess_main
|
||||
|
||||
|
||||
def make_debug_x11(target, source, env):
|
||||
os.system("objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
|
||||
os.system("strip --strip-debug --strip-unneeded {0}".format(target[0]))
|
||||
os.system("objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
subprocess_main(globals())
|
Loading…
Reference in New Issue
Block a user