11set_project (" dynareadout" )
2+ add_rules (" mode.debug" , " mode.release" )
23
3- option (" build_test" )
4- set_default (false )
5- set_showmenu (true )
6-
7- option (" build_cpp" )
8- set_default (true )
9- set_showmenu (true )
10-
11- option (" build_python" )
12- set_default (false )
13- set_showmenu (true )
14-
15- option (" profiling" )
16- set_default (false )
17- set_showmenu (true )
18- add_defines (" PROFILING" )
19- option_end ()
4+ option (" build_cpp" , {default = true })
5+ option (" build_python" , {default = false })
6+ option (" profiling" , {default = false , defines = " PROFILING" })
207
21- add_rules (" mode.debug" , " mode.release" )
228target (" dynareadout" )
239 set_kind (" $(kind)" )
2410 set_languages (" ansi" )
25- if is_plat (" linux" ) then
26- add_cflags (" -fPIC" )
27- end
2811 add_options (" profiling" )
2912 add_files (" src/*.c" )
30- if not get_config (" profiling" ) then
13+ if not has_config (" profiling" ) then
3114 remove_files (" src/profiling.c" )
3215 end
3316 add_headerfiles (" src/*.h" )
@@ -36,16 +19,13 @@ target("dynareadout")
3619 end
3720target_end ()
3821
39- if get_config (" build_cpp" ) or get_config ( " build_python" ) then
22+ if has_config (" build_cpp" , " build_python" ) then
4023 if is_plat (" macosx" ) then
4124 add_requires (" boost" , {configs = {filesystem = true }})
4225 end
4326 target (" dynareadout_cpp" )
4427 set_kind (" $(kind)" )
4528 set_languages (" cxx17" )
46- if is_plat (" linux" ) then
47- add_cxxflags (" -fPIC" )
48- end
4929 add_deps (" dynareadout" )
5030 add_includedirs (" src" )
5131 add_files (" src/cpp/*.cpp" )
@@ -59,48 +39,20 @@ if get_config("build_cpp") or get_config("build_python") then
5939 target_end ()
6040end
6141
62- if get_config (" build_test" ) then
63- add_requires (" doctest 2.4.8" )
64- target (" dynareadout_test" )
65- set_kind (" binary" )
66- set_languages (" cxx17" )
67- add_deps (" dynareadout" )
68- if is_plat (" linux" ) then
69- add_cxxflags (" -fPIC" )
70- end
71- if get_config (" build_cpp" ) then
72- add_deps (" dynareadout_cpp" )
73- add_defines (" BINOUT_CPP" , " D3PLOT_CPP" )
74- add_includedirs (" src/cpp" )
75- end
76- add_packages (" doctest" )
77- add_includedirs (" src" )
78- add_options (" profiling" )
79- add_files (" test/*.cpp" )
80- target_end ()
81- end
82-
83- if get_config (" build_python" ) then
84- add_requires (" python3" , " pybind11" )
42+ if has_config (" build_python" ) then
43+ add_requires (" python 3.x" , " pybind11" )
8544 target (" pybind11_module" )
86- set_kind (" shared" )
8745 set_languages (" cxx17" )
88- if is_plat (" linux" ) then
89- add_cxxflags (" -fPIC" )
90- end
9146 add_deps (" dynareadout_cpp" )
92- add_packages (" pybind11" )
47+ add_packages (" python" , " pybind11" )
48+ add_rules (" python.module" )
9349 add_options (" profiling" )
9450 add_files (" src/python/*.cpp" )
9551 add_headerfiles (" src/python/*.hpp" )
9652 add_includedirs (" src" , " src/cpp" )
9753 add_rpathdirs (" @executable_path" )
9854
9955 on_load (function (target )
100- local ext_file = os .tmpfile ()
101- os .execv (" python3-config" , {" --extension-suffix" }, {stdout = ext_file })
102- ext_name = io .readfile (ext_file )
103- ext_name = ext_name :gsub (" %s+" , " " )
104- target :set (" filename" , " dynareadout" .. (is_mode (" debug" ) and " _d" or " " ) .. ext_name )
56+ target :set (" filename" , " dynareadout" .. (is_mode (" debug" ) and " _d" or " " ))
10557 end )
10658end
0 commit comments