Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux CI
name: Linux TCL8 build

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
- name: Install dependencies
run: |
brew update
brew install tcl-tk || true
sudo mkdir -p /usr/local
sudo ln -sf /usr/local/opt/tcl-tk/include/tcl-tk /usr/local/include/tcl8.6
sudo install /usr/local/opt/tcl-tk/lib/libtcl* /usr/local/lib
sudo ln -sf /usr/local/opt/tcl-tk/bin/tclsh8.6 /usr/local/bin/tclsh
sudo ln -sf /usr/local/opt/tcl-tk/bin/tclsh8.6 /usr/local/bin/tclsh8.6
brew reinstall tcl-tk@8
- name: make
run: make
run: |
PREFIX=/opt/homebrew/opt/tcl-tk@8
export LDFLAGS="-L$PREFIX/lib"
export CPPFLAGS="-I$PREFIX/include"
export TCL_ROOT=$PREFIX
make
- name: install
run: sudo make install
- name: make test
Expand Down
17 changes: 4 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ include(cmake/version.cmake)
load_git_properties(cpptcl ${CMAKE_BINARY_DIR}/generated)

set(CPPTCL_VERSION 2.2.8)
cmake_policy(SET CMP0074 NEW)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to Release as none was specified.")
set(CMAKE_BUILD_TYPE Release)
endif()
message(INFO " cmake build type ${CMAKE_BUILD_TYPE}")

set(TCLSH_VERSION_STRING, "8.6")

# Determine if cpptcl is built as a subproject (using add_subdirectory)
# or if it is the master project.
set(CPPTCL_MASTER_PROJECT OFF)
Expand All @@ -38,17 +37,9 @@ endif()

include (CTest)

set(TCL_VERSION_MAJOR "8" CACHE STRING "TCL Major version")
set(TCL_VERSION_MINOR "6" CACHE STRING "TCL Minor version")
set(TCL_TCLSH "tclsh${TCL_VERSION_MAJOR}.${TCL_VERSION_MINOR}")
set(TCL_VER "${TCL_VERSION_MAJOR}.${TCL_VERSION_MINOR}")
set(TCL_VER_BSD "${TCL_VERSION_MAJOR}${TCL_VERSION_MINOR}")

message(INFO " TCL_VER ${TCL_VER}")

find_path(TCL_INCLUDE_PATH tcl.h PATHS /usr/local/include/tcl${TCL_VER} /usr/local/include /usr/include/tcl${TCL_VER} /usr/include NO_DEFAULT_PATH)
find_library(TCL_LIBRARY NAMES tcl${TCL_VER} tcl${TCL_VER_BSD} PATHS /usr/local/lib /usr/lib)
find_library(TCL_STUB_LIBRARY NAMES tclstub${TCL_VER} tclstub${TCL_VER_BSD} PATHS /usr/local/lib /usr/lib)
find_package(TCL)
find_package(TclStub)
find_package(Tclsh)

message(INFO " Tcl include ${TCL_INCLUDE_PATH}")
message(INFO " Tcl library ${TCL_LIBRARY}")
Expand Down
4 changes: 2 additions & 2 deletions COMMONmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CPPTCL_LIBRARY = build/libcpptcl.so
all: $(CPPTCL_LIBRARY)

build/Makefile: CMakeLists.txt
(mkdir -p build; cd build; cmake -DTCL_VERSION_MINOR:STRING=$${TCL_VERSION_MINOR:-6} ..)
(mkdir -p build; cd build; cmake ..)

debug: CMakeLists.txt
(mkdir -p build; cd build; cmake -DCMAKE_BUILD_TYPE=Debug ..)
Expand All @@ -15,7 +15,7 @@ install: all
(cd build; make install)

test: build/Makefile
(cd build; ctest)
(cd build; ctest --output-on-failure)

examples: build/Makefile
(cd build; make examples)
Expand Down
2 changes: 1 addition & 1 deletion cpptcl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ interpreter::interpreter(Tcl_Interp *interp, bool owner) {
interp_ = interp;
owner_ = owner;
if (!defaultInterpreter) {
if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
throw tcl_error("Failed to initialize stubs");
}
// Make a copy
Expand Down
2 changes: 1 addition & 1 deletion cpptcl/cpptcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ inline std::ostream & operator<<(std::ostream &os, const object& obj)
#define CPPTCL_MODULE(name, i) \
void name##_cpptcl_Init(Tcl::interpreter &i); \
extern "C" int name##_Init(Tcl_Interp *interp) { \
Tcl_InitStubs(interp, "8.3", 0); \
Tcl_InitStubs(interp, "8.6-", 0); \
Tcl::interpreter i(interp, false); \
name##_cpptcl_Init(i); \
return TCL_OK; \
Expand Down
2 changes: 1 addition & 1 deletion examples/example2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace Tcl;
void hello() { cout << "Hello C++/Tcl!" << endl; }

int main() {
Tcl_Interp * interp = Tcl_CreateInterpWithStubs("8.6", 0);
Tcl_Interp * interp = Tcl_CreateInterpWithStubs("8.6-", 0);
interpreter i(interp, true);
i.def("hello", hello);

Expand Down
2 changes: 1 addition & 1 deletion examples/example6.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace std;
using namespace Tcl;

int main() {
Tcl_Interp * interp = Tcl_CreateInterpWithStubs("8.6", 0);
Tcl_Interp * interp = Tcl_CreateInterpWithStubs("8.6-", 0);
interpreter i(interp, true);

int numbers[] = {5, 7, 1, 6, 3, 9, 7};
Expand Down
2 changes: 2 additions & 0 deletions test/test1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ int fun5(char const *s) { return std::string(s).size(); }
void test1() {
Tcl_Interp * interp = Tcl_CreateInterp();
interpreter i(interp, true);
#if (TCL_MAJOR_VERSION < 9)
i.make_safe();
#endif

std::string s = i.eval("return \"ala ma kota\"");
assert(s == "ala ma kota");
Expand Down
Loading