Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Library_Options for macOS. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions sqlite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ ifeq ($(NORMALIZED_TARGET),)
$(error No toolchain found for target "$(TARGET)")
endif

GNATCOLL_OS := $(if $(findstring darwin,$(NORMALIZED_TARGET)),osx,$(if $(findstring windows,$(NORMALIZED_TARGET)),windows,unix))

prefix := $(dir $(shell $(WHICH) gnatls))..
GNATCOLL_VERSION := $(shell $(CAT) $(SOURCE_DIR)/../version_information)
GNATCOLL_SQLITE := embedded
Expand Down Expand Up @@ -102,6 +104,7 @@ endif
GPR_VARS= \
-XGNATCOLL_SQLITE=$(GNATCOLL_SQLITE) \
-XGNATCOLL_VERSION=$(GNATCOLL_VERSION) \
-XGNATCOLL_OS=$(GNATCOLL_OS) \
-XBUILD=$(BUILD)

# Used to pass extra options to GPRBUILD, like -d for instance
Expand Down Expand Up @@ -162,6 +165,7 @@ setup:
$(ECHO) "BUILD=$(BUILD)" >> makefile.setup
$(ECHO) "PROCESSORS=$(PROCESSORS)" >> makefile.setup
$(ECHO) "TARGET=$(TARGET)" >> makefile.setup
$(ECHO) "GNATCOLL_OS=$(GNATCOLL_OS)" >> makefile.setup
$(ECHO) "SOURCE_DIR=$(SOURCE_DIR)" >> makefile.setup
$(ECHO) "GNATCOLL_VERSION=$(GNATCOLL_VERSION)" >> makefile.setup
$(ECHO) "GNATCOLL_SQLITE=$(GNATCOLL_SQLITE)" >> makefile.setup
Expand Down
11 changes: 8 additions & 3 deletions sqlite/gnatcoll_sqlite.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ with "gnatcoll_sql";
project GnatColl_Sqlite is

Version := External ("GNATCOLL_VERSION", "0.0");
OS := External ("OS", "unix");
type OS_Kind is ("windows", "unix", "osx");
OS : OS_Kind := External ("GNATCOLL_OS", "unix");
Name := "gnatcoll_sqlite";

type Build_Type is ("DEBUG", "PROD");
Expand All @@ -45,6 +46,7 @@ project GnatColl_Sqlite is
for Languages use ("Ada", "C");

Thread_Lib := ();
Lib_Opt_Ext := ();

case Library_Type is
when "relocatable" =>
Expand All @@ -54,10 +56,13 @@ project GnatColl_Sqlite is
end case;

case OS is
when "Windows_NT" =>
when "windows" =>
Lib_Opt_Ext := ("-lsqlite3");
when "osx" =>
null;
when others =>
Thread_Lib := ("-lpthread");
Lib_Opt_Ext := ("-lsqlite3") & Thread_Lib;
end case;

type Sqlite_Dep_Kind is ("embedded", "external");
Expand All @@ -68,7 +73,7 @@ project GnatColl_Sqlite is
for Source_Dirs use (".", "amalgamation");
when "external" =>
for Source_Dirs use (".");
for Library_Options use ("-lsqlite3") & Thread_Lib;
for Library_Options use Lib_Opt_Ext;
end case;

package Compiler is
Expand Down