Hi there,

While I was working on updating the version of Gnucap in the FreeBSD
Ports Collection, I realized that I didn't really like the existing
build system, for multiple reasons. Feeling adventurous, I cloned the
repository and tried to set up a build system using CMake.

Attached is a patch with my work in progress. Although it is still far
from finished, I think it's a good start towards a cleaner build system.
You can apply the patch by using `git am <patch>`.

A major limitation is that CMake refuses to create output files with the
"same" name. Since there is already a "gnucap" library, it is not able
to produce a "gnucap" executable. I've temporarily renamed the
executable to "gcap", which can successfully run on my machine.

I know that build systems bring big changes (and dependencies), but I
would like the project to consider the prospect of moving to a simpler,
more elegant build system.

Thanks,
Kevin Zheng
From 5ac3753c98c6ba3d406f34c017e60f0050b6af44 Mon Sep 17 00:00:00 2001
From: Kevin Zheng <[email protected]>
Date: Fri, 10 May 2013 17:44:09 -0500
Subject: [PATCH] Add new experimental build system using CMake.

Because CMake does not allow the same name to be used with multiple
output files, the 'gnucap' binary has been TEMPORARILY renamed to 'gcap'
to avoid having to change the name of libgnucap.so.
---
 CMakeLists.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..813c227
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 2.6)
+project(gnucap)
+
+# Tell the compiler where to find the header files.
+include_directories(include/)
+
+# Build shared library.
+add_library(gnucap SHARED lib/ap_construct.cc lib/ap_convert.cc 
lib/ap_error.cc lib/ap_get.cc lib/ap_match.cc lib/ap_skip.cc lib/bm.cc 
lib/bm_cond.cc lib/bm_value.cc lib/c__cmd.cc lib/c_attach.cc lib/c_file.cc 
lib/d_logic.cc lib/d_logicmod.cc lib/d_subckt.cc lib/e_base.cc lib/e_card.cc 
lib/e_cardlist.cc lib/e_ccsrc.cc lib/e_compon.cc lib/e_elemnt.cc lib/e_model.cc 
lib/e_node.cc lib/e_storag.cc lib/findbr.cc lib/globals.cc lib/io.cc 
lib/io_contr.cc lib/io_error.cc lib/io_findf.cc lib/io_out.cc lib/io_xopen.cc 
lib/l_ftos.cc lib/l_pmatch.cc lib/l_timer.cc lib/l_trim.cc lib/l_wmatch.cc 
lib/m_base_in.cc lib/m_base_math.cc lib/m_expression_dump.cc 
lib/m_expression_in.cc lib/m_expression_reduce.cc lib/m_fft.cc lib/m_spline.cc 
lib/plot.cc lib/u_function.cc lib/u_lang.cc lib/u_nodemap.cc lib/u_opt1.cc 
lib/u_opt2.cc lib/u_parameter.cc lib/u_prblst.cc lib/u_probe.cc 
lib/u_sim_data.cc lib/u_xprobe.cc)
+
+add_library(gnucap-modelgen modelgen/mg_error.cc modelgen/mg_in.cc 
modelgen/mg_main.cc modelgen/mg_out_common.cc modelgen/mg_out_dev.cc 
modelgen/mg_out_dump.cc modelgen/mg_out_h.cc modelgen/mg_out_lib.cc 
modelgen/mg_out_model.cc modelgen/mg_out_root.cc)
+
+# Build default plugins (apps).
+add_library(gnucap-default-plugins SHARED apps/bm_complex.cc apps/bm_exp.cc 
apps/bm_fit.cc apps/bm_generator.cc apps/bm_model.cc apps/bm_poly.cc 
apps/bm_posy.cc apps/bm_pulse.cc apps/bm_pwl.cc apps/bm_sffm.cc apps/bm_sin.cc 
apps/bm_tanh.cc apps/bmm_semi.cc apps/bmm_table.cc apps/c_clear.cc 
apps/c_comand.cc apps/c_delete.cc apps/c_exp.cc apps/c_genrat.cc apps/c_list.cc 
apps/c_measure.cc apps/c_modify.cc apps/c_param.cc apps/c_prbcmd.cc 
apps/c_sim.cc apps/c_status.cc apps/c_sweep.cc apps/c_system.cc apps/d_admit.cc 
apps/d_cap.cc apps/d_cccs.cc apps/d_ccvs.cc apps/d_coil.cc apps/d_cs.cc 
apps/d_meter.cc apps/d_poly_cap.cc apps/d_poly_g.cc apps/d_res.cc 
apps/d_switch.cc apps/d_trln.cc apps/d_vcg.cc apps/d_vcr.cc apps/d_vcvs.cc 
apps/d_vs.cc apps/func_core.cc apps/lang_spectre.cc apps/lang_spice.cc 
apps/lang_verilog.cc apps/measure_at.cc apps/measure_average.cc 
apps/measure_cross.cc apps/measure_eval.cc apps/measure_integral.cc 
apps/measure_max.cc apps/measure_min.cc apps/measure_rms.cc 
apps/measure_slewrate.cc apps/s__init.cc apps/s__out.cc apps/s__solve.cc 
apps/s_ac.cc apps/s_dc.cc apps/s_fo.cc apps/s_tr.cc apps/s_tr_set.cc 
apps/s_tr_swp.cc apps/signon.cc)
+
+# Build gnucap binary.
+add_executable(gcap main/main.cc)
+target_link_libraries(gcap gnucap)
-- 
1.8.2.2

_______________________________________________
Gnucap-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnucap-devel

Reply via email to