Skip to content

Commit

Permalink
Merge pull request Araq#2 from couven92/master
Browse files Browse the repository at this point in the history
Moved wxWidgets compiler / linker cfg to wxCompile
  • Loading branch information
PMunch authored Mar 19, 2017
2 parents 2ccc39c + 921ecf0 commit 2c4d1b1
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 104 deletions.
2 changes: 1 addition & 1 deletion examples/example1.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

include ../wxCompile
#import wx

{.emit: """
Expand Down
104 changes: 1 addition & 103 deletions examples/nim.cfg
Original file line number Diff line number Diff line change
@@ -1,103 +1 @@
@if vcc:
--passC:"/I..\\..\\wxWidgets-3.0.2\\include"
--passC:"/D__WXMSW__ /DNDEBUG /D_UNICODE"

@if i386:
@if windows:
--passC:"/I..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\mswu"

--passL:"kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
@end # windows

--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxbase30u.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxbase30u_net.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxbase30u_xml.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxexpat.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxjpeg.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_adv.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_aui.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_core.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_gl.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_html.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_media.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_propgrid.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_qa.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_ribbon.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_richtext.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_stc.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_webview.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxmsw30u_xrc.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxpng.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxregexu.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxscintilla.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxtiff.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_lib\\wxzlib.lib"
@elif amd64: # @end # i386
@if windows:
--passC:"/I..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\mswu"

--passL:"kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
@end # windows

--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxbase30u.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxbase30u_net.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxbase30u_xml.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxexpat.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxjpeg.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_adv.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_aui.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_core.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_gl.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_html.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_media.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_propgrid.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_qa.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_ribbon.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_richtext.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_stc.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_webview.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxmsw30u_xrc.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxpng.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxregexu.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxscintilla.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxtiff.lib"
--passL:"..\\..\\wxWidgets-3.0.2\\lib\\vc_x64_lib\\wxzlib.lib"
@end # amd64

@elif gcc: # @end # vcc
@if windows:
--passC:"-I../../wxWidgets-3.0.2/include"

--passC:"-D__WXMSW__ -DNDEBUG -D_UNICODE"
--passC:"-Wfatal-errors"

--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxbase30u.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxbase30u_net.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxbase30u_xml.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxexpat.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxjpeg.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_adv.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_aui.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_core.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_gl.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_html.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_media.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_propgrid.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_qa.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_ribbon.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_richtext.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_stc.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_webview.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxmsw30u_xrc.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxpng.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxregexu.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxscintilla.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxtiff.a"
--passL:"../../wxWidgets-3.0.2/lib/gcc_lib/wxzlib.a"

--passL:"-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32"
@else: # @end # windows
--passC:"`wx-config --cppflags`"
--passL:"`wx-config --libs`"
@end # !windows
@end # gcc
-d:"wxWidgetsPath:../../wxWidgets-3.0.2"
2 changes: 2 additions & 0 deletions wx.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

# Andreas Rumpf 2015

include wxCompile

const
wxh* = """#include <wx/wxprec.h>
#ifndef WX_PRECOMP
Expand Down
90 changes: 90 additions & 0 deletions wxCompile.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# additional compiler and linker instructions to include wxWidgets binaries in Nim
# Fredrik Høisæther Rasch (@couven92), 2017

include ospaths

when defined(vcc):
when defined(windows):
{.passC: "/D__WXMSW__".}
# Include basic Windows libraries required by wxWidgets. VCC does dead code emilination of these include libraries if something is not required during linking.
{.passL: "kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib".}

when defined(wxWidgetsPath):
const wxWidgetsPath {.strdefine.}: string = nil
when len(wxWidgetsPath) < 1:
{.error: "wxWidgetsPath must not be an empty string.".}
{.passC: "/I\"" & (wxWidgetsPath / "include") & "\"" .}
when defined(i386):
const wxWidgetsLibPath: string = wxWidgetsPath / "lib" / "vc_lib"
elif defined(amd64):
const wxWidgetsLibPath: string = wxWidgetsPath / "lib" / "vc_x64_lib"
when defined(windows):
{.passC: "/I\"" & (wxWidgetsLibPath / "mswu") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_adv.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_aui.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_core.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_gl.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_html.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_media.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_propgrid.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_qa.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_ribbon.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_richtext.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_stc.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_webview.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_xrc.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxbase30u.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxbase30u_net.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxbase30u_xml.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxexpat.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxjpeg.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxpng.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxregexu.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxscintilla.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxtiff.lib") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxzlib.lib") & "\"".}
else: # not defined(wxWidgetsPath)
# Assume wxWidgets lib library included in linker library directory path
{.passL: "wxmsw30u_adv.lib wxmsw30u_aui.lib wxmsw30u_core.lib wxmsw30u_gl.lib wxmsw30u_html.lib wxmsw30u_media.lib wxmsw30u_propgrid.lib wxmsw30u_qa.lib wxmsw30u_ribbon.lib wxmsw30u_richtext.lib wxmsw30u_stc.lib wxmsw30u_webview.lib wxmsw30u_xrc.lib".}
{.passL: "wxbase30u.lib wxbase30u_net.lib wxbase30u_xml.lib wxexpat.lib wxjpeg.lib wxpng.lib wxregexu.lib wxscintilla.lib wxtiff.lib wxzlib.lib".}

elif defined(gcc):
when defined(windows):
{.passC: "-D__WXMSW__".}
# Include basic Windows libraries required by wxWidgets. VCC does dead code emilination of these include libraries if something is not required during linking.
{.passL: "-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32".}
when defined(wxWidgetsPath):
{.passC: "-I\"" & (wxWidgetsPath / "include") & "\"".}
const wxWidgetsLibPath: string = wxWidgetsPath / "lib" / "gcc_lib"
when defined(windows):
{.passC: "/I\"" & (wxWidgetsLibPath / "mswu") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_adv.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_aui.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_core.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_gl.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_html.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_media.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_propgrid.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_qa.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_ribbon.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_richtext.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_stc.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_webview.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxmsw30u_xrc.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxbase30u.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxbase30u_net.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxbase30u_xml.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxexpat.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxjpeg.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxpng.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxregexu.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxscintilla.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxtiff.a") & "\"".}
{.passL: "\"" & (wxWidgetsLibPath / "wxzlib.a") & "\"".}
else: # not defined(wxWidgetsPath)
# Assume wxWidgets lib library included in linker library directory path
{.passL: "wxmsw30u_adv.a wxmsw30u_aui.a wxmsw30u_core.a wxmsw30u_gl.a wxmsw30u_html.a wxmsw30u_media.a wxmsw30u_propgrid.a wxmsw30u_qa.a wxmsw30u_ribbon.a wxmsw30u_richtext.a wxmsw30u_stc.a wxmsw30u_webview.a wxmsw30u_xrc.a".}
{.passL: "wxbase30u.a wxbase30u_net.a wxbase30u_xml.a wxexpat.a wxjpeg.a wxpng.a wxregexu.a wxscintilla.a wxtiff.a wxzlib.a".}
else: # not defined(windows)
{.passC: "`wx-config --cppflags`".}
{.passL: "`wx-config --libs`".}

0 comments on commit 2c4d1b1

Please sign in to comment.